summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_validate.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-11-10 14:13:47 -0800
committerJason Ekstrand <[email protected]>2015-11-12 22:08:43 -0800
commit4bbf2ac06e71102a65b4d0427a0ba630a3c2477c (patch)
tree4d3a453117289e247882ec14a0ccf8a3db123541 /src/glsl/nir/nir_validate.c
parent79f68306d23bfb48ef645c4bded8ee7b74d2d661 (diff)
nir/validate: Allow subroutine types for the tails of derefs
The shader-subroutine code creates uniforms of type SUBROUTINE for subroutines that are then read as integers in the backends. If we ever want to do any optimizations on these, we'll need to come up with a better plan where they are actual scalars or something, but this works for now. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92859 Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_validate.c')
-rw-r--r--src/glsl/nir/nir_validate.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c
index a42e830fd72..51c2529dc38 100644
--- a/src/glsl/nir/nir_validate.c
+++ b/src/glsl/nir/nir_validate.c
@@ -401,7 +401,9 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
case nir_intrinsic_load_var: {
const struct glsl_type *type =
nir_deref_tail(&instr->variables[0]->deref)->type;
- assert(glsl_type_is_vector_or_scalar(type));
+ assert(glsl_type_is_vector_or_scalar(type) ||
+ (instr->variables[0]->var->data.mode == nir_var_uniform &&
+ glsl_get_base_type(type) == GLSL_TYPE_SUBROUTINE));
assert(instr->num_components == glsl_get_vector_elements(type));
assert(instr->variables[0]->var->data.mode != nir_var_shader_out);
break;
@@ -409,7 +411,9 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
case nir_intrinsic_store_var: {
const struct glsl_type *type =
nir_deref_tail(&instr->variables[0]->deref)->type;
- assert(glsl_type_is_vector_or_scalar(type));
+ assert(glsl_type_is_vector_or_scalar(type) ||
+ (instr->variables[0]->var->data.mode == nir_var_uniform &&
+ glsl_get_base_type(type) == GLSL_TYPE_SUBROUTINE));
assert(instr->num_components == glsl_get_vector_elements(type));
assert(instr->variables[0]->var->data.mode != nir_var_shader_in &&
instr->variables[0]->var->data.mode != nir_var_uniform &&