Cleanup: Python GPU: change prefix 'bpygpu_' to 'py_' in static functions

This commit is contained in:
2020-12-11 16:05:58 -03:00
parent cada56b1f7
commit bbd7f94d8a
8 changed files with 283 additions and 311 deletions

View File

@@ -116,10 +116,10 @@ static void fill_format_sequence(void *data_dst_void,
#undef WARN_TYPE_LIMIT_PUSH
#undef WARN_TYPE_LIMIT_POP
static bool bpygpu_vertbuf_fill_impl(GPUVertBuf *vbo,
uint data_id,
PyObject *seq,
const char *error_prefix)
static bool py_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";
@@ -213,10 +213,7 @@ static bool bpygpu_vertbuf_fill_impl(GPUVertBuf *vbo,
return ok;
}
static int bpygpu_attr_fill(GPUVertBuf *buf,
int id,
PyObject *py_seq_data,
const char *error_prefix)
static int py_attr_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);
@@ -228,7 +225,7 @@ static int bpygpu_attr_fill(GPUVertBuf *buf,
return 0;
}
if (!bpygpu_vertbuf_fill_impl(buf, (uint)id, py_seq_data, error_prefix)) {
if (!py_vertbuf_fill_impl(buf, (uint)id, py_seq_data, error_prefix)) {
return 0;
}
@@ -241,7 +238,7 @@ static int bpygpu_attr_fill(GPUVertBuf *buf,
/** \name VertBuf Type
* \{ */
static PyObject *bpygpu_VertBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
static PyObject *py_VertBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
{
struct {
PyObject *py_fmt;
@@ -263,7 +260,7 @@ static PyObject *bpygpu_VertBuf_new(PyTypeObject *UNUSED(type), PyObject *args,
return BPyGPUVertBuf_CreatePyObject(vbo);
}
PyDoc_STRVAR(bpygpu_VertBuf_attr_fill_doc,
PyDoc_STRVAR(py_VertBuf_attr_fill_doc,
".. method:: attr_fill(id, data)\n"
"\n"
" Insert data into the buffer for a single attribute.\n"
@@ -272,7 +269,7 @@ PyDoc_STRVAR(bpygpu_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 *bpygpu_VertBuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, PyObject *kwds)
static PyObject *py_VertBuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, PyObject *kwds)
{
PyObject *data;
PyObject *identifier;
@@ -302,22 +299,22 @@ static PyObject *bpygpu_VertBuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, P
return NULL;
}
if (!bpygpu_attr_fill(self->buf, id, data, "GPUVertBuf.attr_fill")) {
if (!py_attr_fill(self->buf, id, data, "GPUVertBuf.attr_fill")) {
return NULL;
}
Py_RETURN_NONE;
}
static struct PyMethodDef bpygpu_VertBuf_methods[] = {
static struct PyMethodDef py_VertBuf_methods[] = {
{"attr_fill",
(PyCFunction)bpygpu_VertBuf_attr_fill,
(PyCFunction)py_VertBuf_attr_fill,
METH_VARARGS | METH_KEYWORDS,
bpygpu_VertBuf_attr_fill_doc},
py_VertBuf_attr_fill_doc},
{NULL, NULL, 0, NULL},
};
static void bpygpu_VertBuf_dealloc(BPyGPUVertBuf *self)
static void py_VertBuf_dealloc(BPyGPUVertBuf *self)
{
GPU_vertbuf_discard(self->buf);
Py_TYPE(self)->tp_free(self);
@@ -335,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)bpygpu_VertBuf_dealloc,
.tp_dealloc = (destructor)py_VertBuf_dealloc,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = py_gpu_vertex_buffer_doc,
.tp_methods = bpygpu_VertBuf_methods,
.tp_new = bpygpu_VertBuf_new,
.tp_methods = py_VertBuf_methods,
.tp_new = py_VertBuf_new,
};
/** \} */