Blender  V3.3
Macros
gpu_py_vertex_buffer.c File Reference
#include <Python.h>
#include "GPU_vertex_buffer.h"
#include "BLI_math.h"
#include "MEM_guardedalloc.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
#include "gpu_py_vertex_buffer.h"
#include "gpu_py_vertex_format.h"

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 (GPUVertBuf *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 (GPUVertBuf *vbo, uint data_id, PyObject *seq, const char *error_prefix)
 
static int pygpu_vertbuf_fill (GPUVertBuf *buf, int id, PyObject *py_seq_data, const char *error_prefix)
 

VertBuf Type

static struct PyMethodDef pygpu_vertbuf__tp_methods []
 
PyTypeObject BPyGPUVertBuf_Type
 
static PyObject * pygpu_vertbuf__tp_new (PyTypeObject *UNUSED(type), 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" " :param id: Either the name or the id of the attribute.\n" " :type id: int or str\n" " :param data: Sequence of data that should be stored in the buffer\n" " :type data: sequence of floats, ints, vectors or matrices\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" " :param format: Vertex format.\n" " :type buf: :class:`gpu.types.GPUVertFormat`\n" " :param len: Amount of vertices that will fit into this buffer.\n" " :type type: `int`\n")
 

Detailed Description

Definition in file gpu_py_vertex_buffer.c.

Macro Definition Documentation

◆ PY_AS_NATIVE [1/2]

#define PY_AS_NATIVE (   ty_dst,
  py_as_native 
)
Value:
{ \
ty_dst *data_dst = data_dst_void; \
*data_dst = py_as_native(py_src); \
} \
((void)0)
SyclQueue void void size_t num_bytes void

◆ PY_AS_NATIVE [2/2]

#define PY_AS_NATIVE (   ty_dst,
  py_as_native 
)
Value:
ty_dst *data_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
Definition: BLI_sys_types.h:67
int len
Definition: draw_manager.c:108

◆ PYGPU_AS_NATIVE_SWITCH

#define PYGPU_AS_NATIVE_SWITCH (   attr)

Definition at line 28 of file gpu_py_vertex_buffer.c.

Function Documentation

◆ BPyGPUVertBuf_CreatePyObject()

PyObject* BPyGPUVertBuf_CreatePyObject ( GPUVertBuf buf)

Definition at line 350 of file gpu_py_vertex_buffer.c.

References BPyGPUVertBuf_Type.

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" " :param format: Vertex format.\n" " :type buf: :class:`gpu.types.GPUVertFormat`\n" " :param len: Amount of vertices that will fit into this buffer.\n" " :type type: `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" " :param id: Either the name or the id of the attribute.\n" " :type id: int or str\n" " :param data: Sequence of data that should be stored in the buffer\n" " :type data: sequence of  floats,
ints  ,
vectors or matrices\n"   
)

◆ pygpu_fill_format_elem()

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

Definition at line 65 of file gpu_py_vertex_buffer.c.

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 80 of file gpu_py_vertex_buffer.c.

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 319 of file gpu_py_vertex_buffer.c.

References GPU_vertbuf_discard(), and self.

◆ pygpu_vertbuf__tp_new()

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

◆ pygpu_vertbuf_attr_fill()

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

Definition at line 268 of file gpu_py_vertex_buffer.c.

◆ pygpu_vertbuf_fill()

static int pygpu_vertbuf_fill ( GPUVertBuf buf,
int  id,
PyObject *  py_seq_data,
const char *  error_prefix 
)
static

◆ pygpu_vertbuf_fill_impl()

static bool pygpu_vertbuf_fill_impl ( GPUVertBuf vbo,
uint  data_id,
PyObject *  seq,
const char *  error_prefix 
)
static

Variable Documentation

◆ BPyGPUVertBuf_Type

PyTypeObject BPyGPUVertBuf_Type
Initial value:
= {
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUVertBuf",
.tp_basicsize = sizeof(BPyGPUVertBuf),
.tp_dealloc = (destructor)pygpu_vertbuf__tp_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = pygpu_vertbuf__tp_doc,
}
static PyObject * pygpu_vertbuf__tp_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
static struct PyMethodDef pygpu_vertbuf__tp_methods[]
static void pygpu_vertbuf__tp_dealloc(BPyGPUVertBuf *self)
struct BPyGPUVertBuf BPyGPUVertBuf

Definition at line 334 of file gpu_py_vertex_buffer.c.

Referenced by bpygpu_types_init(), BPyGPUVertBuf_CreatePyObject(), and pygpu_batch__tp_new().

◆ pygpu_vertbuf__tp_methods

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

Definition at line 268 of file gpu_py_vertex_buffer.c.