glsl: Identify active uniform blocks that are buffer blocks as such.
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 23 Mar 2015 10:19:12 +0000 (11:19 +0100)
committerSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Tue, 14 Jul 2015 05:04:03 +0000 (07:04 +0200)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/glsl/link_uniform_block_active_visitor.cpp
src/glsl/link_uniform_block_active_visitor.h
src/glsl/link_uniform_blocks.cpp
src/mesa/main/mtypes.h

index ddfd2b23748db4e3850af36e6de901a9fa9dfb56..510294783a0009d35371646d4a6e62db90ca7528 100644 (file)
@@ -44,6 +44,7 @@ process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var)
 
       b->type = block_type;
       b->has_instance_name = var->is_interface_instance();
+      b->is_shader_storage = var->data.mode == ir_var_shader_storage;
 
       if (var->data.explicit_binding) {
          b->has_binding = true;
index e5ea501553ce76c3e334d2da9623ac920b2384e8..b663a884db49299f74fdb3a0ce6af0a7868d962a 100644 (file)
@@ -38,6 +38,7 @@ struct link_uniform_block_active {
 
    bool has_instance_name;
    bool has_binding;
+   bool is_shader_storage;
 };
 
 class link_uniform_block_active_visitor : public ir_hierarchical_visitor {
index 898544bea8296991ab2b12c9b78f681f3751213d..4df39e200d5aa06d018cf911cf388ed0805ad748 100644 (file)
@@ -293,6 +293,8 @@ link_uniform_blocks(void *mem_ctx,
             blocks[i].NumUniforms =
                (unsigned)(ptrdiff_t)(&variables[parcel.index] - blocks[i].Uniforms);
 
+            blocks[i].IsShaderStorage = b->is_shader_storage;
+
             i++;
          }
       } else {
@@ -311,6 +313,8 @@ link_uniform_blocks(void *mem_ctx,
          blocks[i].NumUniforms =
             (unsigned)(ptrdiff_t)(&variables[parcel.index] - blocks[i].Uniforms);
 
+         blocks[i].IsShaderStorage = b->is_shader_storage;
+
          i++;
       }
    }
index 9ec342bea480ff742aed35e66d11180a1eb2c42e..86508c36f6adc3f69fce916e8d4ca306f34506e1 100644 (file)
@@ -2564,6 +2564,11 @@ struct gl_uniform_block
     */
    GLuint UniformBufferSize;
 
+   /**
+    * Is this actually an interface block for a shader storage buffer?
+    */
+   bool IsShaderStorage;
+
    /**
     * Layout specified in the shader
     *