glsl: correctly detect inactive UBO arrays
authorTimothy Arceri <t_arceri@yahoo.com.au>
Wed, 23 Sep 2015 01:12:57 +0000 (11:12 +1000)
committerTimothy Arceri <t_arceri@yahoo.com.au>
Thu, 24 Sep 2015 00:07:42 +0000 (10:07 +1000)
Previously the code was trying to get the packing type from the array not the
interface.

Cc: Ian Romanick <ian.d.romanick@intel.com>
Cc: Antia Puentes <apuentes@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
src/glsl/link_uniform_block_active_visitor.cpp
src/glsl/opt_dead_code.cpp

index 510294783a0009d35371646d4a6e62db90ca7528..72e07828a6de371e52d2a2c3e351cccee807abdf 100644 (file)
@@ -77,9 +77,6 @@ link_uniform_block_active_visitor::visit(ir_variable *var)
    if (!var->is_in_buffer_block())
       return visit_continue;
 
-   const glsl_type *const block_type = var->is_interface_instance()
-      ? var->type : var->get_interface_type();
-
    /* Section 2.11.6 (Uniform Variables) of the OpenGL ES 3.0.3 spec says:
     *
     *     "All members of a named uniform block declared with a shared or
@@ -88,7 +85,8 @@ link_uniform_block_active_visitor::visit(ir_variable *var)
     *     also considered active, even if no member of the block is
     *     referenced."
     */
-   if (block_type->interface_packing == GLSL_INTERFACE_PACKING_PACKED)
+   if (var->get_interface_type()->interface_packing ==
+       GLSL_INTERFACE_PACKING_PACKED)
       return visit_continue;
 
    /* Process the block.  Bail if there was an error.
index e4bf874700c2b1274a7e63b792b1d50aa8a1edfd..2cb7f41adef10f6e7d83110014fcf62c4fcc9948 100644 (file)
@@ -119,11 +119,8 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
              * layouts, do not eliminate it.
              */
             if (entry->var->is_in_buffer_block()) {
-               const glsl_type *const block_type =
-                  entry->var->is_interface_instance()
-                  ? entry->var->type : entry->var->get_interface_type();
-
-               if (block_type->interface_packing != GLSL_INTERFACE_PACKING_PACKED)
+               if (entry->var->get_interface_type()->interface_packing !=
+                   GLSL_INTERFACE_PACKING_PACKED)
                   continue;
             }