glsl: fix the type of ir_constant_data::u16
[mesa.git] / src / compiler / glsl / opt_dead_code.cpp
index 75e668ae46da727dfd3ad0f169fa828daeafe5ab..3e571fc7dd03cb42c98984690d11b9976fc7923b 100644 (file)
@@ -50,7 +50,6 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
 
    v.run(instructions);
 
-   struct hash_entry *e;
    hash_table_foreach(v.ht, e) {
       ir_variable_refcount_entry *entry = (ir_variable_refcount_entry *)e->data;
 
@@ -145,8 +144,15 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
              */
             if (entry->var->is_in_buffer_block()) {
                if (entry->var->get_interface_type_packing() !=
-                   GLSL_INTERFACE_PACKING_PACKED)
+                   GLSL_INTERFACE_PACKING_PACKED) {
+                  /* Set used to false so it doesn't get set as referenced by
+                   * the shader in the program resource list. This will also
+                   * help avoid the state being unnecessarily flushed for the
+                   * shader stage.
+                   */
+                  entry->var->data.used = false;
                   continue;
+               }
             }
 
             if (entry->var->type->is_subroutine())