main: Fix block index when mixing UBO and SSBO blocks
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 29 Sep 2015 11:34:20 +0000 (13:34 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 1 Oct 2015 07:25:30 +0000 (09:25 +0200)
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@intel.com>
src/mesa/main/shader_query.cpp

index 73dee85cc4dfb2d3475ff0fd3d44573fc0af8892..718967605b586ed5b0d6f5b56cfb60d4bc0228b8 100644 (file)
@@ -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);