[Mesa-dev] [PATCH] glsl: fix variable ordering in the output_read_remover

Vadim Girlin vadimgirlin at gmail.com
Sat Mar 31 11:23:45 PDT 2012


Use the hash of the variable name string instead of the pointer value.

Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
---

This patch solves the problem for me, afaics.
Tested with quick-driver.tests

 src/glsl/lower_output_reads.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/glsl/lower_output_reads.cpp b/src/glsl/lower_output_reads.cpp
index 415b541..151a09b 100644
--- a/src/glsl/lower_output_reads.cpp
+++ b/src/glsl/lower_output_reads.cpp
@@ -54,11 +54,18 @@ public:
    virtual ir_visitor_status visit_leave(class ir_function_signature *);
 };
 
+static unsigned
+hash_table_var_hash(const void *key)
+{
+   ir_variable *var = (ir_variable*) key;
+   return hash_table_string_hash(var->name);
+}
+
 output_read_remover::output_read_remover()
 {
    mem_ctx = ralloc_context(NULL);
    replacements =
-      hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
+      hash_table_ctor(0, hash_table_var_hash, hash_table_pointer_compare);
 }
 
 output_read_remover::~output_read_remover()
-- 
1.7.7.6



More information about the mesa-dev mailing list