[Bf-blender-cvs] [f9e3d7d7eb8] tmp-batch-cache-cleanup: GPU: Batch: Reverse order of VBO binding

Clément Foucault noreply at git.blender.org
Mon Jul 22 12:52:46 CEST 2019


Commit: f9e3d7d7eb897da5cc9ea0503707eb35c9a57b68
Author: Clément Foucault
Date:   Thu Jul 18 17:02:05 2019 +0200
Branches: tmp-batch-cache-cleanup
https://developer.blender.org/rBf9e3d7d7eb897da5cc9ea0503707eb35c9a57b68

GPU: Batch: Reverse order of VBO binding

This is to ensure the vbo[0] always has predecence over other VBO.

This is important for overriding attributes by switching vbo binding order.

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

M	source/blender/gpu/intern/gpu_batch.c

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

diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c
index 196a8a0f3b9..f972718afa7 100644
--- a/source/blender/gpu/intern/gpu_batch.c
+++ b/source/blender/gpu/intern/gpu_batch.c
@@ -447,8 +447,11 @@ static void create_bindings(GPUVertBuf *verts,
 
 static void batch_update_program_bindings(GPUBatch *batch, uint v_first)
 {
-  for (int v = 0; v < GPU_BATCH_VBO_MAX_LEN && batch->verts[v] != NULL; ++v) {
-    create_bindings(batch->verts[v], batch->interface, (batch->inst) ? 0 : v_first, false);
+  /* Reverse order so first vbos have more prevalence (in term of attrib override). */
+  for (int v = GPU_BATCH_VBO_MAX_LEN - 1; v > -1; --v) {
+    if (batch->verts[v] != NULL) {
+      create_bindings(batch->verts[v], batch->interface, (batch->inst) ? 0 : v_first, false);
+    }
   }
   if (batch->inst) {
     create_bindings(batch->inst, batch->interface, v_first, true);



More information about the Bf-blender-cvs mailing list