nir/validate: Only require bare types to match for copy_deref
If we want to be able to use copy_deref instructions on explicitly laid out types, we have to be a little more flexible about what types we allow. Instead, of requiring the types to exactly match, only require the bare types to match. Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This commit is contained in:

committed by
Jason Ekstrand

parent
2b76de9b5d
commit
5d26f2d3d5
@@ -82,7 +82,8 @@ emit_deref_copy_load_store(nir_builder *b,
|
|||||||
src_deref_arr + 1);
|
src_deref_arr + 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(dst_deref->type == src_deref->type);
|
assert(glsl_get_bare_type(dst_deref->type) ==
|
||||||
|
glsl_get_bare_type(src_deref->type));
|
||||||
assert(glsl_type_is_vector_or_scalar(dst_deref->type));
|
assert(glsl_type_is_vector_or_scalar(dst_deref->type));
|
||||||
|
|
||||||
nir_store_deref(b, dst_deref, nir_load_deref(b, src_deref), ~0);
|
nir_store_deref(b, dst_deref, nir_load_deref(b, src_deref), ~0);
|
||||||
|
@@ -66,7 +66,8 @@ static void
|
|||||||
split_deref_copy_instr(nir_builder *b,
|
split_deref_copy_instr(nir_builder *b,
|
||||||
nir_deref_instr *dst, nir_deref_instr *src)
|
nir_deref_instr *dst, nir_deref_instr *src)
|
||||||
{
|
{
|
||||||
assert(dst->type == src->type);
|
assert(glsl_get_bare_type(dst->type) ==
|
||||||
|
glsl_get_bare_type(src->type));
|
||||||
if (glsl_type_is_vector_or_scalar(src->type)) {
|
if (glsl_type_is_vector_or_scalar(src->type)) {
|
||||||
nir_copy_deref(b, dst, src);
|
nir_copy_deref(b, dst, src);
|
||||||
} else if (glsl_type_is_struct_or_ifc(src->type)) {
|
} else if (glsl_type_is_struct_or_ifc(src->type)) {
|
||||||
|
@@ -543,7 +543,8 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
|
|||||||
case nir_intrinsic_copy_deref: {
|
case nir_intrinsic_copy_deref: {
|
||||||
nir_deref_instr *dst = nir_src_as_deref(instr->src[0]);
|
nir_deref_instr *dst = nir_src_as_deref(instr->src[0]);
|
||||||
nir_deref_instr *src = nir_src_as_deref(instr->src[1]);
|
nir_deref_instr *src = nir_src_as_deref(instr->src[1]);
|
||||||
validate_assert(state, dst->type == src->type);
|
validate_assert(state, glsl_get_bare_type(dst->type) ==
|
||||||
|
glsl_get_bare_type(src->type));
|
||||||
validate_assert(state, (dst->mode & (nir_var_shader_in |
|
validate_assert(state, (dst->mode & (nir_var_shader_in |
|
||||||
nir_var_uniform)) == 0);
|
nir_var_uniform)) == 0);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user