Blender V4.3
gpu_py_vertex_buffer.cc File Reference

Go to the source code of this file.

Macros

#define PY_AS_NATIVE(ty_dst, py_as_native)
 
#define PY_AS_NATIVE(ty_dst, py_as_native)
 

Functions

Public API
PyObject * BPyGPUVertBuf_CreatePyObject (blender::gpu::VertBuf *buf)
 

Utility Functions

#define PYGPU_AS_NATIVE_SWITCH(attr)
 
static void pygpu_fill_format_elem (void *data_dst_void, PyObject *py_src, const GPUVertAttr *attr)
 
static void pygpu_fill_format_sequence (void *data_dst_void, PyObject *py_seq_fast, const GPUVertAttr *attr)
 
static bool pygpu_vertbuf_fill_impl (blender::gpu::VertBuf *vbo, uint data_id, PyObject *seq, const char *error_prefix)
 
static int pygpu_vertbuf_fill (blender::gpu::VertBuf *buf, int id, PyObject *py_seq_data, const char *error_prefix)
 

VertBuf Type

static PyMethodDef pygpu_vertbuf__tp_methods []
 
PyTypeObject BPyGPUVertBuf_Type
 
static PyObject * pygpu_vertbuf__tp_new (PyTypeObject *, PyObject *args, PyObject *kwds)
 
 PyDoc_STRVAR (pygpu_vertbuf_attr_fill_doc, ".. method:: attr_fill(id, data)\n" "\n" " Insert data into the buffer for a single attribute.\n" "\n" " :arg id: Either the name or the id of the attribute.\n" " :type id: int | str\n" " :arg data: Buffer or sequence of data that should be stored in the buffer\n" " :type data: Buffer | " "Sequence[float] | Sequence[int] | Sequence[Sequence[float]] | Sequence[Sequence[int]]\n")
 
static PyObject * pygpu_vertbuf_attr_fill (BPyGPUVertBuf *self, PyObject *args, PyObject *kwds)
 
static void pygpu_vertbuf__tp_dealloc (BPyGPUVertBuf *self)
 
 PyDoc_STRVAR (pygpu_vertbuf__tp_doc, ".. class:: GPUVertBuf(format, len)\n" "\n" " Contains a VBO.\n" "\n" " :arg format: Vertex format.\n" " :type format: :class:`gpu.types.GPUVertFormat`\n" " :arg len: Amount of vertices that will fit into this buffer.\n" " :type len: int\n")
 

Detailed Description

  • Use bpygpu_ for local API.
  • Use BPyGPU for public API.

Definition in file gpu_py_vertex_buffer.cc.

Macro Definition Documentation

◆ PY_AS_NATIVE [1/2]

#define PY_AS_NATIVE ( ty_dst,
py_as_native )
Value:
{ \
ty_dst *data_dst = static_cast<ty_dst *>(data_dst_void); \
*data_dst = py_as_native(py_src); \
} \
((void)0)

◆ PY_AS_NATIVE [2/2]

#define PY_AS_NATIVE ( ty_dst,
py_as_native )
Value:
ty_dst *data_dst = static_cast<ty_dst *>(data_dst_void); \
for (uint i = 0; i < len; i++) { \
data_dst[i] = py_as_native(value_fast_items[i]); \
} \
((void)0)
unsigned int uint
int len

◆ PYGPU_AS_NATIVE_SWITCH

#define PYGPU_AS_NATIVE_SWITCH ( attr)

Definition at line 30 of file gpu_py_vertex_buffer.cc.

Referenced by pygpu_fill_format_elem(), and pygpu_fill_format_sequence().

Function Documentation

◆ BPyGPUVertBuf_CreatePyObject()

PyObject * BPyGPUVertBuf_CreatePyObject ( blender::gpu::VertBuf * buf)

Definition at line 413 of file gpu_py_vertex_buffer.cc.

References BPyGPUVertBuf_Type, and self.

Referenced by pygpu_vertbuf__tp_new().

◆ PyDoc_STRVAR() [1/2]

PyDoc_STRVAR ( pygpu_vertbuf__tp_doc ,
".. class:: GPUVertBuf(format, len)\n" "\n" " Contains a VBO.\n" "\n" " :arg format: Vertex format.\n" " :type format: :class:`gpu.types.GPUVertFormat`\n" " :arg len: Amount of vertices that will fit into this buffer.\n" " :type len: int\n"  )

◆ PyDoc_STRVAR() [2/2]

PyDoc_STRVAR ( pygpu_vertbuf_attr_fill_doc ,
".. method:: attr_fill(id, data)\n" "\n" " Insert data into the buffer for a single attribute.\n" "\n" " :arg id: Either the name or the id of the attribute.\n" " :type id: int | str\n" " :arg data: Buffer or sequence of data that should be stored in the buffer\n" " :type data: Buffer | " "Sequence | Sequence | Sequence] | Sequence]\n" [float][int][Sequence[float][Sequence[int] )

◆ pygpu_fill_format_elem()

static void pygpu_fill_format_elem ( void * data_dst_void,
PyObject * py_src,
const GPUVertAttr * attr )
static

Definition at line 67 of file gpu_py_vertex_buffer.cc.

References PYGPU_AS_NATIVE_SWITCH.

Referenced by pygpu_vertbuf_fill_impl().

◆ pygpu_fill_format_sequence()

static void pygpu_fill_format_sequence ( void * data_dst_void,
PyObject * py_seq_fast,
const GPUVertAttr * attr )
static

Args are constants, so range checks will be optimized out if they're no-op's.

Definition at line 82 of file gpu_py_vertex_buffer.cc.

References GPUVertAttr::comp_len, len, and PYGPU_AS_NATIVE_SWITCH.

Referenced by pygpu_vertbuf_fill_impl().

◆ pygpu_vertbuf__tp_dealloc()

static void pygpu_vertbuf__tp_dealloc ( BPyGPUVertBuf * self)
static

Definition at line 338 of file gpu_py_vertex_buffer.cc.

References GPU_vertbuf_discard(), and self.

◆ pygpu_vertbuf__tp_new()

static PyObject * pygpu_vertbuf__tp_new ( PyTypeObject * ,
PyObject * args,
PyObject * kwds )
static

◆ pygpu_vertbuf_attr_fill()

static PyObject * pygpu_vertbuf_attr_fill ( BPyGPUVertBuf * self,
PyObject * args,
PyObject * kwds )
static

◆ pygpu_vertbuf_fill()

static int pygpu_vertbuf_fill ( blender::gpu::VertBuf * buf,
int id,
PyObject * py_seq_data,
const char * error_prefix )
static

◆ pygpu_vertbuf_fill_impl()

Variable Documentation

◆ BPyGPUVertBuf_Type

PyTypeObject BPyGPUVertBuf_Type

◆ pygpu_vertbuf__tp_methods

PyMethodDef pygpu_vertbuf__tp_methods[]
static
Initial value:
= {
{"attr_fill",
METH_VARARGS | METH_KEYWORDS,
pygpu_vertbuf_attr_fill_doc},
{nullptr, nullptr, 0, nullptr},
}
static PyObject * pygpu_vertbuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, PyObject *kwds)

Definition at line 326 of file gpu_py_vertex_buffer.cc.