[Bf-blender-cvs] [205eac3038f] blender2.8: PyAPI: add check for exceeding batch VBO limit

Campbell Barton noreply at git.blender.org
Wed Oct 31 02:35:26 CET 2018


Commit: 205eac3038fb0422558bd18dc53c03d2c80b9733
Author: Campbell Barton
Date:   Wed Oct 31 12:11:38 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB205eac3038fb0422558bd18dc53c03d2c80b9733

PyAPI: add check for exceeding batch VBO limit

===================================================================

M	source/blender/python/gpu/gpu_py_batch.c

===================================================================

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));



More information about the Bf-blender-cvs mailing list