From: Jason Ekstrand Date: Sat, 9 Mar 2019 19:06:28 +0000 (-0600) Subject: nir/validate: Only require bare types to match for copy_deref X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5d26f2d3d59d0f995eabacbe32870779d7730c53;p=mesa.git 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 Reviewed-by: Caio Marcelo de Oliveira Filho --- diff --git a/src/compiler/nir/nir_lower_var_copies.c b/src/compiler/nir/nir_lower_var_copies.c index d677b4e505b..0ba398698f0 100644 --- a/src/compiler/nir/nir_lower_var_copies.c +++ b/src/compiler/nir/nir_lower_var_copies.c @@ -82,7 +82,8 @@ emit_deref_copy_load_store(nir_builder *b, src_deref_arr + 1); } } 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)); nir_store_deref(b, dst_deref, nir_load_deref(b, src_deref), ~0); diff --git a/src/compiler/nir/nir_split_var_copies.c b/src/compiler/nir/nir_split_var_copies.c index 24d573fd235..355a4e56d01 100644 --- a/src/compiler/nir/nir_split_var_copies.c +++ b/src/compiler/nir/nir_split_var_copies.c @@ -66,7 +66,8 @@ static void split_deref_copy_instr(nir_builder *b, 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)) { nir_copy_deref(b, dst, src); } else if (glsl_type_is_struct_or_ifc(src->type)) { diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 7150649bcef..febb0a55f6d 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -543,7 +543,8 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state) 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, glsl_get_bare_type(dst->type) == + glsl_get_bare_type(src->type)); validate_assert(state, (dst->mode & (nir_var_shader_in | nir_var_uniform)) == 0); break;