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

Author: Grazvydas Ignotas <nota...@gmail.com>
Date:   Fri Mar  3 00:46:53 2017 +0200

tgsi/ureg: return correct token count in ureg_get_tokens

Valgrind reports that the shader cache writes uninitialized data to disk.
Turns out ureg_get_tokens() is returning the count of allocated tokens
instead of how many are actually used, so the cache writes out unused
space at the end. Use the real count instead.

This change should not cause regressions elsewhere because the only
ureg_get_tokens() user that cares about token count is the shader cache.

Signed-off-by: Grazvydas Ignotas <nota...@gmail.com>
Reviewed-by: Timothy Arceri <tarc...@itsqueeze.com>

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 8d1b6cc..ab0a3eb 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -2141,7 +2141,7 @@ const struct tgsi_token *ureg_get_tokens( struct 
ureg_program *ureg,
    tokens = &ureg->domain[DOMAIN_DECL].tokens[0].token;
 
    if (nr_tokens) 
-      *nr_tokens = ureg->domain[DOMAIN_DECL].size;
+      *nr_tokens = ureg->domain[DOMAIN_DECL].count;
 
    ureg->domain[DOMAIN_DECL].tokens = 0;
    ureg->domain[DOMAIN_DECL].size = 0;

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to