Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/gpu/gpu_py_batch.c
| Show All 39 Lines | |||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "GPU_batch.h" | #include "GPU_batch.h" | ||||
| #include "../mathutils/mathutils.h" | #include "../mathutils/mathutils.h" | ||||
| #include "../generic/py_capi_utils.h" | #include "../generic/py_capi_utils.h" | ||||
| #include "gpu_py_shader.h" | |||||
| #include "gpu_py_vertex_buffer.h" | #include "gpu_py_vertex_buffer.h" | ||||
| #include "gpu_py_batch.h" /* own include */ | #include "gpu_py_batch.h" /* own include */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name VertBatch Type | /** \name VertBatch Type | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | #ifdef USE_GPU_PY_REFERENCES | ||||
| /* Hold user */ | /* Hold user */ | ||||
| PyList_Append(self->references, (PyObject *)py_buf); | PyList_Append(self->references, (PyObject *)py_buf); | ||||
| #endif | #endif | ||||
| GPU_batch_vertbuf_add(self->batch, py_buf->buf); | GPU_batch_vertbuf_add(self->batch, py_buf->buf); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| PyDoc_STRVAR(bpygpu_VertBatch_program_set_doc, | |||||
| "TODO" | |||||
| ); | |||||
| static PyObject *bpygpu_VertBatch_program_set(BPyGPUBatch *self, BPyGPUShader *py_shader) | |||||
| { | |||||
| if (!BPyGPUShader_Check(py_shader)) { | |||||
| PyErr_Format(PyExc_TypeError, | |||||
| "Expected a GPUShader, got %s", | |||||
| Py_TYPE(py_shader)->tp_name); | |||||
| return NULL; | |||||
| } | |||||
| GPUShader *shader = py_shader->shader; | |||||
| GPU_batch_program_set(self->batch, | |||||
| GPU_shader_get_program(shader), | |||||
| GPU_shader_get_interface(shader)); | |||||
| Py_RETURN_NONE; | |||||
| } | |||||
| PyDoc_STRVAR(bpygpu_VertBatch_program_set_builtin_doc, | PyDoc_STRVAR(bpygpu_VertBatch_program_set_builtin_doc, | ||||
| "TODO" | "TODO" | ||||
| ); | ); | ||||
| static PyObject *bpygpu_VertBatch_program_set_builtin(BPyGPUBatch *self, PyObject *args, PyObject *kwds) | static PyObject *bpygpu_VertBatch_program_set_builtin(BPyGPUBatch *self, PyObject *args, PyObject *kwds) | ||||
| { | { | ||||
| static const char *kwlist[] = {"id", NULL}; | static const char *kwlist[] = {"id", NULL}; | ||||
| struct { | struct { | ||||
| ▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | static PyObject *bpygpu_VertBatch_program_use_end(BPyGPUBatch *self) | ||||
| } | } | ||||
| GPU_batch_program_use_end(self->batch); | GPU_batch_program_use_end(self->batch); | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| static struct PyMethodDef bpygpu_VertBatch_methods[] = { | static struct PyMethodDef bpygpu_VertBatch_methods[] = { | ||||
| {"vertbuf_add", (PyCFunction)bpygpu_VertBatch_vertbuf_add, | {"vertbuf_add", (PyCFunction)bpygpu_VertBatch_vertbuf_add, | ||||
| METH_O, bpygpu_VertBatch_vertbuf_add_doc}, | METH_O, bpygpu_VertBatch_vertbuf_add_doc}, | ||||
| {"program_set", (PyCFunction)bpygpu_VertBatch_program_set, | |||||
| METH_O, bpygpu_VertBatch_program_set_doc}, | |||||
| {"program_set_builtin", (PyCFunction)bpygpu_VertBatch_program_set_builtin, | {"program_set_builtin", (PyCFunction)bpygpu_VertBatch_program_set_builtin, | ||||
| METH_VARARGS | METH_KEYWORDS, bpygpu_VertBatch_program_set_builtin_doc}, | METH_VARARGS | METH_KEYWORDS, bpygpu_VertBatch_program_set_builtin_doc}, | ||||
| {"uniform_bool", (PyCFunction)bpygpu_VertBatch_uniform_bool, | {"uniform_bool", (PyCFunction)bpygpu_VertBatch_uniform_bool, | ||||
| METH_VARARGS, NULL}, | METH_VARARGS, NULL}, | ||||
| {"uniform_i32", (PyCFunction)bpygpu_VertBatch_uniform_i32, | {"uniform_i32", (PyCFunction)bpygpu_VertBatch_uniform_i32, | ||||
| METH_VARARGS, NULL}, | METH_VARARGS, NULL}, | ||||
| {"uniform_f32", (PyCFunction)bpygpu_VertBatch_uniform_f32, | {"uniform_f32", (PyCFunction)bpygpu_VertBatch_uniform_f32, | ||||
| METH_VARARGS, NULL}, | METH_VARARGS, NULL}, | ||||
| ▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines | |||||