summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_validate.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-03-26 14:50:38 -0700
committerJason Ekstrand <[email protected]>2018-06-22 21:23:06 -0700
commita331d7d1cdfdc971f707fb6b1f71edbad622c804 (patch)
treef06ed49b17aa136f332e6a6cdf9461c3b958edf6 /src/compiler/nir/nir_validate.c
parent9800b81ffb64a863e8a6b29366f32281eb844a53 (diff)
nir: Remove old-school deref chain support
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.c107
1 files changed, 0 insertions, 107 deletions
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index ffee4b54621..7d7bf25436c 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -393,55 +393,6 @@ validate_alu_instr(nir_alu_instr *instr, validate_state *state)
}
static void
-validate_deref_chain(nir_deref *deref, nir_variable_mode mode,
- validate_state *state)
-{
- validate_assert(state, deref->child == NULL || ralloc_parent(deref->child) == deref);
-
- nir_deref *parent = NULL;
- while (deref != NULL) {
- switch (deref->deref_type) {
- case nir_deref_type_array:
- if (mode == nir_var_shared) {
- /* Shared variables have a bit more relaxed rules because we need
- * to be able to handle array derefs on vectors. Fortunately,
- * nir_lower_io handles these just fine.
- */
- validate_assert(state, glsl_type_is_array(parent->type) ||
- glsl_type_is_matrix(parent->type) ||
- glsl_type_is_vector(parent->type));
- } else {
- /* Most of NIR cannot handle array derefs on vectors */
- validate_assert(state, glsl_type_is_array(parent->type) ||
- glsl_type_is_matrix(parent->type));
- }
- validate_assert(state, deref->type == glsl_get_array_element(parent->type));
- if (nir_deref_as_array(deref)->deref_array_type ==
- nir_deref_array_type_indirect)
- validate_src(&nir_deref_as_array(deref)->indirect, state, 32, 1);
- break;
-
- case nir_deref_type_struct:
- assume(parent); /* cannot happen: deref change starts w/ nir_deref_var */
- validate_assert(state, deref->type ==
- glsl_get_struct_field(parent->type,
- nir_deref_as_struct(deref)->index));
- break;
-
- case nir_deref_type_var:
- break;
-
- default:
- validate_assert(state, !"Invalid deref type");
- break;
- }
-
- parent = deref;
- deref = deref->child;
- }
-}
-
-static void
validate_var_use(nir_variable *var, validate_state *state)
{
struct hash_entry *entry = _mesa_hash_table_search(state->var_defs, var);
@@ -451,18 +402,6 @@ validate_var_use(nir_variable *var, validate_state *state)
}
static void
-validate_deref_var(void *parent_mem_ctx, nir_deref_var *deref, validate_state *state)
-{
- validate_assert(state, deref != NULL);
- validate_assert(state, ralloc_parent(deref) == parent_mem_ctx);
- validate_assert(state, deref->deref.type == deref->var->type);
-
- validate_var_use(deref->var, state);
-
- validate_deref_chain(&deref->deref, deref->var->data.mode, state);
-}
-
-static void
validate_deref_instr(nir_deref_instr *instr, validate_state *state)
{
if (instr->deref_type == nir_deref_type_var) {
@@ -590,41 +529,6 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
break;
}
- case nir_intrinsic_load_var: {
- const struct glsl_type *type =
- nir_deref_tail(&instr->variables[0]->deref)->type;
- validate_assert(state, glsl_type_is_vector_or_scalar(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));
- dest_bit_size = glsl_get_bit_size(type);
- break;
- }
-
- case nir_intrinsic_store_var: {
- const struct glsl_type *type =
- nir_deref_tail(&instr->variables[0]->deref)->type;
- validate_assert(state, glsl_type_is_vector_or_scalar(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));
- src_bit_sizes[0] = glsl_get_bit_size(type);
- validate_assert(state, instr->variables[0]->var->data.mode != nir_var_shader_in &&
- instr->variables[0]->var->data.mode != nir_var_uniform &&
- instr->variables[0]->var->data.mode != nir_var_shader_storage);
- validate_assert(state, (nir_intrinsic_write_mask(instr) & ~((1 << instr->num_components) - 1)) == 0);
- break;
- }
-
- case nir_intrinsic_copy_var:
- validate_assert(state, nir_deref_tail(&instr->variables[0]->deref)->type ==
- nir_deref_tail(&instr->variables[1]->deref)->type);
- validate_assert(state, instr->variables[0]->var->data.mode != nir_var_shader_in &&
- instr->variables[0]->var->data.mode != nir_var_uniform &&
- instr->variables[0]->var->data.mode != nir_var_shader_storage);
- break;
-
default:
break;
}
@@ -638,11 +542,6 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
validate_src(&instr->src[i], state, src_bit_sizes[i], components_read);
}
- unsigned num_vars = nir_intrinsic_infos[instr->intrinsic].num_variables;
- for (unsigned i = 0; i < num_vars; i++) {
- validate_deref_var(instr, instr->variables[i], state);
- }
-
if (nir_intrinsic_infos[instr->intrinsic].has_dest) {
unsigned components_written = nir_intrinsic_dest_components(instr);
@@ -666,12 +565,6 @@ validate_tex_instr(nir_tex_instr *instr, validate_state *state)
0, nir_tex_instr_src_size(instr, i));
}
- if (instr->texture != NULL)
- validate_deref_var(instr, instr->texture, state);
-
- if (instr->sampler != NULL)
- validate_deref_var(instr, instr->sampler, state);
-
validate_dest(&instr->dest, state, 0, nir_tex_instr_dest_size(instr));
}