Resolver: Track storage class usages of structures

This will be used to validate layout rules, as well as preventing
illegal types from being used in a uniform / storage buffer.

Also: Cleanup logic around VariableDeclStatement
This was spread across 3 places, entirely unnecessarily.

Bug: tint:643
Change-Id: I9d309c3a5dfb5676984f49ce51763a97bcac93bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/45125
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton
2021-03-17 22:47:33 +00:00
committed by Commit Bot service account
parent 893afdfd2c
commit a88090b04d
8 changed files with 282 additions and 64 deletions

View File

@@ -34,6 +34,12 @@ enum class StorageClass {
kFunction
};
/// @returns true if the StorageClass is host-sharable
/// @see https://gpuweb.github.io/gpuweb/wgsl.html#host-shareable
inline bool IsHostSharable(StorageClass sc) {
return sc == ast::StorageClass::kUniform || sc == ast::StorageClass::kStorage;
}
std::ostream& operator<<(std::ostream& out, StorageClass sc);
} // namespace ast