diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-31 04:11:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-31 04:11:38 +0300 |
commit | 205eac3038fb0422558bd18dc53c03d2c80b9733 (patch) | |
tree | bef8df4e061dc3e9e7fe4be38152866c7f7d6d10 /source | |
parent | 1a865b4ff01c96fa365a1902c61b5d315bcffe11 (diff) |
PyAPI: add check for exceeding batch VBO limit
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/gpu/gpu_py_batch.c | 10 |
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)); |