diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-05-29 10:21:21 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-05-29 10:21:21 +0000 |
commit | 99b70277b7a71ca729b7723c0be213c9db46702c (patch) | |
tree | 756afa5d954f14d117bad3856a5eb9d5ab1b1a0d /lib/mesa/src/compiler/glsl/lower_output_reads.cpp | |
parent | 3e40341f9dcd7c1bbc9afb8ddb812304820396cf (diff) |
Import Mesa 11.2.2
Diffstat (limited to 'lib/mesa/src/compiler/glsl/lower_output_reads.cpp')
-rw-r--r-- | lib/mesa/src/compiler/glsl/lower_output_reads.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/mesa/src/compiler/glsl/lower_output_reads.cpp b/lib/mesa/src/compiler/glsl/lower_output_reads.cpp index bd3accb3d..79488df29 100644 --- a/lib/mesa/src/compiler/glsl/lower_output_reads.cpp +++ b/lib/mesa/src/compiler/glsl/lower_output_reads.cpp @@ -23,7 +23,7 @@ */ #include "ir.h" -#include "util/hash_table.h" +#include "program/hash_table.h" /** * \file lower_output_reads.cpp @@ -47,6 +47,8 @@ protected: */ hash_table *replacements; + void *mem_ctx; + unsigned stage; public: output_read_remover(unsigned stage); @@ -72,36 +74,39 @@ static unsigned hash_table_var_hash(const void *key) { const ir_variable * var = static_cast<const ir_variable *>(key); - return _mesa_key_hash_string(var->name); + return hash_table_string_hash(var->name); } output_read_remover::output_read_remover(unsigned stage) { this->stage = stage; - replacements = _mesa_hash_table_create(NULL, hash_table_var_hash, - _mesa_key_pointer_equal); + mem_ctx = ralloc_context(NULL); + replacements = + hash_table_ctor(0, hash_table_var_hash, hash_table_pointer_compare); } output_read_remover::~output_read_remover() { - _mesa_hash_table_destroy(replacements, NULL); + hash_table_dtor(replacements); + ralloc_free(mem_ctx); } ir_visitor_status output_read_remover::visit(ir_dereference_variable *ir) { - if (ir->var->data.mode != ir_var_shader_out || ir->var->data.fb_fetch_output) + if (ir->var->data.mode != ir_var_shader_out) + return visit_continue; + if (stage == MESA_SHADER_TESS_CTRL) return visit_continue; - hash_entry *entry = _mesa_hash_table_search(replacements, ir->var); - ir_variable *temp = entry ? (ir_variable *) entry->data : NULL; + ir_variable *temp = (ir_variable *) hash_table_find(replacements, ir->var); /* If we don't have an existing temporary, create one. */ if (temp == NULL) { void *var_ctx = ralloc_parent(ir->var); temp = new(var_ctx) ir_variable(ir->var->type, ir->var->name, ir_var_temporary); - _mesa_hash_table_insert(replacements, ir->var, temp); + hash_table_insert(replacements, temp, ir->var); ir->var->insert_after(temp); } @@ -151,6 +156,7 @@ ir_visitor_status output_read_remover::visit_leave(ir_emit_vertex *ir) { hash_table_call_foreach(replacements, emit_return_copy, ir); + hash_table_clear(replacements); return visit_continue; } @@ -167,12 +173,6 @@ output_read_remover::visit_leave(ir_function_signature *sig) void lower_output_reads(unsigned stage, exec_list *instructions) { - /* Due to the possible interactions between multiple tessellation control - * shader invocations, we leave output variables as-is. - */ - if (stage == MESA_SHADER_TESS_CTRL) - return; - output_read_remover v(stage); visit_list_elements(&v, instructions); } |