From 639115123efe7f71d432e24b1719adda7d23e97e Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 18 Mar 2015 12:34:09 -0700 Subject: nir: Use a list instead of a hash_table for inputs, outputs, and uniforms We never did a single hash table lookup in the entire NIR code base that I found so there was no real benifit to doing it that way. I suppose that for linking, we'll probably want to be able to lookup by name but we can leave building that hash table to the linker. In the mean time this was causing problems with GLSL IR -> NIR because GLSL IR doesn't guarantee us unique names of uniforms, etc. This was causing massive rendering isues in the unreal4 Sun Temple demo. Reviewed-by: Connor Abbott --- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index a9e75ab55fa..9431e5dd74e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -196,9 +196,7 @@ fs_visitor::emit_nir_code() void fs_visitor::nir_setup_inputs(nir_shader *shader) { - struct hash_entry *entry; - hash_table_foreach(shader->inputs, entry) { - nir_variable *var = (nir_variable *) entry->data; + foreach_list_typed(nir_variable, var, node, &shader->inputs) { enum brw_reg_type type = brw_type_for_base_type(var->type); fs_reg input = offset(nir_inputs, var->data.driver_location); @@ -250,9 +248,7 @@ fs_visitor::nir_setup_outputs(nir_shader *shader) { brw_wm_prog_key *key = (brw_wm_prog_key*) this->key; - struct hash_entry *entry; - hash_table_foreach(shader->outputs, entry) { - nir_variable *var = (nir_variable *) entry->data; + foreach_list_typed(nir_variable, var, node, &shader->outputs) { fs_reg reg = offset(nir_outputs, var->data.driver_location); int vector_elements = @@ -304,10 +300,7 @@ fs_visitor::nir_setup_uniforms(nir_shader *shader) if (dispatch_width != 8) return; - struct hash_entry *entry; - hash_table_foreach(shader->uniforms, entry) { - nir_variable *var = (nir_variable *) entry->data; - + foreach_list_typed(nir_variable, var, node, &shader->uniforms) { /* UBO's and atomics don't take up space in the uniform file */ if (var->interface_type != NULL || var->type->contains_atomic()) -- cgit v1.2.3