[Mesa-dev] [PATCH] nir: fix load/store_var validation for matrix types

Timothy Arceri tarceri at itsqueeze.com
Fri Oct 27 03:58:24 UTC 2017


For some reason when we convert the following from GLSL IR to NIR:

out mat4 var;

The derefence type ends up as vec4 so we don't currently end up
asserting here. However I hit this with a NIR array splitting pass
I'm working on.
---
 src/compiler/nir/nir_validate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index 2322c8f786d..6ff17ee6a96 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -498,6 +498,7 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
       const struct glsl_type *type =
          nir_deref_tail(&instr->variables[0]->deref)->type;
       validate_assert(state, glsl_type_is_vector_or_scalar(type) ||
+             glsl_type_is_matrix(type) ||
              (instr->variables[0]->var->data.mode == nir_var_uniform &&
               glsl_get_base_type(type) == GLSL_TYPE_SUBROUTINE));
       validate_assert(state, instr->num_components == glsl_get_vector_elements(type));
@@ -507,6 +508,7 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
       const struct glsl_type *type =
          nir_deref_tail(&instr->variables[0]->deref)->type;
       validate_assert(state, glsl_type_is_vector_or_scalar(type) ||
+             glsl_type_is_matrix(type) ||
              (instr->variables[0]->var->data.mode == nir_var_uniform &&
               glsl_get_base_type(type) == GLSL_TYPE_SUBROUTINE));
       validate_assert(state, instr->num_components == glsl_get_vector_elements(type));
-- 
2.13.6



More information about the mesa-dev mailing list