Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2018-09-14 15:32:19 +0300
committermano-wii <germano.costa@ig.com.br>2018-09-14 15:46:19 +0300
commit1287965089a851c46e9a1a23c55ebc90b00b4e14 (patch)
tree430505da2894fda1e95ccb82b6bc4845ee7d5c4c /source/blender/python/gpu/gpu_py_batch.c
parentd15928c2344718e47d9025fe5b18ff033366dc5c (diff)
GPU module: Initial implementation of the `gpu.shader` submodule.
Differential Revision: https://developer.blender.org/D3688
Diffstat (limited to 'source/blender/python/gpu/gpu_py_batch.c')
-rw-r--r--source/blender/python/gpu/gpu_py_batch.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/python/gpu/gpu_py_batch.c b/source/blender/python/gpu/gpu_py_batch.c
index ccbb0b3ecd2..4e6df73a2d9 100644
--- a/source/blender/python/gpu/gpu_py_batch.c
+++ b/source/blender/python/gpu/gpu_py_batch.c
@@ -45,6 +45,7 @@
#include "../generic/py_capi_utils.h"
+#include "gpu_py_shader.h"
#include "gpu_py_vertex_buffer.h"
#include "gpu_py_batch.h" /* own include */
@@ -152,6 +153,26 @@ static PyObject *bpygpu_VertBatch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *
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,
"TODO"
);
@@ -297,6 +318,8 @@ static PyObject *bpygpu_VertBatch_program_use_end(BPyGPUBatch *self)
static struct PyMethodDef bpygpu_VertBatch_methods[] = {
{"vertbuf_add", (PyCFunction)bpygpu_VertBatch_vertbuf_add,
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,
METH_VARARGS | METH_KEYWORDS, bpygpu_VertBatch_program_set_builtin_doc},
{"uniform_bool", (PyCFunction)bpygpu_VertBatch_uniform_bool,