glsl: fix the type of ir_constant_data::u16
[mesa.git] / src / compiler / glsl / opt_dead_code.cpp
index dbdb7de8bb873bb97828ac20131749f440e44eaf..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;
 
@@ -101,7 +100,7 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
             while (!entry->assign_list.is_empty()) {
                struct assignment_entry *assignment_entry =
                   exec_node_data(struct assignment_entry,
-                                 entry->assign_list.head, link);
+                                 entry->assign_list.get_head_raw(), link);
 
               assignment_entry->assign->remove();
 
@@ -144,9 +143,16 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
              * layouts, do not eliminate it.
              */
             if (entry->var->is_in_buffer_block()) {
-               if (entry->var->get_interface_type()->interface_packing !=
-                   GLSL_INTERFACE_PACKING_PACKED)
+               if (entry->var->get_interface_type_packing() !=
+                   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())