Mesa (master): vc4: Also consider uniform 0 in uniform lowering.

Eric Anholt anholt at kemper.freedesktop.org
Fri Jul 17 19:38:02 UTC 2015


Module: Mesa
Branch: master
Commit: be7adc2ecad0d04037cb0c99754703dde86ee73a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=be7adc2ecad0d04037cb0c99754703dde86ee73a

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jul 16 14:30:28 2015 -0700

vc4: Also consider uniform 0 in uniform lowering.

The hash table considers key 0 to be the empty key.

---

 src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c b/src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c
index 910c89d..f087c3b 100644
--- a/src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c
+++ b/src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c
@@ -52,7 +52,7 @@ static void
 add_uniform(struct hash_table *ht, struct qreg reg)
 {
         struct hash_entry *entry;
-        void *key = (void *)(uintptr_t)reg.index;
+        void *key = (void *)(uintptr_t)(reg.index + 1);
 
         entry = _mesa_hash_table_search(ht, key);
         if (entry) {
@@ -66,7 +66,7 @@ static void
 remove_uniform(struct hash_table *ht, struct qreg reg)
 {
         struct hash_entry *entry;
-        void *key = (void *)(uintptr_t)reg.index;
+        void *key = (void *)(uintptr_t)(reg.index + 1);
 
         entry = _mesa_hash_table_search(ht, key);
         assert(entry);
@@ -122,7 +122,7 @@ qir_lower_uniforms(struct vc4_compile *c)
                 struct hash_entry *entry;
                 hash_table_foreach(ht, entry) {
                         uint32_t count = (uintptr_t)entry->data;
-                        uint32_t index = (uintptr_t)entry->key;
+                        uint32_t index = (uintptr_t)entry->key - 1;
                         if (count > max_count) {
                                 max_count = count;
                                 max_index = index;




More information about the mesa-commit mailing list