Mesa (master): vc4: Use proper type sizes for uniforms.

Eric Anholt anholt at kemper.freedesktop.org
Mon Aug 22 19:11:32 UTC 2016


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

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jul 27 15:03:39 2016 -0700

vc4: Use proper type sizes for uniforms.

---

 src/gallium/drivers/vc4/vc4_program.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 8b50831..1e8542f 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -37,6 +37,7 @@
 #include "vc4_context.h"
 #include "vc4_qpu.h"
 #include "vc4_qir.h"
+#include "mesa/state_tracker/st_glsl_types.h"
 #ifdef USE_VC4_SIMULATOR
 #include "simpenrose/simpenrose.h"
 #endif
@@ -1486,11 +1487,11 @@ static void
 ntq_setup_uniforms(struct vc4_compile *c)
 {
         nir_foreach_variable(var, &c->s->uniforms) {
-                unsigned array_len = MAX2(glsl_get_length(var->type), 1);
-                unsigned array_elem_size = 4 * sizeof(float);
+                uint32_t vec4_count = st_glsl_type_size(var->type);
+                unsigned vec4_size = 4 * sizeof(float);
 
-                declare_uniform_range(c, var->data.driver_location * array_elem_size,
-                                      array_len * array_elem_size);
+                declare_uniform_range(c, var->data.driver_location * vec4_size,
+                                      vec4_count * vec4_size);
 
         }
 }




More information about the mesa-commit mailing list