Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/gpu/gpu_py_buffer.c
| Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | for (int i = 0; i < shape_len; i++) { | ||||
| if (r_shape[i] < 1) { | if (r_shape[i] < 1) { | ||||
| PyErr_SetString(PyExc_AttributeError, "dimension must be greater than or equal to 1"); | PyErr_SetString(PyExc_AttributeError, "dimension must be greater than or equal to 1"); | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| PyErr_Format(PyExc_TypeError, | PyErr_Format(PyExc_TypeError, | ||||
| "invalid second argument argument expected a sequence " | "invalid second argument expected a sequence " | ||||
| "or an int, not a %.200s", | "or an int, not a %.200s", | ||||
| Py_TYPE(shape_obj)->tp_name); | Py_TYPE(shape_obj)->tp_name); | ||||
| } | } | ||||
| *r_shape_len = shape_len; | *r_shape_len = shape_len; | ||||
| return true; | return true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 538 Lines • ▼ Show 20 Lines | |||||
| PyDoc_STRVAR( | PyDoc_STRVAR( | ||||
| pygpu_buffer__tp_doc, | pygpu_buffer__tp_doc, | ||||
| ".. class:: Buffer(format, dimensions, data)\n" | ".. class:: Buffer(format, dimensions, data)\n" | ||||
| "\n" | "\n" | ||||
| " For Python access to GPU functions requiring a pointer.\n" | " For Python access to GPU functions requiring a pointer.\n" | ||||
| "\n" | "\n" | ||||
| " :arg format: Format type to interpret the buffer.\n" | " :arg format: Format type to interpret the buffer.\n" | ||||
| " Possible values are `FLOAT`, `INT`, `UINT`, `UBYTE`, `UINT_24_8` and `10_11_11_REV`.\n" | " Possible values are `FLOAT`, `INT`, `UINT`, `UBYTE`, `UINT_24_8` and `10_11_11_REV`.\n" | ||||
| " :type type: str\n" | " :type format: str\n" | ||||
| " :arg dimensions: Array describing the dimensions.\n" | " :arg dimensions: Array describing the dimensions.\n" | ||||
| " :type dimensions: int\n" | " :type dimensions: int\n" | ||||
| " :arg data: Optional data array.\n" | " :arg data: Optional data array.\n" | ||||
| " :type data: sequence\n"); | " :type data: sequence\n"); | ||||
| PyTypeObject BPyGPU_BufferType = { | PyTypeObject BPyGPU_BufferType = { | ||||
| PyVarObject_HEAD_INIT(NULL, 0).tp_name = "Buffer", | PyVarObject_HEAD_INIT(NULL, 0).tp_name = "Buffer", | ||||
| .tp_basicsize = sizeof(BPyGPUBuffer), | .tp_basicsize = sizeof(BPyGPUBuffer), | ||||
| .tp_dealloc = (destructor)pygpu_buffer__tp_dealloc, | .tp_dealloc = (destructor)pygpu_buffer__tp_dealloc, | ||||
| ▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines | |||||