mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-04 13:08:15 +02:00
nir/validate: Add better validation of load/store types
This commit is contained in:
parent
82c579e314
commit
f23d951083
1 changed files with 14 additions and 2 deletions
|
|
@ -398,15 +398,27 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
|
|||
}
|
||||
|
||||
switch (instr->intrinsic) {
|
||||
case nir_intrinsic_load_var:
|
||||
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(instr->num_components == glsl_get_vector_elements(type));
|
||||
assert(instr->variables[0]->var->data.mode != nir_var_shader_out);
|
||||
break;
|
||||
case nir_intrinsic_store_var:
|
||||
}
|
||||
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(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 &&
|
||||
instr->variables[0]->var->data.mode != nir_var_shader_storage);
|
||||
break;
|
||||
}
|
||||
case nir_intrinsic_copy_var:
|
||||
assert(nir_deref_tail(&instr->variables[0]->deref)->type ==
|
||||
nir_deref_tail(&instr->variables[1]->deref)->type);
|
||||
assert(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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue