summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_validate.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-03-15 14:56:43 -0700
committerJason Ekstrand <[email protected]>2018-06-22 20:15:53 -0700
commitf1dc2088e298e5867c6ff1b274fff87557c004a3 (patch)
tree2a8fe94f6d5c30c5c8c06402e06eff4583aeb49e /src/compiler/nir/nir_validate.c
parentde7f60b6537c7718cac5b172e6e52817bcc4d2c7 (diff)
nir: Add _deref versions of all of the _var intrinsics
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Acked-by: Rob Clark <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Dave Airlie <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_validate.c')
-rw-r--r--src/compiler/nir/nir_validate.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index 2d6f287f722..191e3b72325 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -547,6 +547,40 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
unsigned dest_bit_size = 0;
unsigned src_bit_sizes[NIR_INTRINSIC_MAX_INPUTS] = { 0, };
switch (instr->intrinsic) {
+ case nir_intrinsic_load_deref: {
+ nir_deref_instr *src = nir_src_as_deref(instr->src[0]);
+ validate_assert(state, glsl_type_is_vector_or_scalar(src->type) ||
+ (src->mode == nir_var_uniform &&
+ glsl_get_base_type(src->type) == GLSL_TYPE_SUBROUTINE));
+ validate_assert(state, instr->num_components ==
+ glsl_get_vector_elements(src->type));
+ dest_bit_size = glsl_get_bit_size(src->type);
+ break;
+ }
+
+ case nir_intrinsic_store_deref: {
+ nir_deref_instr *dst = nir_src_as_deref(instr->src[0]);
+ validate_assert(state, glsl_type_is_vector_or_scalar(dst->type));
+ validate_assert(state, instr->num_components ==
+ glsl_get_vector_elements(dst->type));
+ src_bit_sizes[1] = glsl_get_bit_size(dst->type);
+ validate_assert(state, (dst->mode & (nir_var_shader_in |
+ nir_var_uniform |
+ nir_var_shader_storage)) == 0);
+ validate_assert(state, (nir_intrinsic_write_mask(instr) & ~((1 << instr->num_components) - 1)) == 0);
+ break;
+ }
+
+ case nir_intrinsic_copy_deref: {
+ nir_deref_instr *dst = nir_src_as_deref(instr->src[0]);
+ nir_deref_instr *src = nir_src_as_deref(instr->src[1]);
+ validate_assert(state, dst->type == src->type);
+ validate_assert(state, (dst->mode & (nir_var_shader_in |
+ nir_var_uniform |
+ nir_var_shader_storage)) == 0);
+ break;
+ }
+
case nir_intrinsic_load_var: {
const struct glsl_type *type =
nir_deref_tail(&instr->variables[0]->deref)->type;