spirv: Add block decorations with a transform

Any struct which is used as the store type of a buffer variable needs
to have a block decoration. If that struct is nested inside an array
or another struct, we wrap it inside another struct first.

This removes the SPIR-V backend's reliance on the [[block]] attribute,
which will soon be deprecated and removed.

Bug: tint:1324
Change-Id: Ib6ad54f24a3e4a090da9faeed699f266abcb66ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72082
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price
2021-12-09 15:45:03 +00:00
parent ac8975f291
commit 3a4443a681
12 changed files with 739 additions and 81 deletions

View File

@@ -2160,7 +2160,8 @@ bool Resolver::ValidateStructure(const sem::Struct* str) {
}
for (auto* deco : str->Declaration()->decorations) {
if (!(deco->Is<ast::StructBlockDecoration>())) {
if (!(deco->IsAnyOf<ast::StructBlockDecoration,
ast::InternalDecoration>())) {
AddError("decoration is not valid for struct declarations", deco->source);
return false;
}