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:
authorCampbell Barton <ideasman42@gmail.com>2018-10-31 04:11:38 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-31 04:11:38 +0300
commit205eac3038fb0422558bd18dc53c03d2c80b9733 (patch)
treebef8df4e061dc3e9e7fe4be38152866c7f7d6d10 /source/blender
parent1a865b4ff01c96fa365a1902c61b5d315bcffe11 (diff)
PyAPI: add check for exceeding batch VBO limit
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/python/gpu/gpu_py_batch.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/python/gpu/gpu_py_batch.c b/source/blender/python/gpu/gpu_py_batch.c
index 75db213a4e3..051e650de84 100644
--- a/source/blender/python/gpu/gpu_py_batch.c
+++ b/source/blender/python/gpu/gpu_py_batch.c
@@ -149,6 +149,13 @@ static PyObject *bpygpu_VertBatch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *
return NULL;
}
+ if (self->batch->verts[GPU_BATCH_VBO_MAX_LEN - 1] != NULL) {
+ PyErr_SetString(
+ PyExc_RuntimeError,
+ "Maximum number of vertex buffers exceeded: " STRINGIFY(GPU_BATCH_VBO_MAX_LEN));
+ return NULL;
+ }
+
#ifdef USE_GPU_PY_REFERENCES
/* Hold user */
PyList_Append(self->references, (PyObject *)py_buf);
@@ -171,7 +178,8 @@ static PyObject *bpygpu_VertBatch_program_set(BPyGPUBatch *self, BPyGPUShader *p
}
GPUShader *shader = py_shader->shader;
- GPU_batch_program_set(self->batch,
+ GPU_batch_program_set(
+ self->batch,
GPU_shader_get_program(shader),
GPU_shader_get_interface(shader));