[Mesa-dev] [PATCH] ttn: set ->info->num_ubos

Rob Clark robdclark at gmail.com
Sat Dec 24 17:52:56 UTC 2016


For dealing w/ 32b vs 64b gpu addresses, I need to rework how we pass
UBO buffer addresses to shader, and knowing up front the # of UBOs is
useful.  But I noticed ttn wasn't setting this.

Signed-off-by: Rob Clark <robdclark at gmail.com>
---
 src/gallium/auxiliary/nir/tgsi_to_nir.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index d01e458..a0b0d82 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -314,8 +314,11 @@ ttn_emit_declaration(struct ttn_compile *c)
              file == TGSI_FILE_CONSTANT);
 
       /* nothing to do for UBOs: */
-      if ((file == TGSI_FILE_CONSTANT) && decl->Declaration.Dimension)
+      if ((file == TGSI_FILE_CONSTANT) && decl->Declaration.Dimension) {
+         b->shader->info->num_ubos =
+            MAX2(b->shader->info->num_ubos, decl->Dim.Index2D);
          return;
+      }
 
       if ((file == TGSI_FILE_INPUT) || (file == TGSI_FILE_OUTPUT)) {
          is_array = (is_array && decl->Declaration.Array &&
-- 
2.7.4



More information about the mesa-dev mailing list