diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-02-17 16:16:41 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-02-17 16:38:59 +0300 |
commit | b7e1660d405d9d73f1aff54358a6d2d1461a75d0 (patch) | |
tree | daa73f48a05438d953ea4eb5873db52405244d4e /source/blender/python/gpu/gpu_py_vertex_buffer.c | |
parent | 1ea6394fc8446cb54ec011d0e210135b8b5a4d33 (diff) |
Cleanup: Use 'pygpu_' prefix in the cpython GPU module
`py_` prefix can be confused with the Python's own API's.
Diffstat (limited to 'source/blender/python/gpu/gpu_py_vertex_buffer.c')
-rw-r--r-- | source/blender/python/gpu/gpu_py_vertex_buffer.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.c b/source/blender/python/gpu/gpu_py_vertex_buffer.c index 8e19eac76d0..160931393ed 100644 --- a/source/blender/python/gpu/gpu_py_vertex_buffer.c +++ b/source/blender/python/gpu/gpu_py_vertex_buffer.c @@ -39,7 +39,7 @@ /** \name Utility Functions * \{ */ -#define PY_AS_NATIVE_SWITCH(attr) \ +#define PYGPU_AS_NATIVE_SWITCH(attr) \ switch (attr->comp_type) { \ case GPU_COMP_I8: { \ PY_AS_NATIVE(int8_t, PyC_Long_AsI8); \ @@ -75,7 +75,7 @@ ((void)0) /* No error checking, callers must run PyErr_Occurred */ -static void fill_format_elem(void *data_dst_void, PyObject *py_src, const GPUVertAttr *attr) +static void pygpu_fill_format_elem(void *data_dst_void, PyObject *py_src, const GPUVertAttr *attr) { #define PY_AS_NATIVE(ty_dst, py_as_native) \ { \ @@ -84,13 +84,13 @@ static void fill_format_elem(void *data_dst_void, PyObject *py_src, const GPUVer } \ ((void)0) - PY_AS_NATIVE_SWITCH(attr); + PYGPU_AS_NATIVE_SWITCH(attr); #undef PY_AS_NATIVE } /* No error checking, callers must run PyErr_Occurred */ -static void fill_format_sequence(void *data_dst_void, +static void pygpu_fill_format_sequence(void *data_dst_void, PyObject *py_seq_fast, const GPUVertAttr *attr) { @@ -107,19 +107,19 @@ static void fill_format_sequence(void *data_dst_void, } \ ((void)0) - PY_AS_NATIVE_SWITCH(attr); + PYGPU_AS_NATIVE_SWITCH(attr); #undef PY_AS_NATIVE } -#undef PY_AS_NATIVE_SWITCH +#undef PYGPU_AS_NATIVE_SWITCH #undef WARN_TYPE_LIMIT_PUSH #undef WARN_TYPE_LIMIT_POP -static bool py_vertbuf_fill_impl(GPUVertBuf *vbo, - uint data_id, - PyObject *seq, - const char *error_prefix) +static bool pygpu_vertbuf_fill_impl(GPUVertBuf *vbo, + uint data_id, + PyObject *seq, + const char *error_prefix) { const char *exc_str_size_mismatch = "Expected a %s of size %d, got %u"; @@ -173,7 +173,7 @@ static bool py_vertbuf_fill_impl(GPUVertBuf *vbo, for (uint i = 0; i < seq_len; i++) { uchar *data = (uchar *)GPU_vertbuf_raw_step(&data_step); PyObject *item = seq_items[i]; - fill_format_elem(data, item, attr); + pygpu_fill_format_elem(data, item, attr); } } else { @@ -197,7 +197,7 @@ static bool py_vertbuf_fill_impl(GPUVertBuf *vbo, } /* May trigger error, check below */ - fill_format_sequence(data, seq_fast_item, attr); + pygpu_fill_format_sequence(data, seq_fast_item, attr); Py_DECREF(seq_fast_item); } } @@ -213,7 +213,7 @@ static bool py_vertbuf_fill_impl(GPUVertBuf *vbo, return ok; } -static int py_attr_fill(GPUVertBuf *buf, int id, PyObject *py_seq_data, const char *error_prefix) +static int pygpu_vertbuf_fill(GPUVertBuf *buf, int id, PyObject *py_seq_data, const char *error_prefix) { if (id < 0 || id >= GPU_vertbuf_get_format(buf)->attr_len) { PyErr_Format(PyExc_ValueError, "Format id %d out of range", id); @@ -225,7 +225,7 @@ static int py_attr_fill(GPUVertBuf *buf, int id, PyObject *py_seq_data, const ch return 0; } - if (!py_vertbuf_fill_impl(buf, (uint)id, py_seq_data, error_prefix)) { + if (!pygpu_vertbuf_fill_impl(buf, (uint)id, py_seq_data, error_prefix)) { return 0; } @@ -238,7 +238,7 @@ static int py_attr_fill(GPUVertBuf *buf, int id, PyObject *py_seq_data, const ch /** \name VertBuf Type * \{ */ -static PyObject *py_VertBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) +static PyObject *pygpu_vertbuf__tp_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { struct { PyObject *py_fmt; @@ -260,7 +260,7 @@ static PyObject *py_VertBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyOb return BPyGPUVertBuf_CreatePyObject(vbo); } -PyDoc_STRVAR(py_VertBuf_attr_fill_doc, +PyDoc_STRVAR(pygpu_vertbuf_attr_fill_doc, ".. method:: attr_fill(id, data)\n" "\n" " Insert data into the buffer for a single attribute.\n" @@ -269,7 +269,7 @@ PyDoc_STRVAR(py_VertBuf_attr_fill_doc, " :type id: int or str\n" " :param data: Sequence of data that should be stored in the buffer\n" " :type data: sequence of values or tuples\n"); -static PyObject *py_VertBuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, PyObject *kwds) +static PyObject *pygpu_vertbuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, PyObject *kwds) { PyObject *data; PyObject *identifier; @@ -299,28 +299,28 @@ static PyObject *py_VertBuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, PyObj return NULL; } - if (!py_attr_fill(self->buf, id, data, "GPUVertBuf.attr_fill")) { + if (!pygpu_vertbuf_fill(self->buf, id, data, "GPUVertBuf.attr_fill")) { return NULL; } Py_RETURN_NONE; } -static struct PyMethodDef py_VertBuf_methods[] = { +static struct PyMethodDef pygpu_vertbuf__tp_methods[] = { {"attr_fill", - (PyCFunction)py_VertBuf_attr_fill, + (PyCFunction)pygpu_vertbuf_attr_fill, METH_VARARGS | METH_KEYWORDS, - py_VertBuf_attr_fill_doc}, + pygpu_vertbuf_attr_fill_doc}, {NULL, NULL, 0, NULL}, }; -static void py_VertBuf_dealloc(BPyGPUVertBuf *self) +static void pygpu_vertbuf__tp_dealloc(BPyGPUVertBuf *self) { GPU_vertbuf_discard(self->buf); Py_TYPE(self)->tp_free(self); } -PyDoc_STRVAR(py_gpu_vertex_buffer_doc, +PyDoc_STRVAR(pygpu_vertbuf__tp_doc, ".. class:: GPUVertBuf(len, format)\n" "\n" " Contains a VBO.\n" @@ -332,11 +332,11 @@ PyDoc_STRVAR(py_gpu_vertex_buffer_doc, PyTypeObject BPyGPUVertBuf_Type = { PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUVertBuf", .tp_basicsize = sizeof(BPyGPUVertBuf), - .tp_dealloc = (destructor)py_VertBuf_dealloc, + .tp_dealloc = (destructor)pygpu_vertbuf__tp_dealloc, .tp_flags = Py_TPFLAGS_DEFAULT, - .tp_doc = py_gpu_vertex_buffer_doc, - .tp_methods = py_VertBuf_methods, - .tp_new = py_VertBuf_new, + .tp_doc = pygpu_vertbuf__tp_doc, + .tp_methods = pygpu_vertbuf__tp_methods, + .tp_new = pygpu_vertbuf__tp_new, }; /** \} */ |