Mesa (master): main: Fix block index when mixing UBO and SSBO blocks

Iago Toral Quiroga itoral at kemper.freedesktop.org
Thu Oct 1 07:26:25 UTC 2015


Module: Mesa
Branch: master
Commit: 74553240301c60e3520fb55e09391993dac28f5d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=74553240301c60e3520fb55e09391993dac28f5d

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Tue Sep 29 13:34:20 2015 +0200

main: Fix block index when mixing UBO and SSBO blocks

Since we store both in UniformBlocks, we can't just compute the index by
subtracting the array address start, we need to count the number of
buffers of the approriate type.

v2:
  - Just fall back to calc_resource_index (Tapani)

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

---

 src/mesa/main/shader_query.cpp |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 73dee85..7189676 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -611,11 +611,10 @@ _mesa_program_resource_index(struct gl_shader_program *shProg,
       return GL_INVALID_INDEX;
 
    switch (res->Type) {
-   case GL_UNIFORM_BLOCK:
-   case GL_SHADER_STORAGE_BLOCK:
-      return RESOURCE_UBO(res)- shProg->UniformBlocks;
    case GL_ATOMIC_COUNTER_BUFFER:
       return RESOURCE_ATC(res) - shProg->AtomicBuffers;
+   case GL_UNIFORM_BLOCK:
+   case GL_SHADER_STORAGE_BLOCK:
    case GL_TRANSFORM_FEEDBACK_VARYING:
    default:
       return calc_resource_index(shProg, res);




More information about the mesa-commit mailing list