Blender
V3.3
|
#include <Python.h>
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "GPU_texture.h"
#include "../generic/py_capi_utils.h"
#include "gpu_py.h"
#include "gpu_py_buffer.h"
Go to the source code of this file.
Macros | |
#define | PYGPU_BUFFER_PROTOCOL |
#define | MAX_DIMENSIONS 64 |
Functions | |
Utility Functions | |
static Py_ssize_t | pygpu_buffer_dimensions_tot_elem (const Py_ssize_t *shape, Py_ssize_t shape_len) |
static bool | pygpu_buffer_dimensions_tot_len_compare (const Py_ssize_t *shape_a, const Py_ssize_t shape_a_len, const Py_ssize_t *shape_b, const Py_ssize_t shape_b_len) |
static bool | pygpu_buffer_pyobj_as_shape (PyObject *shape_obj, Py_ssize_t r_shape[MAX_DIMENSIONS], Py_ssize_t *r_shape_len) |
static const char * | pygpu_buffer_formatstr (eGPUDataFormat data_format) |
BPyGPUBuffer API | |
static PyMethodDef | pygpu_buffer__tp_methods [] |
static PyGetSetDef | pygpu_buffer_getseters [] |
static PySequenceMethods | pygpu_buffer__tp_as_sequence |
static PyMappingMethods | pygpu_buffer__tp_as_mapping |
static PyBufferProcs | pygpu_buffer__tp_as_buffer |
PyTypeObject | BPyGPU_BufferType |
static BPyGPUBuffer * | pygpu_buffer_make_from_data (PyObject *parent, const eGPUDataFormat format, const int shape_len, const Py_ssize_t *shape, void *buf) |
static PyObject * | pygpu_buffer__sq_item (BPyGPUBuffer *self, int i) |
static PyObject * | pygpu_buffer_to_list (BPyGPUBuffer *self) |
static PyObject * | pygpu_buffer_to_list_recursive (BPyGPUBuffer *self) |
static PyObject * | pygpu_buffer_dimensions_get (BPyGPUBuffer *self, void *UNUSED(arg)) |
static int | pygpu_buffer_dimensions_set (BPyGPUBuffer *self, PyObject *value, void *UNUSED(type)) |
static int | pygpu_buffer__tp_traverse (BPyGPUBuffer *self, visitproc visit, void *arg) |
static int | pygpu_buffer__tp_clear (BPyGPUBuffer *self) |
static void | pygpu_buffer__tp_dealloc (BPyGPUBuffer *self) |
static PyObject * | pygpu_buffer__tp_repr (BPyGPUBuffer *self) |
static int | pygpu_buffer__sq_ass_item (BPyGPUBuffer *self, int i, PyObject *v) |
static int | pygpu_buffer_ass_slice (BPyGPUBuffer *self, Py_ssize_t begin, Py_ssize_t end, PyObject *seq) |
static PyObject * | pygpu_buffer__tp_new (PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) |
static int | pygpu_buffer__sq_length (BPyGPUBuffer *self) |
static PyObject * | pygpu_buffer_slice (BPyGPUBuffer *self, Py_ssize_t begin, Py_ssize_t end) |
static PyObject * | pygpu_buffer__mp_subscript (BPyGPUBuffer *self, PyObject *item) |
static int | pygpu_buffer__mp_ass_subscript (BPyGPUBuffer *self, PyObject *item, PyObject *value) |
static void | pygpu_buffer_strides_calc (const eGPUDataFormat format, const int shape_len, const Py_ssize_t *shape, Py_ssize_t *r_strides) |
static int | pygpu_buffer__bf_getbuffer (BPyGPUBuffer *self, Py_buffer *view, int flags) |
static void | pygpu_buffer__bf_releasebuffer (PyObject *UNUSED(exporter), Py_buffer *view) |
PyDoc_STRVAR (pygpu_buffer__tp_doc, ".. class:: Buffer(format, dimensions, data)\n" "\n" " For Python access to GPU functions requiring a pointer.\n" "\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" " :type type: str\n" " :arg dimensions: Array describing the dimensions.\n" " :type dimensions: int\n" " :arg data: Optional data array.\n" " :type data: sequence\n") | |
static size_t | pygpu_buffer_calc_size (const int format, const int shape_len, const Py_ssize_t *shape) |
size_t | bpygpu_Buffer_size (BPyGPUBuffer *buffer) |
BPyGPUBuffer * | BPyGPU_Buffer_CreatePyObject (const int format, const Py_ssize_t *shape, const int shape_len, void *buffer) |
This file defines the gpu.state API.
bpygpu_
for local API.BPyGPU
for public API. Definition in file gpu_py_buffer.c.
#define MAX_DIMENSIONS 64 |
Definition at line 27 of file gpu_py_buffer.c.
#define PYGPU_BUFFER_PROTOCOL |
Definition at line 26 of file gpu_py_buffer.c.
BPyGPUBuffer* BPyGPU_Buffer_CreatePyObject | ( | int | format, |
const Py_ssize_t * | shape, | ||
int | shape_len, | ||
void * | buffer | ||
) |
Create a buffer object
shape | An array of shape_len integers representing the size of each dimension. |
buffer | When not NULL holds a contiguous buffer with the correct format from which the buffer will be initialized |
Definition at line 694 of file gpu_py_buffer.c.
References buffer, MEM_callocN, NULL, pygpu_buffer_calc_size(), pygpu_buffer_make_from_data(), and size().
Referenced by pygpu_buffer__tp_new(), pygpu_framebuffer_read_color(), pygpu_framebuffer_read_depth(), and pygpu_texture_read().
size_t bpygpu_Buffer_size | ( | BPyGPUBuffer * | buffer | ) |
Definition at line 689 of file gpu_py_buffer.c.
References buffer, and pygpu_buffer_calc_size().
Referenced by pygpu_buffer__bf_getbuffer(), pygpu_framebuffer_read_color(), pygpu_framebuffer_read_depth(), and pygpu_texture__tp_new().
PyDoc_STRVAR | ( | pygpu_buffer__tp_doc | , |
".. class:: Buffer(format, dimensions, data)\n" "\n" " For Python access to GPU functions requiring a pointer.\n" "\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" " :type type:str\n" " :arg dimensions:Array describing the dimensions.\n" " :type dimensions:int\n" " :arg data:Optional data array.\n" " :type data:sequence\n" | |||
) |
|
static |
Definition at line 607 of file gpu_py_buffer.c.
References bpygpu_Buffer_size(), GPU_texture_dataformat_size(), MEM_mallocN, NULL, pygpu_buffer_formatstr(), pygpu_buffer_strides_calc(), self, and view.
|
static |
Definition at line 639 of file gpu_py_buffer.c.
References MEM_SAFE_FREE, and view.
|
static |
Definition at line 526 of file gpu_py_buffer.c.
References pygpu_buffer__sq_ass_item(), pygpu_buffer_ass_slice(), and self.
|
static |
Definition at line 490 of file gpu_py_buffer.c.
References NULL, pygpu_buffer__sq_item(), pygpu_buffer_slice(), and self.
|
static |
Definition at line 455 of file gpu_py_buffer.c.
References GPU_DATA_10_11_11_REV, GPU_DATA_FLOAT, GPU_DATA_INT, GPU_DATA_UBYTE, GPU_DATA_UINT, GPU_DATA_UINT_24_8, pygpu_buffer__sq_item(), pygpu_buffer_ass_slice(), ret, self, and v.
Referenced by pygpu_buffer__mp_ass_subscript(), and pygpu_buffer_ass_slice().
|
static |
Definition at line 161 of file gpu_py_buffer.c.
References GPU_DATA_10_11_11_REV, GPU_DATA_FLOAT, GPU_DATA_INT, GPU_DATA_UBYTE, GPU_DATA_UINT, GPU_DATA_UINT_24_8, GPU_texture_dataformat_size(), NULL, offset, pygpu_buffer_formatstr(), pygpu_buffer_make_from_data(), and self.
Referenced by pygpu_buffer__mp_subscript(), pygpu_buffer__sq_ass_item(), pygpu_buffer_slice(), pygpu_buffer_to_list(), and pygpu_buffer_to_list_recursive().
|
static |
Definition at line 427 of file gpu_py_buffer.c.
|
static |
Definition at line 278 of file gpu_py_buffer.c.
|
static |
Definition at line 287 of file gpu_py_buffer.c.
|
static |
Definition at line 369 of file gpu_py_buffer.c.
References BPyGPU_Buffer_CreatePyObject(), bpygpu_dataformat_items, buffer, GPU_DATA_FLOAT, init, MAX_DIMENSIONS, NULL, PyC_ParseStringEnum(), pygpu_buffer_ass_slice(), pygpu_buffer_dimensions_tot_len_compare(), pygpu_buffer_make_from_data(), pygpu_buffer_pyobj_as_shape(), and PyC_StringEnum::value_found.
|
static |
Definition at line 302 of file gpu_py_buffer.c.
References bpygpu_dataformat_items, PyC_StringEnum_FindIDFromValue(), pygpu_buffer_to_list_recursive(), and self.
|
static |
Definition at line 272 of file gpu_py_buffer.c.
References self.
|
static |
Definition at line 317 of file gpu_py_buffer.c.
References count, err, pygpu_buffer__sq_ass_item(), and self.
Referenced by pygpu_buffer__mp_ass_subscript(), pygpu_buffer__sq_ass_item(), and pygpu_buffer__tp_new().
|
static |
Definition at line 682 of file gpu_py_buffer.c.
References GPU_texture_dataformat_size(), and pygpu_buffer_dimensions_tot_elem().
Referenced by BPyGPU_Buffer_CreatePyObject(), and bpygpu_Buffer_size().
|
static |
Definition at line 236 of file gpu_py_buffer.c.
References self.
|
static |
Definition at line 248 of file gpu_py_buffer.c.
References MAX_DIMENSIONS, MEM_freeN, MEM_mallocN, pygpu_buffer_dimensions_tot_len_compare(), pygpu_buffer_pyobj_as_shape(), self, and size().
|
static |
Definition at line 33 of file gpu_py_buffer.c.
Referenced by pygpu_buffer_calc_size(), and pygpu_buffer_dimensions_tot_len_compare().
|
static |
Definition at line 43 of file gpu_py_buffer.c.
References pygpu_buffer_dimensions_tot_elem().
Referenced by pygpu_buffer__tp_new(), and pygpu_buffer_dimensions_set().
|
static |
Definition at line 112 of file gpu_py_buffer.c.
References GPU_DATA_10_11_11_REV, GPU_DATA_FLOAT, GPU_DATA_INT, GPU_DATA_UBYTE, GPU_DATA_UINT, GPU_DATA_UINT_24_8, and NULL.
Referenced by pygpu_buffer__bf_getbuffer(), and pygpu_buffer__sq_item().
|
static |
Definition at line 138 of file gpu_py_buffer.c.
References BPyGPU_BufferType, buffer, MEM_mallocN, and NULL.
Referenced by BPyGPU_Buffer_CreatePyObject(), pygpu_buffer__sq_item(), and pygpu_buffer__tp_new().
|
static |
Definition at line 57 of file gpu_py_buffer.c.
References MAX_DIMENSIONS, and STRINGIFY.
Referenced by pygpu_buffer__tp_new(), and pygpu_buffer_dimensions_set().
|
static |
Definition at line 432 of file gpu_py_buffer.c.
References count, pygpu_buffer__sq_item(), and self.
Referenced by pygpu_buffer__mp_subscript().
|
static |
Definition at line 595 of file gpu_py_buffer.c.
References GPU_texture_dataformat_size().
Referenced by pygpu_buffer__bf_getbuffer().
|
static |
Definition at line 200 of file gpu_py_buffer.c.
References len, and pygpu_buffer__sq_item().
Referenced by pygpu_buffer_to_list_recursive().
|
static |
Definition at line 212 of file gpu_py_buffer.c.
References len, pygpu_buffer__sq_item(), pygpu_buffer_to_list(), and self.
Referenced by pygpu_buffer__tp_repr().
PyTypeObject BPyGPU_BufferType |
Definition at line 663 of file gpu_py_buffer.c.
Referenced by bpygpu_types_init(), pygpu_buffer_make_from_data(), pygpu_framebuffer_read_color(), pygpu_framebuffer_read_depth(), and pygpu_texture__tp_new().
|
static |
Definition at line 644 of file gpu_py_buffer.c.
|
static |
Definition at line 588 of file gpu_py_buffer.c.
|
static |
Definition at line 575 of file gpu_py_buffer.c.
|
static |
Definition at line 558 of file gpu_py_buffer.c.
|
static |
Definition at line 566 of file gpu_py_buffer.c.