nir/validate: Only require bare types to match for copy_deref
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 9 Mar 2019 19:06:28 +0000 (13:06 -0600)
committerJason Ekstrand <jason@jlekstrand.net>
Fri, 15 Mar 2019 01:02:19 +0000 (01:02 +0000)
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>
src/compiler/nir/nir_lower_var_copies.c
src/compiler/nir/nir_split_var_copies.c
src/compiler/nir/nir_validate.c

index d677b4e505b97b8207269a3f7db60cf856d66fe0..0ba398698f0dd9d0fa24f962bd4156a632fb6e96 100644 (file)
@@ -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);
index 24d573fd2355248f94c6ed453f24960ac74e633d..355a4e56d0136bdb08e71a16e34b38cd2b9f01a0 100644 (file)
@@ -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)) {
index 7150649bcef62bfe8fdac6c418c33aa88687c234..febb0a55f6d7aada5f919b61086647e912c5626a 100644 (file)
@@ -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;