mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
writer/msl: Handle texture and sampler variables
Move these module-scope variables to entry point parameters and pass them as arguments to functions that use them. Disable entry point IO validation for them. Emit [[texture()]] and [[sampler()]] attributes on these entry point parameters. Fixed: tint:145 Change-Id: I936a80801875a5d0b6cd98a2e8f3e297a2f53509 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53961 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
2940c7002c
commit
830b97ffa9
@@ -1011,7 +1011,8 @@ bool Resolver::ValidateEntryPoint(const ast::Function* func,
|
||||
pipeline_io_attribute->source());
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
} else if (!IsValidationDisabled(
|
||||
decos, ast::DisabledValidation::kEntryPointParameter)) {
|
||||
if (!pipeline_io_attribute) {
|
||||
std::string err = "missing entry point IO attribute";
|
||||
if (!is_struct_member) {
|
||||
|
||||
@@ -292,7 +292,7 @@ TEST_F(ResolverValidationTest, UsingUndefinedVariableDifferentScope_Fail) {
|
||||
"12:34 error: v-0006: identifier must be declared before use: a");
|
||||
}
|
||||
|
||||
TEST_F(ResolverValidationTest, StorageClass_NonFunctionClassError) {
|
||||
TEST_F(ResolverValidationTest, StorageClass_FunctionVariableWorkgroupClass) {
|
||||
auto* var = Var("var", ty.i32(), ast::StorageClass::kWorkgroup);
|
||||
|
||||
auto* stmt = Decl(var);
|
||||
@@ -305,6 +305,19 @@ TEST_F(ResolverValidationTest, StorageClass_NonFunctionClassError) {
|
||||
"error: function variable has a non-function storage class");
|
||||
}
|
||||
|
||||
TEST_F(ResolverValidationTest, StorageClass_FunctionVariableHandleClass) {
|
||||
auto* var = Var("s", ty.sampler(ast::SamplerKind::kSampler));
|
||||
|
||||
auto* stmt = Decl(var);
|
||||
Func("func", ast::VariableList{}, ty.void_(), ast::StatementList{stmt},
|
||||
ast::DecorationList{});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
||||
EXPECT_EQ(r()->error(),
|
||||
"error: function variable has a non-function storage class");
|
||||
}
|
||||
|
||||
TEST_F(ResolverValidationTest, StorageClass_SamplerExplicitStorageClass) {
|
||||
auto* t = ty.sampler(ast::SamplerKind::kSampler);
|
||||
Global(Source{{12, 34}}, "var", t, ast::StorageClass::kUniformConstant,
|
||||
|
||||
Reference in New Issue
Block a user