[Bf-blender-cvs] [5744e7d2478] blender-v3.2-release: Fix GPUIndexBuf not working in python

Germano Cavalcante noreply at git.blender.org
Tue May 24 03:37:50 CEST 2022


Commit: 5744e7d24783077e7acfcd8d56d78af51c33a2ff
Author: Germano Cavalcante
Date:   Mon May 23 22:37:30 2022 -0300
Branches: blender-v3.2-release
https://developer.blender.org/rB5744e7d24783077e7acfcd8d56d78af51c33a2ff

Fix GPUIndexBuf not working in python

Since rBb47c5505aa37, Batchs containing GPUIndexBuf initialized via
a PyObject with buffer protocol no longer work.

This was because of an unsafe optimization in the GPUIndexBuf module
for Python.

So remove this micro-optimization.

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

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

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

diff --git a/source/blender/python/gpu/gpu_py_element.c b/source/blender/python/gpu/gpu_py_element.c
index 04975fcef96..616e7da6e9f 100644
--- a/source/blender/python/gpu/gpu_py_element.c
+++ b/source/blender/python/gpu/gpu_py_element.c
@@ -91,15 +91,11 @@ static PyObject *pygpu_IndexBuf__tp_new(PyTypeObject *UNUSED(type), PyObject *ar
     /* Use `INT_MAX` instead of the actual number of vertices. */
     GPU_indexbuf_init(&builder, prim_type.value_found, index_len, INT_MAX);
 
-#if 0
     uint *buf = pybuffer.buf;
     for (uint i = index_len; i--; buf++) {
       GPU_indexbuf_add_generic_vert(&builder, *buf);
     }
-#else
-    memcpy(builder.data, pybuffer.buf, index_len * sizeof(*builder.data));
-    builder.index_len = index_len;
-#endif
+
     PyBuffer_Release(&pybuffer);
   }
   else {



More information about the Bf-blender-cvs mailing list