vtn: Propagate access data that's present on all struct members to the struct itself
authorJesse Natalie <jenatali@microsoft.com>
Mon, 19 Apr 2021 23:04:14 +0000 (16:04 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 23 Apr 2021 23:16:15 +0000 (23:16 +0000)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10356>

src/compiler/spirv/spirv_to_nir.c

index 814b9e0..63c8e29 100644 (file)
@@ -1484,6 +1484,14 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
       };
 
       vtn_foreach_decoration(b, val, struct_member_decoration_cb, &ctx);
+
+      /* Propagate access specifiers that are present on all members to the overall type */
+      enum gl_access_qualifier overall_access = ACCESS_COHERENT | ACCESS_VOLATILE |
+                                                ACCESS_NON_READABLE | ACCESS_NON_WRITEABLE;
+      for (unsigned i = 0; i < num_fields; ++i)
+         overall_access &= val->type->members[i]->access;
+      val->type->access = overall_access;
+
       vtn_foreach_decoration(b, val, struct_member_matrix_stride_cb, &ctx);
 
       vtn_foreach_decoration(b, val, struct_block_decoration_cb, NULL);