mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 06:45:16 +00:00
Move storage_class validation from wgsl to resolver
We don't want the WGSL parser to have to maintain type lookups. If the WGSL language is updated to allow module-scope variables to be declared in any order, then the single-pass approach is going to fail horribly. Instead do the check in the Resovler. With this change, the AST nodes actually contain the correctly declared storage class. Fix up the SPIR-V reader to generate StorageClass::kNone for handle types. Fix all tests. Bug: tint:724 Change-Id: I102e30c9bbef32de40e123c2676ea9a281dee74d Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50306 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
a34fa0ecb7
commit
fcda15ef67
@@ -158,24 +158,23 @@ ast::Variable* TextureOverloadCase::buildTextureVariable(
|
||||
return b->Global("texture",
|
||||
b->ty.sampled_texture(texture_dimension,
|
||||
buildResultVectorComponentType(b)),
|
||||
ast::StorageClass::kUniformConstant, nullptr, decos);
|
||||
ast::StorageClass::kNone, nullptr, decos);
|
||||
|
||||
case ast::intrinsic::test::TextureKind::kDepth:
|
||||
return b->Global("texture", b->ty.depth_texture(texture_dimension),
|
||||
ast::StorageClass::kUniformConstant, nullptr, decos);
|
||||
ast::StorageClass::kNone, nullptr, decos);
|
||||
|
||||
case ast::intrinsic::test::TextureKind::kMultisampled:
|
||||
return b->Global(
|
||||
"texture",
|
||||
b->ty.multisampled_texture(texture_dimension,
|
||||
buildResultVectorComponentType(b)),
|
||||
ast::StorageClass::kUniformConstant, nullptr, decos);
|
||||
ast::StorageClass::kNone, nullptr, decos);
|
||||
|
||||
case ast::intrinsic::test::TextureKind::kStorage: {
|
||||
auto st = b->ty.storage_texture(texture_dimension, image_format);
|
||||
auto ac = b->ty.access(access_control, st);
|
||||
return b->Global("texture", ac, ast::StorageClass::kUniformConstant,
|
||||
nullptr, decos);
|
||||
return b->Global("texture", ac, ast::StorageClass::kNone, nullptr, decos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +189,7 @@ ast::Variable* TextureOverloadCase::buildSamplerVariable(
|
||||
b->create<ast::BindingDecoration>(1),
|
||||
};
|
||||
return b->Global("sampler", b->ty.sampler(sampler_kind),
|
||||
ast::StorageClass::kUniformConstant, nullptr, decos);
|
||||
ast::StorageClass::kNone, nullptr, decos);
|
||||
}
|
||||
|
||||
std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
||||
|
||||
@@ -19,6 +19,10 @@ namespace ast {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, StorageClass sc) {
|
||||
switch (sc) {
|
||||
case StorageClass::kInvalid: {
|
||||
out << "invalid";
|
||||
break;
|
||||
}
|
||||
case StorageClass::kNone: {
|
||||
out << "none";
|
||||
break;
|
||||
|
||||
@@ -22,7 +22,8 @@ namespace ast {
|
||||
|
||||
/// Storage class of a given pointer.
|
||||
enum class StorageClass {
|
||||
kNone = -1,
|
||||
kInvalid = -1,
|
||||
kNone,
|
||||
kInput,
|
||||
kOutput,
|
||||
kUniform,
|
||||
|
||||
Reference in New Issue
Block a user