From 830b97ffa9cec13b4d3b6878847d599dd5e75766 Mon Sep 17 00:00:00 2001 From: James Price Date: Fri, 11 Jun 2021 12:34:26 +0000 Subject: [PATCH] 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 Commit-Queue: James Price Reviewed-by: Ben Clayton --- src/ast/disable_validation_decoration.cc | 2 + src/ast/disable_validation_decoration.h | 3 + src/resolver/resolver.cc | 3 +- src/resolver/validation_test.cc | 15 +- src/transform/msl.cc | 86 +++--- src/transform/msl.h | 8 +- src/transform/msl_test.cc | 92 +++++- src/transform/transform.cc | 19 ++ src/writer/msl/generator_impl.cc | 20 +- src/writer/msl/generator_impl_type_test.cc | 2 +- test/types/sampler.wgsl | 8 + test/types/sampler.wgsl.expected.hlsl | 10 + test/types/sampler.wgsl.expected.msl | 9 + test/types/sampler.wgsl.expected.spvasm | 29 ++ test/types/sampler.wgsl.expected.wgsl | 9 + test/types/texture/depth/2d.wgsl | 6 + .../types/texture/depth/2d.wgsl.expected.hlsl | 8 + test/types/texture/depth/2d.wgsl.expected.msl | 8 + .../texture/depth/2d.wgsl.expected.spvasm | 24 ++ .../types/texture/depth/2d.wgsl.expected.wgsl | 6 + test/types/texture/depth/2d_array.wgsl | 6 + .../texture/depth/2d_array.wgsl.expected.hlsl | 8 + .../texture/depth/2d_array.wgsl.expected.msl | 8 + .../depth/2d_array.wgsl.expected.spvasm | 24 ++ .../texture/depth/2d_array.wgsl.expected.wgsl | 6 + test/types/texture/depth/cube.wgsl | 6 + .../texture/depth/cube.wgsl.expected.hlsl | 8 + .../texture/depth/cube.wgsl.expected.msl | 8 + .../texture/depth/cube.wgsl.expected.spvasm | 24 ++ .../texture/depth/cube.wgsl.expected.wgsl | 6 + test/types/texture/depth/cube_array.wgsl | 6 + .../depth/cube_array.wgsl.expected.hlsl | 8 + .../depth/cube_array.wgsl.expected.msl | 8 + .../depth/cube_array.wgsl.expected.spvasm | 25 ++ .../depth/cube_array.wgsl.expected.wgsl | 6 + test/types/texture/multisampled/2d.wgsl | 10 + .../multisampled/2d.wgsl.expected.hlsl | 12 + .../texture/multisampled/2d.wgsl.expected.msl | 10 + .../multisampled/2d.wgsl.expected.spvasm | 40 +++ .../multisampled/2d.wgsl.expected.wgsl | 12 + test/types/texture/sampled/1d.wgsl | 10 + .../texture/sampled/1d.wgsl.expected.hlsl | 12 + .../texture/sampled/1d.wgsl.expected.msl | 10 + .../texture/sampled/1d.wgsl.expected.spvasm | 41 +++ .../texture/sampled/1d.wgsl.expected.wgsl | 12 + test/types/texture/sampled/2d.wgsl | 10 + .../texture/sampled/2d.wgsl.expected.hlsl | 12 + .../texture/sampled/2d.wgsl.expected.msl | 10 + .../texture/sampled/2d.wgsl.expected.spvasm | 40 +++ .../texture/sampled/2d.wgsl.expected.wgsl | 12 + test/types/texture/sampled/2d_array.wgsl | 10 + .../sampled/2d_array.wgsl.expected.hlsl | 12 + .../sampled/2d_array.wgsl.expected.msl | 10 + .../sampled/2d_array.wgsl.expected.spvasm | 40 +++ .../sampled/2d_array.wgsl.expected.wgsl | 12 + test/types/texture/sampled/3d.wgsl | 10 + .../texture/sampled/3d.wgsl.expected.hlsl | 12 + .../texture/sampled/3d.wgsl.expected.msl | 10 + .../texture/sampled/3d.wgsl.expected.spvasm | 40 +++ .../texture/sampled/3d.wgsl.expected.wgsl | 12 + test/types/texture/sampled/cube.wgsl | 10 + .../texture/sampled/cube.wgsl.expected.hlsl | 12 + .../texture/sampled/cube.wgsl.expected.msl | 10 + .../texture/sampled/cube.wgsl.expected.spvasm | 40 +++ .../texture/sampled/cube.wgsl.expected.wgsl | 12 + test/types/texture/sampled/cube_array.wgsl | 10 + .../sampled/cube_array.wgsl.expected.hlsl | 12 + .../sampled/cube_array.wgsl.expected.msl | 10 + .../sampled/cube_array.wgsl.expected.spvasm | 41 +++ .../sampled/cube_array.wgsl.expected.wgsl | 12 + test/types/texture/storage/1d.wgsl | 68 +++++ .../texture/storage/1d.wgsl.expected.hlsl | 70 +++++ .../texture/storage/1d.wgsl.expected.msl | 39 +++ .../texture/storage/1d.wgsl.expected.spvasm | 261 ++++++++++++++++++ .../texture/storage/1d.wgsl.expected.wgsl | 99 +++++++ test/types/texture/storage/2d.wgsl | 68 +++++ .../texture/storage/2d.wgsl.expected.hlsl | 70 +++++ .../texture/storage/2d.wgsl.expected.msl | 39 +++ .../texture/storage/2d.wgsl.expected.spvasm | 260 +++++++++++++++++ .../texture/storage/2d.wgsl.expected.wgsl | 99 +++++++ test/types/texture/storage/2d_array.wgsl | 68 +++++ .../storage/2d_array.wgsl.expected.hlsl | 70 +++++ .../storage/2d_array.wgsl.expected.msl | 39 +++ .../storage/2d_array.wgsl.expected.spvasm | 260 +++++++++++++++++ .../storage/2d_array.wgsl.expected.wgsl | 99 +++++++ test/types/texture/storage/3d.wgsl | 68 +++++ .../texture/storage/3d.wgsl.expected.hlsl | 70 +++++ .../texture/storage/3d.wgsl.expected.msl | 39 +++ .../texture/storage/3d.wgsl.expected.spvasm | 260 +++++++++++++++++ .../texture/storage/3d.wgsl.expected.wgsl | 99 +++++++ 90 files changed, 3212 insertions(+), 47 deletions(-) create mode 100644 test/types/sampler.wgsl create mode 100644 test/types/sampler.wgsl.expected.hlsl create mode 100644 test/types/sampler.wgsl.expected.msl create mode 100644 test/types/sampler.wgsl.expected.spvasm create mode 100644 test/types/sampler.wgsl.expected.wgsl create mode 100644 test/types/texture/depth/2d.wgsl create mode 100644 test/types/texture/depth/2d.wgsl.expected.hlsl create mode 100644 test/types/texture/depth/2d.wgsl.expected.msl create mode 100644 test/types/texture/depth/2d.wgsl.expected.spvasm create mode 100644 test/types/texture/depth/2d.wgsl.expected.wgsl create mode 100644 test/types/texture/depth/2d_array.wgsl create mode 100644 test/types/texture/depth/2d_array.wgsl.expected.hlsl create mode 100644 test/types/texture/depth/2d_array.wgsl.expected.msl create mode 100644 test/types/texture/depth/2d_array.wgsl.expected.spvasm create mode 100644 test/types/texture/depth/2d_array.wgsl.expected.wgsl create mode 100644 test/types/texture/depth/cube.wgsl create mode 100644 test/types/texture/depth/cube.wgsl.expected.hlsl create mode 100644 test/types/texture/depth/cube.wgsl.expected.msl create mode 100644 test/types/texture/depth/cube.wgsl.expected.spvasm create mode 100644 test/types/texture/depth/cube.wgsl.expected.wgsl create mode 100644 test/types/texture/depth/cube_array.wgsl create mode 100644 test/types/texture/depth/cube_array.wgsl.expected.hlsl create mode 100644 test/types/texture/depth/cube_array.wgsl.expected.msl create mode 100644 test/types/texture/depth/cube_array.wgsl.expected.spvasm create mode 100644 test/types/texture/depth/cube_array.wgsl.expected.wgsl create mode 100644 test/types/texture/multisampled/2d.wgsl create mode 100644 test/types/texture/multisampled/2d.wgsl.expected.hlsl create mode 100644 test/types/texture/multisampled/2d.wgsl.expected.msl create mode 100644 test/types/texture/multisampled/2d.wgsl.expected.spvasm create mode 100644 test/types/texture/multisampled/2d.wgsl.expected.wgsl create mode 100644 test/types/texture/sampled/1d.wgsl create mode 100644 test/types/texture/sampled/1d.wgsl.expected.hlsl create mode 100644 test/types/texture/sampled/1d.wgsl.expected.msl create mode 100644 test/types/texture/sampled/1d.wgsl.expected.spvasm create mode 100644 test/types/texture/sampled/1d.wgsl.expected.wgsl create mode 100644 test/types/texture/sampled/2d.wgsl create mode 100644 test/types/texture/sampled/2d.wgsl.expected.hlsl create mode 100644 test/types/texture/sampled/2d.wgsl.expected.msl create mode 100644 test/types/texture/sampled/2d.wgsl.expected.spvasm create mode 100644 test/types/texture/sampled/2d.wgsl.expected.wgsl create mode 100644 test/types/texture/sampled/2d_array.wgsl create mode 100644 test/types/texture/sampled/2d_array.wgsl.expected.hlsl create mode 100644 test/types/texture/sampled/2d_array.wgsl.expected.msl create mode 100644 test/types/texture/sampled/2d_array.wgsl.expected.spvasm create mode 100644 test/types/texture/sampled/2d_array.wgsl.expected.wgsl create mode 100644 test/types/texture/sampled/3d.wgsl create mode 100644 test/types/texture/sampled/3d.wgsl.expected.hlsl create mode 100644 test/types/texture/sampled/3d.wgsl.expected.msl create mode 100644 test/types/texture/sampled/3d.wgsl.expected.spvasm create mode 100644 test/types/texture/sampled/3d.wgsl.expected.wgsl create mode 100644 test/types/texture/sampled/cube.wgsl create mode 100644 test/types/texture/sampled/cube.wgsl.expected.hlsl create mode 100644 test/types/texture/sampled/cube.wgsl.expected.msl create mode 100644 test/types/texture/sampled/cube.wgsl.expected.spvasm create mode 100644 test/types/texture/sampled/cube.wgsl.expected.wgsl create mode 100644 test/types/texture/sampled/cube_array.wgsl create mode 100644 test/types/texture/sampled/cube_array.wgsl.expected.hlsl create mode 100644 test/types/texture/sampled/cube_array.wgsl.expected.msl create mode 100644 test/types/texture/sampled/cube_array.wgsl.expected.spvasm create mode 100644 test/types/texture/sampled/cube_array.wgsl.expected.wgsl create mode 100644 test/types/texture/storage/1d.wgsl create mode 100644 test/types/texture/storage/1d.wgsl.expected.hlsl create mode 100644 test/types/texture/storage/1d.wgsl.expected.msl create mode 100644 test/types/texture/storage/1d.wgsl.expected.spvasm create mode 100644 test/types/texture/storage/1d.wgsl.expected.wgsl create mode 100644 test/types/texture/storage/2d.wgsl create mode 100644 test/types/texture/storage/2d.wgsl.expected.hlsl create mode 100644 test/types/texture/storage/2d.wgsl.expected.msl create mode 100644 test/types/texture/storage/2d.wgsl.expected.spvasm create mode 100644 test/types/texture/storage/2d.wgsl.expected.wgsl create mode 100644 test/types/texture/storage/2d_array.wgsl create mode 100644 test/types/texture/storage/2d_array.wgsl.expected.hlsl create mode 100644 test/types/texture/storage/2d_array.wgsl.expected.msl create mode 100644 test/types/texture/storage/2d_array.wgsl.expected.spvasm create mode 100644 test/types/texture/storage/2d_array.wgsl.expected.wgsl create mode 100644 test/types/texture/storage/3d.wgsl create mode 100644 test/types/texture/storage/3d.wgsl.expected.hlsl create mode 100644 test/types/texture/storage/3d.wgsl.expected.msl create mode 100644 test/types/texture/storage/3d.wgsl.expected.spvasm create mode 100644 test/types/texture/storage/3d.wgsl.expected.wgsl diff --git a/src/ast/disable_validation_decoration.cc b/src/ast/disable_validation_decoration.cc index d71851d2e2..a8786e04ec 100644 --- a/src/ast/disable_validation_decoration.cc +++ b/src/ast/disable_validation_decoration.cc @@ -36,6 +36,8 @@ std::string DisableValidationDecoration::InternalName() const { return "disable_validation__binding_point_collision"; case DisabledValidation::kFunctionVarStorageClass: return "disable_validation__function_var_storage_class"; + case DisabledValidation::kEntryPointParameter: + return "disable_validation__entry_point_parameter"; } return ""; } diff --git a/src/ast/disable_validation_decoration.h b/src/ast/disable_validation_decoration.h index 8f6ecd22e2..344dc7ecdf 100644 --- a/src/ast/disable_validation_decoration.h +++ b/src/ast/disable_validation_decoration.h @@ -34,6 +34,9 @@ enum class DisabledValidation { /// When applied to a function-scoped variable, the validator will not /// complain if the storage class is not `function`. kFunctionVarStorageClass, + /// When applied to an entry-point function parameter, the validator will not + /// check for entry IO decorations. + kEntryPointParameter, }; /// An internal decoration used to tell the validator to ignore specific diff --git a/src/resolver/resolver.cc b/src/resolver/resolver.cc index 2cf6ccd73a..3dcc3106e7 100644 --- a/src/resolver/resolver.cc +++ b/src/resolver/resolver.cc @@ -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) { diff --git a/src/resolver/validation_test.cc b/src/resolver/validation_test.cc index 25ce629c97..950c780586 100644 --- a/src/resolver/validation_test.cc +++ b/src/resolver/validation_test.cc @@ -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, diff --git a/src/transform/msl.cc b/src/transform/msl.cc index f2ad35a0a1..ab4ad5412b 100644 --- a/src/transform/msl.cc +++ b/src/transform/msl.cc @@ -52,15 +52,17 @@ Output Msl::Run(const Program* in, const DataMap&) { CloneContext ctx(&builder, &out.program); // TODO(jrprice): Consider making this a standalone transform, with target // storage class(es) as transform options. - HandlePrivateAndWorkgroupVariables(ctx); + HandleModuleScopeVariables(ctx); ctx.Clone(); return Output{Program(std::move(builder))}; } -void Msl::HandlePrivateAndWorkgroupVariables(CloneContext& ctx) const { +void Msl::HandleModuleScopeVariables(CloneContext& ctx) const { // MSL does not allow private and workgroup variables at module-scope, so we // push these declarations into the entry point function and then pass them as // pointer parameters to any function that references them. + // Similarly, texture and sampler types are converted to entry point + // parameters and passed by value to functions that need them. // // Since WGSL does not allow function-scope variables to have these storage // classes, we annotate the new variable declarations with an attribute that @@ -100,14 +102,15 @@ void Msl::HandlePrivateAndWorkgroupVariables(CloneContext& ctx) const { std::vector functions_to_process; // Build a list of functions that transitively reference any private or - // workgroup variables. + // workgroup variables, or texture/sampler variables. for (auto* func_ast : ctx.src->AST().Functions()) { auto* func_sem = ctx.src->Sem().Get(func_ast); bool needs_processing = false; for (auto* var : func_sem->ReferencedModuleVariables()) { if (var->StorageClass() == ast::StorageClass::kPrivate || - var->StorageClass() == ast::StorageClass::kWorkgroup) { + var->StorageClass() == ast::StorageClass::kWorkgroup || + var->StorageClass() == ast::StorageClass::kUniformConstant) { needs_processing = true; break; } @@ -133,7 +136,8 @@ void Msl::HandlePrivateAndWorkgroupVariables(CloneContext& ctx) const { for (auto* var : func_sem->ReferencedModuleVariables()) { if (var->StorageClass() != ast::StorageClass::kPrivate && - var->StorageClass() != ast::StorageClass::kWorkgroup) { + var->StorageClass() != ast::StorageClass::kWorkgroup && + var->StorageClass() != ast::StorageClass::kUniformConstant) { continue; } @@ -143,32 +147,47 @@ void Msl::HandlePrivateAndWorkgroupVariables(CloneContext& ctx) const { auto* store_type = CreateASTTypeFor(&ctx, var->Type()->UnwrapRef()); if (is_entry_point) { - // For an entry point, redeclare the variable at function-scope. - // Disable storage class validation on this variable. - auto* disable_validation = - ctx.dst->ASTNodes().Create( - ctx.dst->ID(), - ast::DisabledValidation::kFunctionVarStorageClass); - auto* constructor = ctx.Clone(var->Declaration()->constructor()); - auto* local_var = - ctx.dst->Var(new_var_symbol, store_type, var->StorageClass(), - constructor, ast::DecorationList{disable_validation}); - ctx.InsertBefore(func_ast->body()->statements(), - *func_ast->body()->begin(), ctx.dst->Decl(local_var)); + if (store_type->is_handle()) { + // For a texture or sampler variable, redeclare it as an entry point + // parameter. Disable entry point parameter validation. + auto* disable_validation = + ctx.dst->ASTNodes().Create( + ctx.dst->ID(), ast::DisabledValidation::kEntryPointParameter); + auto decos = ctx.Clone(var->Declaration()->decorations()); + decos.push_back(disable_validation); + auto* param = ctx.dst->Param(new_var_symbol, store_type, decos); + ctx.InsertFront(func_ast->params(), param); + } else { + // For a private or workgroup variable, redeclare it at function + // scope. Disable storage class validation on this variable. + auto* disable_validation = + ctx.dst->ASTNodes().Create( + ctx.dst->ID(), + ast::DisabledValidation::kFunctionVarStorageClass); + auto* constructor = ctx.Clone(var->Declaration()->constructor()); + auto* local_var = ctx.dst->Var(new_var_symbol, store_type, + var->StorageClass(), constructor, + ast::DecorationList{disable_validation}); + ctx.InsertFront(func_ast->body()->statements(), + ctx.dst->Decl(local_var)); + } } else { - // For a regular function, redeclare the variable as a pointer function - // parameter. - auto* ptr_type = ctx.dst->ty.pointer(store_type, var->StorageClass()); + // For a regular function, redeclare the variable as a parameter. + // Use a pointer for non-handle types. + auto* param_type = store_type; + if (!store_type->is_handle()) { + param_type = ctx.dst->ty.pointer(param_type, var->StorageClass()); + } ctx.InsertBack(func_ast->params(), - ctx.dst->Param(new_var_symbol, ptr_type)); + ctx.dst->Param(new_var_symbol, param_type)); } // Replace all uses of the module-scope variable. + // For non-entry points, dereference non-handle pointer parameters. for (auto* user : var->Users()) { if (user->Stmt()->Function() == func_ast) { ast::Expression* expr = ctx.dst->Expr(new_var_symbol); - if (!is_entry_point) { - // For non-entry points, dereference the pointer argument. + if (!is_entry_point && !store_type->is_handle()) { expr = ctx.dst->Deref(expr); } ctx.Replace(user->Declaration(), expr); @@ -183,13 +202,14 @@ void Msl::HandlePrivateAndWorkgroupVariables(CloneContext& ctx) const { auto* target = ctx.src->AST().Functions().Find(call->func()->symbol()); auto* target_sem = ctx.src->Sem().Get(target); - // Add new arguments for any referenced private and workgroup variables. + // Add new arguments for any variables that are needed by the callee. + // For entry points, pass non-handle types as pointers. for (auto* target_var : target_sem->ReferencedModuleVariables()) { if (target_var->StorageClass() == ast::StorageClass::kPrivate || - target_var->StorageClass() == ast::StorageClass::kWorkgroup) { + target_var->StorageClass() == ast::StorageClass::kWorkgroup || + target_var->StorageClass() == ast::StorageClass::kUniformConstant) { ast::Expression* arg = ctx.dst->Expr(var_to_symbol[target_var]); - if (is_entry_point) { - // For entry points, pass the address of the variable. + if (is_entry_point && !target_var->Type()->UnwrapRef()->is_handle()) { arg = ctx.dst->AddressOf(arg); } ctx.InsertBack(call->params(), arg); @@ -198,11 +218,13 @@ void Msl::HandlePrivateAndWorkgroupVariables(CloneContext& ctx) const { } } - // Now remove all module-scope private and workgroup variables. - for (auto* var : ctx.src->AST().GlobalVariables()) { - if (var->declared_storage_class() == ast::StorageClass::kPrivate || - var->declared_storage_class() == ast::StorageClass::kWorkgroup) { - ctx.Remove(ctx.src->AST().GlobalDeclarations(), var); + // Now remove all module-scope variables with these storage classes. + for (auto* var_ast : ctx.src->AST().GlobalVariables()) { + auto* var_sem = ctx.src->Sem().Get(var_ast); + if (var_sem->StorageClass() == ast::StorageClass::kPrivate || + var_sem->StorageClass() == ast::StorageClass::kWorkgroup || + var_sem->StorageClass() == ast::StorageClass::kUniformConstant) { + ctx.Remove(ctx.src->AST().GlobalDeclarations(), var_ast); } } } diff --git a/src/transform/msl.h b/src/transform/msl.h index 7e83032ee2..01ccb1a64d 100644 --- a/src/transform/msl.h +++ b/src/transform/msl.h @@ -36,10 +36,10 @@ class Msl : public Transform { Output Run(const Program* program, const DataMap& data = {}) override; private: - /// Pushes module-scope variables with private or workgroup storage classes - /// into the entry point function, and passes them as function parameters to - /// any functions that need them. - void HandlePrivateAndWorkgroupVariables(CloneContext& ctx) const; + /// Pushes module-scope variables with certain storage classes into the entry + /// point function, and passes them as function parameters to any functions + /// that need them. + void HandleModuleScopeVariables(CloneContext& ctx) const; }; } // namespace transform diff --git a/src/transform/msl_test.cc b/src/transform/msl_test.cc index d0706790fa..21553f2821 100644 --- a/src/transform/msl_test.cc +++ b/src/transform/msl_test.cc @@ -22,7 +22,7 @@ namespace { using MslTest = TransformTest; -TEST_F(MslTest, HandlePrivateAndWorkgroupVariables_Basic) { +TEST_F(MslTest, HandleModuleScopeVariables_Basic) { auto* src = R"( var p : f32; var w : f32; @@ -47,7 +47,7 @@ fn main() { EXPECT_EQ(expect, str(got)); } -TEST_F(MslTest, HandlePrivateAndWorkgroupVariables_FunctionCalls) { +TEST_F(MslTest, HandleModuleScopeVariables_FunctionCalls) { auto* src = R"( var p : f32; var w : f32; @@ -100,7 +100,7 @@ fn main() { EXPECT_EQ(expect, str(got)); } -TEST_F(MslTest, HandlePrivateAndWorkgroupVariables_Constructors) { +TEST_F(MslTest, HandleModuleScopeVariables_Constructors) { auto* src = R"( var a : f32 = 1.0; var b : f32 = f32(); @@ -125,7 +125,7 @@ fn main() { EXPECT_EQ(expect, str(got)); } -TEST_F(MslTest, HandlePrivateAndWorkgroupVariables_Pointers) { +TEST_F(MslTest, HandleModuleScopeVariables_Pointers) { auto* src = R"( var p : f32; var w : f32; @@ -156,7 +156,7 @@ fn main() { EXPECT_EQ(expect, str(got)); } -TEST_F(MslTest, HandlePrivateAndWorkgroupVariables_UnusedVariables) { +TEST_F(MslTest, HandleModuleScopeVariables_UnusedVariables) { auto* src = R"( var p : f32; var w : f32; @@ -177,7 +177,7 @@ fn main() { EXPECT_EQ(expect, str(got)); } -TEST_F(MslTest, HandlePrivateAndWorkgroupVariables_OtherVariables) { +TEST_F(MslTest, HandleModuleScopeVariables_OtherVariables) { auto* src = R"( [[block]] struct S { @@ -208,7 +208,85 @@ fn main() { EXPECT_EQ(expect, str(got)); } -TEST_F(MslTest, HandlePrivateAndWorkgroupVariables_EmtpyModule) { +TEST_F(MslTest, HandleModuleScopeVariables_HandleTypes_Basic) { + auto* src = R"( +[[group(0), binding(0)]] var t : texture_2d; +[[group(0), binding(1)]] var s : sampler; + +[[stage(compute)]] +fn main() { + ignore(t); + ignore(s); +} +)"; + + auto* expect = R"( +[[stage(compute)]] +fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter)]] tint_symbol : texture_2d, [[group(0), binding(1), internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : sampler) { + ignore(tint_symbol); + ignore(tint_symbol_1); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(MslTest, HandleModuleScopeVariables_HandleTypes_FunctionCalls) { + auto* src = R"( +[[group(0), binding(0)]] var t : texture_2d; +[[group(0), binding(1)]] var s : sampler; + +fn no_uses() { +} + +fn bar(a : f32, b : f32) { + ignore(t); + ignore(s); +} + +fn foo(a : f32) { + let b : f32 = 2.0; + ignore(t); + bar(a, b); + no_uses(); +} + +[[stage(compute)]] +fn main() { + foo(1.0); +} +)"; + + auto* expect = R"( +fn no_uses() { +} + +fn bar(a : f32, b : f32, tint_symbol : texture_2d, tint_symbol_1 : sampler) { + ignore(tint_symbol); + ignore(tint_symbol_1); +} + +fn foo(a : f32, tint_symbol_2 : texture_2d, tint_symbol_3 : sampler) { + let b : f32 = 2.0; + ignore(tint_symbol_2); + bar(a, b, tint_symbol_2, tint_symbol_3); + no_uses(); +} + +[[stage(compute)]] +fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter)]] tint_symbol_4 : texture_2d, [[group(0), binding(1), internal(disable_validation__entry_point_parameter)]] tint_symbol_5 : sampler) { + foo(1.0, tint_symbol_4, tint_symbol_5); +} +)"; + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(MslTest, HandleModuleScopeVariables_EmtpyModule) { auto* src = ""; auto got = Run(src); diff --git a/src/transform/transform.cc b/src/transform/transform.cc index f2884518f8..2fbe85d169 100644 --- a/src/transform/transform.cc +++ b/src/transform/transform.cc @@ -111,6 +111,25 @@ ast::Type* Transform::CreateASTTypeFor(CloneContext* ctx, const sem::Type* ty) { if (auto* s = ty->As()) { return CreateASTTypeFor(ctx, s->StoreType()); } + if (auto* t = ty->As()) { + return ctx->dst->create(t->dim()); + } + if (auto* t = ty->As()) { + return ctx->dst->create( + t->dim(), CreateASTTypeFor(ctx, t->type())); + } + if (auto* t = ty->As()) { + return ctx->dst->create( + t->dim(), CreateASTTypeFor(ctx, t->type())); + } + if (auto* t = ty->As()) { + return ctx->dst->create( + t->dim(), t->image_format(), CreateASTTypeFor(ctx, t->type()), + t->access()); + } + if (auto* s = ty->As()) { + return ctx->dst->create(s->kind()); + } TINT_UNREACHABLE(ctx->dst->Diagnostics()) << "Unhandled type: " << ty->TypeInfo().name; return nullptr; diff --git a/src/writer/msl/generator_impl.cc b/src/writer/msl/generator_impl.cc index 945fa8b7d2..08982b9341 100644 --- a/src/writer/msl/generator_impl.cc +++ b/src/writer/msl/generator_impl.cc @@ -1470,6 +1470,22 @@ bool GeneratorImpl::EmitEntryPointFunction(ast::Function* func) { if (type->Is()) { out_ << " [[stage_in]]"; + } else if (var->type()->is_handle()) { + auto* binding = + ast::GetDecoration(var->decorations()); + if (binding == nullptr) { + TINT_ICE(diagnostics_) + << "missing binding attribute for entry point parameter"; + return false; + } + if (var->type()->Is()) { + out_ << " [[sampler(" << binding->value() << ")]]"; + } else if (var->type()->Is()) { + out_ << " [[texture(" << binding->value() << ")]]"; + } else { + TINT_ICE(diagnostics_) << "invalid handle type entry point parameter"; + return false; + } } else { auto& decos = var->decorations(); bool builtin_found = false; @@ -1982,6 +1998,7 @@ bool GeneratorImpl::EmitType(const sem::Type* type, const std::string& name) { switch (ptr->StorageClass()) { case ast::StorageClass::kFunction: case ast::StorageClass::kPrivate: + case ast::StorageClass::kUniformConstant: out_ << "thread "; break; case ast::StorageClass::kWorkgroup: @@ -2068,7 +2085,7 @@ bool GeneratorImpl::EmitType(const sem::Type* type, const std::string& name) { if (!EmitType(ms->type(), "")) { return false; } - out_ << ", access::sample"; + out_ << ", access::read"; } else if (auto* sampled = tex->As()) { if (!EmitType(sampled->type(), "")) { return false; @@ -2292,6 +2309,7 @@ bool GeneratorImpl::EmitVariable(const sem::Variable* var, switch (var->StorageClass()) { case ast::StorageClass::kFunction: + case ast::StorageClass::kUniformConstant: case ast::StorageClass::kNone: break; case ast::StorageClass::kPrivate: diff --git a/src/writer/msl/generator_impl_type_test.cc b/src/writer/msl/generator_impl_type_test.cc index 349995a0e5..a62ea72a47 100644 --- a/src/writer/msl/generator_impl_type_test.cc +++ b/src/writer/msl/generator_impl_type_test.cc @@ -751,7 +751,7 @@ TEST_F(MslGeneratorImplTest, Emit_TypeMultisampledTexture) { GeneratorImpl& gen = Build(); ASSERT_TRUE(gen.EmitType(ms, "")) << gen.error(); - EXPECT_EQ(gen.result(), "texture2d_ms"); + EXPECT_EQ(gen.result(), "texture2d_ms"); } struct MslStorageTextureData { diff --git a/test/types/sampler.wgsl b/test/types/sampler.wgsl new file mode 100644 index 0000000000..7f3bf63821 --- /dev/null +++ b/test/types/sampler.wgsl @@ -0,0 +1,8 @@ +[[group(0), binding(0)]] var s : sampler; +[[group(0), binding(1)]] var sc : sampler_comparison; + +[[stage(compute)]] +fn main() { + ignore(s); + ignore(sc); +} diff --git a/test/types/sampler.wgsl.expected.hlsl b/test/types/sampler.wgsl.expected.hlsl new file mode 100644 index 0000000000..e0a2587da4 --- /dev/null +++ b/test/types/sampler.wgsl.expected.hlsl @@ -0,0 +1,10 @@ +SamplerState s : register(s0, space0); +SamplerComparisonState sc : register(s1, space0); + +[numthreads(1, 1, 1)] +void main() { + s; + sc; + return; +} + diff --git a/test/types/sampler.wgsl.expected.msl b/test/types/sampler.wgsl.expected.msl new file mode 100644 index 0000000000..0343299b79 --- /dev/null +++ b/test/types/sampler.wgsl.expected.msl @@ -0,0 +1,9 @@ +#include + +using namespace metal; +kernel void tint_symbol(sampler tint_symbol_1 [[sampler(0)]], sampler tint_symbol_2 [[sampler(1)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + return; +} + diff --git a/test/types/sampler.wgsl.expected.spvasm b/test/types/sampler.wgsl.expected.spvasm new file mode 100644 index 0000000000..c96735e272 --- /dev/null +++ b/test/types/sampler.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %s "s" + OpName %sc "sc" + OpName %main "main" + OpDecorate %s DescriptorSet 0 + OpDecorate %s Binding 0 + OpDecorate %sc DescriptorSet 0 + OpDecorate %sc Binding 1 + %3 = OpTypeSampler +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %s = OpVariable %_ptr_UniformConstant_3 UniformConstant +%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3 + %sc = OpVariable %_ptr_UniformConstant_3_0 UniformConstant + %void = OpTypeVoid + %6 = OpTypeFunction %void + %main = OpFunction %void None %6 + %9 = OpLabel + %11 = OpLoad %3 %s + %13 = OpLoad %3 %sc + OpReturn + OpFunctionEnd diff --git a/test/types/sampler.wgsl.expected.wgsl b/test/types/sampler.wgsl.expected.wgsl new file mode 100644 index 0000000000..9efada7fcd --- /dev/null +++ b/test/types/sampler.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +[[group(0), binding(0)]] var s : sampler; + +[[group(0), binding(1)]] var sc : sampler_comparison; + +[[stage(compute)]] +fn main() { + ignore(s); + ignore(sc); +} diff --git a/test/types/texture/depth/2d.wgsl b/test/types/texture/depth/2d.wgsl new file mode 100644 index 0000000000..4e6051a1dc --- /dev/null +++ b/test/types/texture/depth/2d.wgsl @@ -0,0 +1,6 @@ +[[group(0), binding(0)]] var t_f : texture_depth_2d; + +[[stage(compute)]] +fn main() { + ignore(t_f); +} diff --git a/test/types/texture/depth/2d.wgsl.expected.hlsl b/test/types/texture/depth/2d.wgsl.expected.hlsl new file mode 100644 index 0000000000..7d3a6a02ff --- /dev/null +++ b/test/types/texture/depth/2d.wgsl.expected.hlsl @@ -0,0 +1,8 @@ +Texture2D t_f : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + return; +} + diff --git a/test/types/texture/depth/2d.wgsl.expected.msl b/test/types/texture/depth/2d.wgsl.expected.msl new file mode 100644 index 0000000000..f2ed0a5b50 --- /dev/null +++ b/test/types/texture/depth/2d.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +kernel void tint_symbol(depth2d tint_symbol_1 [[texture(0)]]) { + (void) tint_symbol_1; + return; +} + diff --git a/test/types/texture/depth/2d.wgsl.expected.spvasm b/test/types/texture/depth/2d.wgsl.expected.spvasm new file mode 100644 index 0000000000..20772bcbb2 --- /dev/null +++ b/test/types/texture/depth/2d.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 1 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %void = OpTypeVoid + %5 = OpTypeFunction %void + %main = OpFunction %void None %5 + %8 = OpLabel + %10 = OpLoad %3 %t_f + OpReturn + OpFunctionEnd diff --git a/test/types/texture/depth/2d.wgsl.expected.wgsl b/test/types/texture/depth/2d.wgsl.expected.wgsl new file mode 100644 index 0000000000..4e6051a1dc --- /dev/null +++ b/test/types/texture/depth/2d.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +[[group(0), binding(0)]] var t_f : texture_depth_2d; + +[[stage(compute)]] +fn main() { + ignore(t_f); +} diff --git a/test/types/texture/depth/2d_array.wgsl b/test/types/texture/depth/2d_array.wgsl new file mode 100644 index 0000000000..99c49ac6c0 --- /dev/null +++ b/test/types/texture/depth/2d_array.wgsl @@ -0,0 +1,6 @@ +[[group(0), binding(0)]] var t_f : texture_depth_2d_array; + +[[stage(compute)]] +fn main() { + ignore(t_f); +} diff --git a/test/types/texture/depth/2d_array.wgsl.expected.hlsl b/test/types/texture/depth/2d_array.wgsl.expected.hlsl new file mode 100644 index 0000000000..7cac50ad4d --- /dev/null +++ b/test/types/texture/depth/2d_array.wgsl.expected.hlsl @@ -0,0 +1,8 @@ +Texture2DArray t_f : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + return; +} + diff --git a/test/types/texture/depth/2d_array.wgsl.expected.msl b/test/types/texture/depth/2d_array.wgsl.expected.msl new file mode 100644 index 0000000000..17a9b9712e --- /dev/null +++ b/test/types/texture/depth/2d_array.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +kernel void tint_symbol(depth2d_array tint_symbol_1 [[texture(0)]]) { + (void) tint_symbol_1; + return; +} + diff --git a/test/types/texture/depth/2d_array.wgsl.expected.spvasm b/test/types/texture/depth/2d_array.wgsl.expected.spvasm new file mode 100644 index 0000000000..ef06878a41 --- /dev/null +++ b/test/types/texture/depth/2d_array.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 1 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %void = OpTypeVoid + %5 = OpTypeFunction %void + %main = OpFunction %void None %5 + %8 = OpLabel + %10 = OpLoad %3 %t_f + OpReturn + OpFunctionEnd diff --git a/test/types/texture/depth/2d_array.wgsl.expected.wgsl b/test/types/texture/depth/2d_array.wgsl.expected.wgsl new file mode 100644 index 0000000000..99c49ac6c0 --- /dev/null +++ b/test/types/texture/depth/2d_array.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +[[group(0), binding(0)]] var t_f : texture_depth_2d_array; + +[[stage(compute)]] +fn main() { + ignore(t_f); +} diff --git a/test/types/texture/depth/cube.wgsl b/test/types/texture/depth/cube.wgsl new file mode 100644 index 0000000000..57c3453c54 --- /dev/null +++ b/test/types/texture/depth/cube.wgsl @@ -0,0 +1,6 @@ +[[group(0), binding(0)]] var t_f : texture_depth_cube; + +[[stage(compute)]] +fn main() { + ignore(t_f); +} diff --git a/test/types/texture/depth/cube.wgsl.expected.hlsl b/test/types/texture/depth/cube.wgsl.expected.hlsl new file mode 100644 index 0000000000..4769d3ee98 --- /dev/null +++ b/test/types/texture/depth/cube.wgsl.expected.hlsl @@ -0,0 +1,8 @@ +TextureCube t_f : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + return; +} + diff --git a/test/types/texture/depth/cube.wgsl.expected.msl b/test/types/texture/depth/cube.wgsl.expected.msl new file mode 100644 index 0000000000..ebc911a024 --- /dev/null +++ b/test/types/texture/depth/cube.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +kernel void tint_symbol(depthcube tint_symbol_1 [[texture(0)]]) { + (void) tint_symbol_1; + return; +} + diff --git a/test/types/texture/depth/cube.wgsl.expected.spvasm b/test/types/texture/depth/cube.wgsl.expected.spvasm new file mode 100644 index 0000000000..980a03635f --- /dev/null +++ b/test/types/texture/depth/cube.wgsl.expected.spvasm @@ -0,0 +1,24 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 1 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %void = OpTypeVoid + %5 = OpTypeFunction %void + %main = OpFunction %void None %5 + %8 = OpLabel + %10 = OpLoad %3 %t_f + OpReturn + OpFunctionEnd diff --git a/test/types/texture/depth/cube.wgsl.expected.wgsl b/test/types/texture/depth/cube.wgsl.expected.wgsl new file mode 100644 index 0000000000..57c3453c54 --- /dev/null +++ b/test/types/texture/depth/cube.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +[[group(0), binding(0)]] var t_f : texture_depth_cube; + +[[stage(compute)]] +fn main() { + ignore(t_f); +} diff --git a/test/types/texture/depth/cube_array.wgsl b/test/types/texture/depth/cube_array.wgsl new file mode 100644 index 0000000000..2f768d05b8 --- /dev/null +++ b/test/types/texture/depth/cube_array.wgsl @@ -0,0 +1,6 @@ +[[group(0), binding(0)]] var t_f : texture_depth_cube_array; + +[[stage(compute)]] +fn main() { + ignore(t_f); +} diff --git a/test/types/texture/depth/cube_array.wgsl.expected.hlsl b/test/types/texture/depth/cube_array.wgsl.expected.hlsl new file mode 100644 index 0000000000..a43e5303d7 --- /dev/null +++ b/test/types/texture/depth/cube_array.wgsl.expected.hlsl @@ -0,0 +1,8 @@ +TextureCubeArray t_f : register(t0, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + return; +} + diff --git a/test/types/texture/depth/cube_array.wgsl.expected.msl b/test/types/texture/depth/cube_array.wgsl.expected.msl new file mode 100644 index 0000000000..12aa4c08f2 --- /dev/null +++ b/test/types/texture/depth/cube_array.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +kernel void tint_symbol(depthcube_array tint_symbol_1 [[texture(0)]]) { + (void) tint_symbol_1; + return; +} + diff --git a/test/types/texture/depth/cube_array.wgsl.expected.spvasm b/test/types/texture/depth/cube_array.wgsl.expected.spvasm new file mode 100644 index 0000000000..7e8feb767f --- /dev/null +++ b/test/types/texture/depth/cube_array.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 1 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %void = OpTypeVoid + %5 = OpTypeFunction %void + %main = OpFunction %void None %5 + %8 = OpLabel + %10 = OpLoad %3 %t_f + OpReturn + OpFunctionEnd diff --git a/test/types/texture/depth/cube_array.wgsl.expected.wgsl b/test/types/texture/depth/cube_array.wgsl.expected.wgsl new file mode 100644 index 0000000000..2f768d05b8 --- /dev/null +++ b/test/types/texture/depth/cube_array.wgsl.expected.wgsl @@ -0,0 +1,6 @@ +[[group(0), binding(0)]] var t_f : texture_depth_cube_array; + +[[stage(compute)]] +fn main() { + ignore(t_f); +} diff --git a/test/types/texture/multisampled/2d.wgsl b/test/types/texture/multisampled/2d.wgsl new file mode 100644 index 0000000000..a79feb02fe --- /dev/null +++ b/test/types/texture/multisampled/2d.wgsl @@ -0,0 +1,10 @@ +[[group(0), binding(0)]] var t_f : texture_multisampled_2d; +[[group(0), binding(1)]] var t_i : texture_multisampled_2d; +[[group(0), binding(2)]] var t_u : texture_multisampled_2d; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/multisampled/2d.wgsl.expected.hlsl b/test/types/texture/multisampled/2d.wgsl.expected.hlsl new file mode 100644 index 0000000000..d3a9b4e8ef --- /dev/null +++ b/test/types/texture/multisampled/2d.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture2DMS t_f : register(t0, space0); +Texture2DMS t_i : register(t1, space0); +Texture2DMS t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + t_i; + t_u; + return; +} + diff --git a/test/types/texture/multisampled/2d.wgsl.expected.msl b/test/types/texture/multisampled/2d.wgsl.expected.msl new file mode 100644 index 0000000000..ea479ebe95 --- /dev/null +++ b/test/types/texture/multisampled/2d.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void tint_symbol(texture2d_ms tint_symbol_1 [[texture(0)]], texture2d_ms tint_symbol_2 [[texture(1)]], texture2d_ms tint_symbol_3 [[texture(2)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + return; +} + diff --git a/test/types/texture/multisampled/2d.wgsl.expected.spvasm b/test/types/texture/multisampled/2d.wgsl.expected.spvasm new file mode 100644 index 0000000000..fb8eb65a72 --- /dev/null +++ b/test/types/texture/multisampled/2d.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %t_i "t_i" + OpName %t_u "t_u" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + OpDecorate %t_i DescriptorSet 0 + OpDecorate %t_i Binding 1 + OpDecorate %t_u DescriptorSet 0 + OpDecorate %t_u Binding 2 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %int = OpTypeInt 32 1 + %7 = OpTypeImage %int 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %t_i = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %t_u = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %main = OpFunction %void None %13 + %16 = OpLabel + %18 = OpLoad %3 %t_f + %20 = OpLoad %7 %t_i + %22 = OpLoad %11 %t_u + OpReturn + OpFunctionEnd diff --git a/test/types/texture/multisampled/2d.wgsl.expected.wgsl b/test/types/texture/multisampled/2d.wgsl.expected.wgsl new file mode 100644 index 0000000000..1aa76404d9 --- /dev/null +++ b/test/types/texture/multisampled/2d.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +[[group(0), binding(0)]] var t_f : texture_multisampled_2d; + +[[group(0), binding(1)]] var t_i : texture_multisampled_2d; + +[[group(0), binding(2)]] var t_u : texture_multisampled_2d; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/1d.wgsl b/test/types/texture/sampled/1d.wgsl new file mode 100644 index 0000000000..7c1faac9dc --- /dev/null +++ b/test/types/texture/sampled/1d.wgsl @@ -0,0 +1,10 @@ +[[group(0), binding(0)]] var t_f : texture_1d; +[[group(0), binding(1)]] var t_i : texture_1d; +[[group(0), binding(2)]] var t_u : texture_1d; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/1d.wgsl.expected.hlsl b/test/types/texture/sampled/1d.wgsl.expected.hlsl new file mode 100644 index 0000000000..dde48213c5 --- /dev/null +++ b/test/types/texture/sampled/1d.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture1D t_f : register(t0, space0); +Texture1D t_i : register(t1, space0); +Texture1D t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + t_i; + t_u; + return; +} + diff --git a/test/types/texture/sampled/1d.wgsl.expected.msl b/test/types/texture/sampled/1d.wgsl.expected.msl new file mode 100644 index 0000000000..62d00a2161 --- /dev/null +++ b/test/types/texture/sampled/1d.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void tint_symbol(texture1d tint_symbol_1 [[texture(0)]], texture1d tint_symbol_2 [[texture(1)]], texture1d tint_symbol_3 [[texture(2)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + return; +} + diff --git a/test/types/texture/sampled/1d.wgsl.expected.spvasm b/test/types/texture/sampled/1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..d6de88cb49 --- /dev/null +++ b/test/types/texture/sampled/1d.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %t_i "t_i" + OpName %t_u "t_u" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + OpDecorate %t_i DescriptorSet 0 + OpDecorate %t_i Binding 1 + OpDecorate %t_u DescriptorSet 0 + OpDecorate %t_u Binding 2 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %int = OpTypeInt 32 1 + %7 = OpTypeImage %int 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %t_i = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %t_u = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %main = OpFunction %void None %13 + %16 = OpLabel + %18 = OpLoad %3 %t_f + %20 = OpLoad %7 %t_i + %22 = OpLoad %11 %t_u + OpReturn + OpFunctionEnd diff --git a/test/types/texture/sampled/1d.wgsl.expected.wgsl b/test/types/texture/sampled/1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc1494ad09 --- /dev/null +++ b/test/types/texture/sampled/1d.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +[[group(0), binding(0)]] var t_f : texture_1d; + +[[group(0), binding(1)]] var t_i : texture_1d; + +[[group(0), binding(2)]] var t_u : texture_1d; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/2d.wgsl b/test/types/texture/sampled/2d.wgsl new file mode 100644 index 0000000000..88cea50802 --- /dev/null +++ b/test/types/texture/sampled/2d.wgsl @@ -0,0 +1,10 @@ +[[group(0), binding(0)]] var t_f : texture_2d; +[[group(0), binding(1)]] var t_i : texture_2d; +[[group(0), binding(2)]] var t_u : texture_2d; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/2d.wgsl.expected.hlsl b/test/types/texture/sampled/2d.wgsl.expected.hlsl new file mode 100644 index 0000000000..5b088d6902 --- /dev/null +++ b/test/types/texture/sampled/2d.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture2D t_f : register(t0, space0); +Texture2D t_i : register(t1, space0); +Texture2D t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + t_i; + t_u; + return; +} + diff --git a/test/types/texture/sampled/2d.wgsl.expected.msl b/test/types/texture/sampled/2d.wgsl.expected.msl new file mode 100644 index 0000000000..38af4944af --- /dev/null +++ b/test/types/texture/sampled/2d.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], texture2d tint_symbol_2 [[texture(1)]], texture2d tint_symbol_3 [[texture(2)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + return; +} + diff --git a/test/types/texture/sampled/2d.wgsl.expected.spvasm b/test/types/texture/sampled/2d.wgsl.expected.spvasm new file mode 100644 index 0000000000..750d32ed11 --- /dev/null +++ b/test/types/texture/sampled/2d.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %t_i "t_i" + OpName %t_u "t_u" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + OpDecorate %t_i DescriptorSet 0 + OpDecorate %t_i Binding 1 + OpDecorate %t_u DescriptorSet 0 + OpDecorate %t_u Binding 2 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %int = OpTypeInt 32 1 + %7 = OpTypeImage %int 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %t_i = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %t_u = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %main = OpFunction %void None %13 + %16 = OpLabel + %18 = OpLoad %3 %t_f + %20 = OpLoad %7 %t_i + %22 = OpLoad %11 %t_u + OpReturn + OpFunctionEnd diff --git a/test/types/texture/sampled/2d.wgsl.expected.wgsl b/test/types/texture/sampled/2d.wgsl.expected.wgsl new file mode 100644 index 0000000000..771efa62c3 --- /dev/null +++ b/test/types/texture/sampled/2d.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +[[group(0), binding(0)]] var t_f : texture_2d; + +[[group(0), binding(1)]] var t_i : texture_2d; + +[[group(0), binding(2)]] var t_u : texture_2d; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/2d_array.wgsl b/test/types/texture/sampled/2d_array.wgsl new file mode 100644 index 0000000000..965a4c8e6d --- /dev/null +++ b/test/types/texture/sampled/2d_array.wgsl @@ -0,0 +1,10 @@ +[[group(0), binding(0)]] var t_f : texture_2d_array; +[[group(0), binding(1)]] var t_i : texture_2d_array; +[[group(0), binding(2)]] var t_u : texture_2d_array; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/2d_array.wgsl.expected.hlsl b/test/types/texture/sampled/2d_array.wgsl.expected.hlsl new file mode 100644 index 0000000000..70f3a3b6d8 --- /dev/null +++ b/test/types/texture/sampled/2d_array.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture2DArray t_f : register(t0, space0); +Texture2DArray t_i : register(t1, space0); +Texture2DArray t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + t_i; + t_u; + return; +} + diff --git a/test/types/texture/sampled/2d_array.wgsl.expected.msl b/test/types/texture/sampled/2d_array.wgsl.expected.msl new file mode 100644 index 0000000000..320f5e60c6 --- /dev/null +++ b/test/types/texture/sampled/2d_array.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void tint_symbol(texture2d_array tint_symbol_1 [[texture(0)]], texture2d_array tint_symbol_2 [[texture(1)]], texture2d_array tint_symbol_3 [[texture(2)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + return; +} + diff --git a/test/types/texture/sampled/2d_array.wgsl.expected.spvasm b/test/types/texture/sampled/2d_array.wgsl.expected.spvasm new file mode 100644 index 0000000000..d9e9dd23dd --- /dev/null +++ b/test/types/texture/sampled/2d_array.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %t_i "t_i" + OpName %t_u "t_u" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + OpDecorate %t_i DescriptorSet 0 + OpDecorate %t_i Binding 1 + OpDecorate %t_u DescriptorSet 0 + OpDecorate %t_u Binding 2 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %int = OpTypeInt 32 1 + %7 = OpTypeImage %int 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %t_i = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %t_u = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %main = OpFunction %void None %13 + %16 = OpLabel + %18 = OpLoad %3 %t_f + %20 = OpLoad %7 %t_i + %22 = OpLoad %11 %t_u + OpReturn + OpFunctionEnd diff --git a/test/types/texture/sampled/2d_array.wgsl.expected.wgsl b/test/types/texture/sampled/2d_array.wgsl.expected.wgsl new file mode 100644 index 0000000000..1559d3589f --- /dev/null +++ b/test/types/texture/sampled/2d_array.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +[[group(0), binding(0)]] var t_f : texture_2d_array; + +[[group(0), binding(1)]] var t_i : texture_2d_array; + +[[group(0), binding(2)]] var t_u : texture_2d_array; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/3d.wgsl b/test/types/texture/sampled/3d.wgsl new file mode 100644 index 0000000000..966ce4e822 --- /dev/null +++ b/test/types/texture/sampled/3d.wgsl @@ -0,0 +1,10 @@ +[[group(0), binding(0)]] var t_f : texture_3d; +[[group(0), binding(1)]] var t_i : texture_3d; +[[group(0), binding(2)]] var t_u : texture_3d; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/3d.wgsl.expected.hlsl b/test/types/texture/sampled/3d.wgsl.expected.hlsl new file mode 100644 index 0000000000..57784c9f11 --- /dev/null +++ b/test/types/texture/sampled/3d.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +Texture3D t_f : register(t0, space0); +Texture3D t_i : register(t1, space0); +Texture3D t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + t_i; + t_u; + return; +} + diff --git a/test/types/texture/sampled/3d.wgsl.expected.msl b/test/types/texture/sampled/3d.wgsl.expected.msl new file mode 100644 index 0000000000..f0becd8a0a --- /dev/null +++ b/test/types/texture/sampled/3d.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void tint_symbol(texture3d tint_symbol_1 [[texture(0)]], texture3d tint_symbol_2 [[texture(1)]], texture3d tint_symbol_3 [[texture(2)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + return; +} + diff --git a/test/types/texture/sampled/3d.wgsl.expected.spvasm b/test/types/texture/sampled/3d.wgsl.expected.spvasm new file mode 100644 index 0000000000..3a2253e059 --- /dev/null +++ b/test/types/texture/sampled/3d.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %t_i "t_i" + OpName %t_u "t_u" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + OpDecorate %t_i DescriptorSet 0 + OpDecorate %t_i Binding 1 + OpDecorate %t_u DescriptorSet 0 + OpDecorate %t_u Binding 2 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %int = OpTypeInt 32 1 + %7 = OpTypeImage %int 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %t_i = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %t_u = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %main = OpFunction %void None %13 + %16 = OpLabel + %18 = OpLoad %3 %t_f + %20 = OpLoad %7 %t_i + %22 = OpLoad %11 %t_u + OpReturn + OpFunctionEnd diff --git a/test/types/texture/sampled/3d.wgsl.expected.wgsl b/test/types/texture/sampled/3d.wgsl.expected.wgsl new file mode 100644 index 0000000000..b982e7d06e --- /dev/null +++ b/test/types/texture/sampled/3d.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +[[group(0), binding(0)]] var t_f : texture_3d; + +[[group(0), binding(1)]] var t_i : texture_3d; + +[[group(0), binding(2)]] var t_u : texture_3d; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/cube.wgsl b/test/types/texture/sampled/cube.wgsl new file mode 100644 index 0000000000..f09a4cdee7 --- /dev/null +++ b/test/types/texture/sampled/cube.wgsl @@ -0,0 +1,10 @@ +[[group(0), binding(0)]] var t_f : texture_cube; +[[group(0), binding(1)]] var t_i : texture_cube; +[[group(0), binding(2)]] var t_u : texture_cube; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/cube.wgsl.expected.hlsl b/test/types/texture/sampled/cube.wgsl.expected.hlsl new file mode 100644 index 0000000000..abfda40cb4 --- /dev/null +++ b/test/types/texture/sampled/cube.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +TextureCube t_f : register(t0, space0); +TextureCube t_i : register(t1, space0); +TextureCube t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + t_i; + t_u; + return; +} + diff --git a/test/types/texture/sampled/cube.wgsl.expected.msl b/test/types/texture/sampled/cube.wgsl.expected.msl new file mode 100644 index 0000000000..ed604d0c5c --- /dev/null +++ b/test/types/texture/sampled/cube.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void tint_symbol(texturecube tint_symbol_1 [[texture(0)]], texturecube tint_symbol_2 [[texture(1)]], texturecube tint_symbol_3 [[texture(2)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + return; +} + diff --git a/test/types/texture/sampled/cube.wgsl.expected.spvasm b/test/types/texture/sampled/cube.wgsl.expected.spvasm new file mode 100644 index 0000000000..b260e7d6fc --- /dev/null +++ b/test/types/texture/sampled/cube.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %t_i "t_i" + OpName %t_u "t_u" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + OpDecorate %t_i DescriptorSet 0 + OpDecorate %t_i Binding 1 + OpDecorate %t_u DescriptorSet 0 + OpDecorate %t_u Binding 2 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %int = OpTypeInt 32 1 + %7 = OpTypeImage %int Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %t_i = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %t_u = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %main = OpFunction %void None %13 + %16 = OpLabel + %18 = OpLoad %3 %t_f + %20 = OpLoad %7 %t_i + %22 = OpLoad %11 %t_u + OpReturn + OpFunctionEnd diff --git a/test/types/texture/sampled/cube.wgsl.expected.wgsl b/test/types/texture/sampled/cube.wgsl.expected.wgsl new file mode 100644 index 0000000000..ff52b9014d --- /dev/null +++ b/test/types/texture/sampled/cube.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +[[group(0), binding(0)]] var t_f : texture_cube; + +[[group(0), binding(1)]] var t_i : texture_cube; + +[[group(0), binding(2)]] var t_u : texture_cube; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/cube_array.wgsl b/test/types/texture/sampled/cube_array.wgsl new file mode 100644 index 0000000000..cc1e8d0b07 --- /dev/null +++ b/test/types/texture/sampled/cube_array.wgsl @@ -0,0 +1,10 @@ +[[group(0), binding(0)]] var t_f : texture_cube_array; +[[group(0), binding(1)]] var t_i : texture_cube_array; +[[group(0), binding(2)]] var t_u : texture_cube_array; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/sampled/cube_array.wgsl.expected.hlsl b/test/types/texture/sampled/cube_array.wgsl.expected.hlsl new file mode 100644 index 0000000000..855a19786e --- /dev/null +++ b/test/types/texture/sampled/cube_array.wgsl.expected.hlsl @@ -0,0 +1,12 @@ +TextureCubeArray t_f : register(t0, space0); +TextureCubeArray t_i : register(t1, space0); +TextureCubeArray t_u : register(t2, space0); + +[numthreads(1, 1, 1)] +void main() { + t_f; + t_i; + t_u; + return; +} + diff --git a/test/types/texture/sampled/cube_array.wgsl.expected.msl b/test/types/texture/sampled/cube_array.wgsl.expected.msl new file mode 100644 index 0000000000..38b89a7d5e --- /dev/null +++ b/test/types/texture/sampled/cube_array.wgsl.expected.msl @@ -0,0 +1,10 @@ +#include + +using namespace metal; +kernel void tint_symbol(texturecube_array tint_symbol_1 [[texture(0)]], texturecube_array tint_symbol_2 [[texture(1)]], texturecube_array tint_symbol_3 [[texture(2)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + return; +} + diff --git a/test/types/texture/sampled/cube_array.wgsl.expected.spvasm b/test/types/texture/sampled/cube_array.wgsl.expected.spvasm new file mode 100644 index 0000000000..9df0e15c9e --- /dev/null +++ b/test/types/texture/sampled/cube_array.wgsl.expected.spvasm @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability SampledCubeArray + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_f "t_f" + OpName %t_i "t_i" + OpName %t_u "t_u" + OpName %main "main" + OpDecorate %t_f DescriptorSet 0 + OpDecorate %t_f Binding 0 + OpDecorate %t_i DescriptorSet 0 + OpDecorate %t_i Binding 1 + OpDecorate %t_u DescriptorSet 0 + OpDecorate %t_u Binding 2 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 + %t_f = OpVariable %_ptr_UniformConstant_3 UniformConstant + %int = OpTypeInt 32 1 + %7 = OpTypeImage %int Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %t_i = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %t_u = OpVariable %_ptr_UniformConstant_11 UniformConstant + %void = OpTypeVoid + %13 = OpTypeFunction %void + %main = OpFunction %void None %13 + %16 = OpLabel + %18 = OpLoad %3 %t_f + %20 = OpLoad %7 %t_i + %22 = OpLoad %11 %t_u + OpReturn + OpFunctionEnd diff --git a/test/types/texture/sampled/cube_array.wgsl.expected.wgsl b/test/types/texture/sampled/cube_array.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2c49a68d7 --- /dev/null +++ b/test/types/texture/sampled/cube_array.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +[[group(0), binding(0)]] var t_f : texture_cube_array; + +[[group(0), binding(1)]] var t_i : texture_cube_array; + +[[group(0), binding(2)]] var t_u : texture_cube_array; + +[[stage(compute)]] +fn main() { + ignore(t_f); + ignore(t_i); + ignore(t_u); +} diff --git a/test/types/texture/storage/1d.wgsl b/test/types/texture/storage/1d.wgsl new file mode 100644 index 0000000000..73d809aaa6 --- /dev/null +++ b/test/types/texture/storage/1d.wgsl @@ -0,0 +1,68 @@ +[[group(0), binding(0)]] var t_rgba8unorm_r : texture_storage_1d; +[[group(0), binding(1)]] var t_rgba8snorm_r : texture_storage_1d; +[[group(0), binding(2)]] var t_rgba8uint_r : texture_storage_1d; +[[group(0), binding(3)]] var t_rgba8sint_r : texture_storage_1d; +[[group(0), binding(4)]] var t_rgba16uint_r : texture_storage_1d; +[[group(0), binding(5)]] var t_rgba16sint_r : texture_storage_1d; +[[group(0), binding(6)]] var t_rgba16float_r : texture_storage_1d; +[[group(0), binding(7)]] var t_r32uint_r : texture_storage_1d; +[[group(0), binding(8)]] var t_r32sint_r : texture_storage_1d; +[[group(0), binding(9)]] var t_r32float_r : texture_storage_1d; +[[group(0), binding(10)]] var t_rg32uint_r : texture_storage_1d; +[[group(0), binding(11)]] var t_rg32sint_r : texture_storage_1d; +[[group(0), binding(12)]] var t_rg32float_r : texture_storage_1d; +[[group(0), binding(13)]] var t_rgba32uint_r : texture_storage_1d; +[[group(0), binding(14)]] var t_rgba32sint_r : texture_storage_1d; +[[group(0), binding(15)]] var t_rgba32float_r : texture_storage_1d; +[[group(0), binding(50)]] var t_rgba8unorm_w : texture_storage_1d; +[[group(0), binding(51)]] var t_rgba8snorm_w : texture_storage_1d; +[[group(0), binding(52)]] var t_rgba8uint_w : texture_storage_1d; +[[group(0), binding(53)]] var t_rgba8sint_w : texture_storage_1d; +[[group(0), binding(54)]] var t_rgba16uint_w : texture_storage_1d; +[[group(0), binding(55)]] var t_rgba16sint_w : texture_storage_1d; +[[group(0), binding(56)]] var t_rgba16float_w : texture_storage_1d; +[[group(0), binding(57)]] var t_r32uint_w : texture_storage_1d; +[[group(0), binding(58)]] var t_r32sint_w : texture_storage_1d; +[[group(0), binding(59)]] var t_r32float_w : texture_storage_1d; +[[group(0), binding(60)]] var t_rg32uint_w : texture_storage_1d; +[[group(0), binding(61)]] var t_rg32sint_w : texture_storage_1d; +[[group(0), binding(62)]] var t_rg32float_w : texture_storage_1d; +[[group(0), binding(63)]] var t_rgba32uint_w : texture_storage_1d; +[[group(0), binding(64)]] var t_rgba32sint_w : texture_storage_1d; +[[group(0), binding(65)]] var t_rgba32float_w : texture_storage_1d; + +[[stage(compute)]] +fn main() { + ignore(t_rgba8unorm_r); + ignore(t_rgba8snorm_r); + ignore(t_rgba8uint_r); + ignore(t_rgba8sint_r); + ignore(t_rgba16uint_r); + ignore(t_rgba16sint_r); + ignore(t_rgba16float_r); + ignore(t_r32uint_r); + ignore(t_r32sint_r); + ignore(t_r32float_r); + ignore(t_rg32uint_r); + ignore(t_rg32sint_r); + ignore(t_rg32float_r); + ignore(t_rgba32uint_r); + ignore(t_rgba32sint_r); + ignore(t_rgba32float_r); + ignore(t_rgba8unorm_w); + ignore(t_rgba8snorm_w); + ignore(t_rgba8uint_w); + ignore(t_rgba8sint_w); + ignore(t_rgba16uint_w); + ignore(t_rgba16sint_w); + ignore(t_rgba16float_w); + ignore(t_r32uint_w); + ignore(t_r32sint_w); + ignore(t_r32float_w); + ignore(t_rg32uint_w); + ignore(t_rg32sint_w); + ignore(t_rg32float_w); + ignore(t_rgba32uint_w); + ignore(t_rgba32sint_w); + ignore(t_rgba32float_w); +} diff --git a/test/types/texture/storage/1d.wgsl.expected.hlsl b/test/types/texture/storage/1d.wgsl.expected.hlsl new file mode 100644 index 0000000000..48e02ea413 --- /dev/null +++ b/test/types/texture/storage/1d.wgsl.expected.hlsl @@ -0,0 +1,70 @@ +Texture1D t_rgba8unorm_r : register(t0, space0); +Texture1D t_rgba8snorm_r : register(t1, space0); +Texture1D t_rgba8uint_r : register(t2, space0); +Texture1D t_rgba8sint_r : register(t3, space0); +Texture1D t_rgba16uint_r : register(t4, space0); +Texture1D t_rgba16sint_r : register(t5, space0); +Texture1D t_rgba16float_r : register(t6, space0); +Texture1D t_r32uint_r : register(t7, space0); +Texture1D t_r32sint_r : register(t8, space0); +Texture1D t_r32float_r : register(t9, space0); +Texture1D t_rg32uint_r : register(t10, space0); +Texture1D t_rg32sint_r : register(t11, space0); +Texture1D t_rg32float_r : register(t12, space0); +Texture1D t_rgba32uint_r : register(t13, space0); +Texture1D t_rgba32sint_r : register(t14, space0); +Texture1D t_rgba32float_r : register(t15, space0); +RWTexture1D t_rgba8unorm_w : register(u50, space0); +RWTexture1D t_rgba8snorm_w : register(u51, space0); +RWTexture1D t_rgba8uint_w : register(u52, space0); +RWTexture1D t_rgba8sint_w : register(u53, space0); +RWTexture1D t_rgba16uint_w : register(u54, space0); +RWTexture1D t_rgba16sint_w : register(u55, space0); +RWTexture1D t_rgba16float_w : register(u56, space0); +RWTexture1D t_r32uint_w : register(u57, space0); +RWTexture1D t_r32sint_w : register(u58, space0); +RWTexture1D t_r32float_w : register(u59, space0); +RWTexture1D t_rg32uint_w : register(u60, space0); +RWTexture1D t_rg32sint_w : register(u61, space0); +RWTexture1D t_rg32float_w : register(u62, space0); +RWTexture1D t_rgba32uint_w : register(u63, space0); +RWTexture1D t_rgba32sint_w : register(u64, space0); +RWTexture1D t_rgba32float_w : register(u65, space0); + +[numthreads(1, 1, 1)] +void main() { + t_rgba8unorm_r; + t_rgba8snorm_r; + t_rgba8uint_r; + t_rgba8sint_r; + t_rgba16uint_r; + t_rgba16sint_r; + t_rgba16float_r; + t_r32uint_r; + t_r32sint_r; + t_r32float_r; + t_rg32uint_r; + t_rg32sint_r; + t_rg32float_r; + t_rgba32uint_r; + t_rgba32sint_r; + t_rgba32float_r; + t_rgba8unorm_w; + t_rgba8snorm_w; + t_rgba8uint_w; + t_rgba8sint_w; + t_rgba16uint_w; + t_rgba16sint_w; + t_rgba16float_w; + t_r32uint_w; + t_r32sint_w; + t_r32float_w; + t_rg32uint_w; + t_rg32sint_w; + t_rg32float_w; + t_rgba32uint_w; + t_rgba32sint_w; + t_rgba32float_w; + return; +} + diff --git a/test/types/texture/storage/1d.wgsl.expected.msl b/test/types/texture/storage/1d.wgsl.expected.msl new file mode 100644 index 0000000000..b088b6a90d --- /dev/null +++ b/test/types/texture/storage/1d.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +kernel void tint_symbol(texture1d tint_symbol_1 [[texture(0)]], texture1d tint_symbol_2 [[texture(1)]], texture1d tint_symbol_3 [[texture(2)]], texture1d tint_symbol_4 [[texture(3)]], texture1d tint_symbol_5 [[texture(4)]], texture1d tint_symbol_6 [[texture(5)]], texture1d tint_symbol_7 [[texture(6)]], texture1d tint_symbol_8 [[texture(7)]], texture1d tint_symbol_9 [[texture(8)]], texture1d tint_symbol_10 [[texture(9)]], texture1d tint_symbol_11 [[texture(10)]], texture1d tint_symbol_12 [[texture(11)]], texture1d tint_symbol_13 [[texture(12)]], texture1d tint_symbol_14 [[texture(13)]], texture1d tint_symbol_15 [[texture(14)]], texture1d tint_symbol_16 [[texture(15)]], texture1d tint_symbol_17 [[texture(50)]], texture1d tint_symbol_18 [[texture(51)]], texture1d tint_symbol_19 [[texture(52)]], texture1d tint_symbol_20 [[texture(53)]], texture1d tint_symbol_21 [[texture(54)]], texture1d tint_symbol_22 [[texture(55)]], texture1d tint_symbol_23 [[texture(56)]], texture1d tint_symbol_24 [[texture(57)]], texture1d tint_symbol_25 [[texture(58)]], texture1d tint_symbol_26 [[texture(59)]], texture1d tint_symbol_27 [[texture(60)]], texture1d tint_symbol_28 [[texture(61)]], texture1d tint_symbol_29 [[texture(62)]], texture1d tint_symbol_30 [[texture(63)]], texture1d tint_symbol_31 [[texture(64)]], texture1d tint_symbol_32 [[texture(65)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + (void) tint_symbol_4; + (void) tint_symbol_5; + (void) tint_symbol_6; + (void) tint_symbol_7; + (void) tint_symbol_8; + (void) tint_symbol_9; + (void) tint_symbol_10; + (void) tint_symbol_11; + (void) tint_symbol_12; + (void) tint_symbol_13; + (void) tint_symbol_14; + (void) tint_symbol_15; + (void) tint_symbol_16; + (void) tint_symbol_17; + (void) tint_symbol_18; + (void) tint_symbol_19; + (void) tint_symbol_20; + (void) tint_symbol_21; + (void) tint_symbol_22; + (void) tint_symbol_23; + (void) tint_symbol_24; + (void) tint_symbol_25; + (void) tint_symbol_26; + (void) tint_symbol_27; + (void) tint_symbol_28; + (void) tint_symbol_29; + (void) tint_symbol_30; + (void) tint_symbol_31; + (void) tint_symbol_32; + return; +} + diff --git a/test/types/texture/storage/1d.wgsl.expected.spvasm b/test/types/texture/storage/1d.wgsl.expected.spvasm new file mode 100644 index 0000000000..5cfe1470c1 --- /dev/null +++ b/test/types/texture/storage/1d.wgsl.expected.spvasm @@ -0,0 +1,261 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 152 +; Schema: 0 + OpCapability Shader + OpCapability Image1D + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_rgba8unorm_r "t_rgba8unorm_r" + OpName %t_rgba8snorm_r "t_rgba8snorm_r" + OpName %t_rgba8uint_r "t_rgba8uint_r" + OpName %t_rgba8sint_r "t_rgba8sint_r" + OpName %t_rgba16uint_r "t_rgba16uint_r" + OpName %t_rgba16sint_r "t_rgba16sint_r" + OpName %t_rgba16float_r "t_rgba16float_r" + OpName %t_r32uint_r "t_r32uint_r" + OpName %t_r32sint_r "t_r32sint_r" + OpName %t_r32float_r "t_r32float_r" + OpName %t_rg32uint_r "t_rg32uint_r" + OpName %t_rg32sint_r "t_rg32sint_r" + OpName %t_rg32float_r "t_rg32float_r" + OpName %t_rgba32uint_r "t_rgba32uint_r" + OpName %t_rgba32sint_r "t_rgba32sint_r" + OpName %t_rgba32float_r "t_rgba32float_r" + OpName %t_rgba8unorm_w "t_rgba8unorm_w" + OpName %t_rgba8snorm_w "t_rgba8snorm_w" + OpName %t_rgba8uint_w "t_rgba8uint_w" + OpName %t_rgba8sint_w "t_rgba8sint_w" + OpName %t_rgba16uint_w "t_rgba16uint_w" + OpName %t_rgba16sint_w "t_rgba16sint_w" + OpName %t_rgba16float_w "t_rgba16float_w" + OpName %t_r32uint_w "t_r32uint_w" + OpName %t_r32sint_w "t_r32sint_w" + OpName %t_r32float_w "t_r32float_w" + OpName %t_rg32uint_w "t_rg32uint_w" + OpName %t_rg32sint_w "t_rg32sint_w" + OpName %t_rg32float_w "t_rg32float_w" + OpName %t_rgba32uint_w "t_rgba32uint_w" + OpName %t_rgba32sint_w "t_rgba32sint_w" + OpName %t_rgba32float_w "t_rgba32float_w" + OpName %main "main" + OpDecorate %t_rgba8unorm_r NonWritable + OpDecorate %t_rgba8unorm_r DescriptorSet 0 + OpDecorate %t_rgba8unorm_r Binding 0 + OpDecorate %t_rgba8snorm_r NonWritable + OpDecorate %t_rgba8snorm_r DescriptorSet 0 + OpDecorate %t_rgba8snorm_r Binding 1 + OpDecorate %t_rgba8uint_r NonWritable + OpDecorate %t_rgba8uint_r DescriptorSet 0 + OpDecorate %t_rgba8uint_r Binding 2 + OpDecorate %t_rgba8sint_r NonWritable + OpDecorate %t_rgba8sint_r DescriptorSet 0 + OpDecorate %t_rgba8sint_r Binding 3 + OpDecorate %t_rgba16uint_r NonWritable + OpDecorate %t_rgba16uint_r DescriptorSet 0 + OpDecorate %t_rgba16uint_r Binding 4 + OpDecorate %t_rgba16sint_r NonWritable + OpDecorate %t_rgba16sint_r DescriptorSet 0 + OpDecorate %t_rgba16sint_r Binding 5 + OpDecorate %t_rgba16float_r NonWritable + OpDecorate %t_rgba16float_r DescriptorSet 0 + OpDecorate %t_rgba16float_r Binding 6 + OpDecorate %t_r32uint_r NonWritable + OpDecorate %t_r32uint_r DescriptorSet 0 + OpDecorate %t_r32uint_r Binding 7 + OpDecorate %t_r32sint_r NonWritable + OpDecorate %t_r32sint_r DescriptorSet 0 + OpDecorate %t_r32sint_r Binding 8 + OpDecorate %t_r32float_r NonWritable + OpDecorate %t_r32float_r DescriptorSet 0 + OpDecorate %t_r32float_r Binding 9 + OpDecorate %t_rg32uint_r NonWritable + OpDecorate %t_rg32uint_r DescriptorSet 0 + OpDecorate %t_rg32uint_r Binding 10 + OpDecorate %t_rg32sint_r NonWritable + OpDecorate %t_rg32sint_r DescriptorSet 0 + OpDecorate %t_rg32sint_r Binding 11 + OpDecorate %t_rg32float_r NonWritable + OpDecorate %t_rg32float_r DescriptorSet 0 + OpDecorate %t_rg32float_r Binding 12 + OpDecorate %t_rgba32uint_r NonWritable + OpDecorate %t_rgba32uint_r DescriptorSet 0 + OpDecorate %t_rgba32uint_r Binding 13 + OpDecorate %t_rgba32sint_r NonWritable + OpDecorate %t_rgba32sint_r DescriptorSet 0 + OpDecorate %t_rgba32sint_r Binding 14 + OpDecorate %t_rgba32float_r NonWritable + OpDecorate %t_rgba32float_r DescriptorSet 0 + OpDecorate %t_rgba32float_r Binding 15 + OpDecorate %t_rgba8unorm_w NonReadable + OpDecorate %t_rgba8unorm_w DescriptorSet 0 + OpDecorate %t_rgba8unorm_w Binding 50 + OpDecorate %t_rgba8snorm_w NonReadable + OpDecorate %t_rgba8snorm_w DescriptorSet 0 + OpDecorate %t_rgba8snorm_w Binding 51 + OpDecorate %t_rgba8uint_w NonReadable + OpDecorate %t_rgba8uint_w DescriptorSet 0 + OpDecorate %t_rgba8uint_w Binding 52 + OpDecorate %t_rgba8sint_w NonReadable + OpDecorate %t_rgba8sint_w DescriptorSet 0 + OpDecorate %t_rgba8sint_w Binding 53 + OpDecorate %t_rgba16uint_w NonReadable + OpDecorate %t_rgba16uint_w DescriptorSet 0 + OpDecorate %t_rgba16uint_w Binding 54 + OpDecorate %t_rgba16sint_w NonReadable + OpDecorate %t_rgba16sint_w DescriptorSet 0 + OpDecorate %t_rgba16sint_w Binding 55 + OpDecorate %t_rgba16float_w NonReadable + OpDecorate %t_rgba16float_w DescriptorSet 0 + OpDecorate %t_rgba16float_w Binding 56 + OpDecorate %t_r32uint_w NonReadable + OpDecorate %t_r32uint_w DescriptorSet 0 + OpDecorate %t_r32uint_w Binding 57 + OpDecorate %t_r32sint_w NonReadable + OpDecorate %t_r32sint_w DescriptorSet 0 + OpDecorate %t_r32sint_w Binding 58 + OpDecorate %t_r32float_w NonReadable + OpDecorate %t_r32float_w DescriptorSet 0 + OpDecorate %t_r32float_w Binding 59 + OpDecorate %t_rg32uint_w NonReadable + OpDecorate %t_rg32uint_w DescriptorSet 0 + OpDecorate %t_rg32uint_w Binding 60 + OpDecorate %t_rg32sint_w NonReadable + OpDecorate %t_rg32sint_w DescriptorSet 0 + OpDecorate %t_rg32sint_w Binding 61 + OpDecorate %t_rg32float_w NonReadable + OpDecorate %t_rg32float_w DescriptorSet 0 + OpDecorate %t_rg32float_w Binding 62 + OpDecorate %t_rgba32uint_w NonReadable + OpDecorate %t_rgba32uint_w DescriptorSet 0 + OpDecorate %t_rgba32uint_w Binding 63 + OpDecorate %t_rgba32sint_w NonReadable + OpDecorate %t_rgba32sint_w DescriptorSet 0 + OpDecorate %t_rgba32sint_w Binding 64 + OpDecorate %t_rgba32float_w NonReadable + OpDecorate %t_rgba32float_w DescriptorSet 0 + OpDecorate %t_rgba32float_w Binding 65 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 1D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 +%t_rgba8unorm_r = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeImage %float 1D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 +%t_rgba8snorm_r = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %10 = OpTypeImage %uint 1D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 +%t_rgba8uint_r = OpVariable %_ptr_UniformConstant_10 UniformConstant + %int = OpTypeInt 32 1 + %14 = OpTypeImage %int 1D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 +%t_rgba8sint_r = OpVariable %_ptr_UniformConstant_14 UniformConstant + %18 = OpTypeImage %uint 1D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 +%t_rgba16uint_r = OpVariable %_ptr_UniformConstant_18 UniformConstant + %21 = OpTypeImage %int 1D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_21 = OpTypePointer UniformConstant %21 +%t_rgba16sint_r = OpVariable %_ptr_UniformConstant_21 UniformConstant + %24 = OpTypeImage %float 1D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24 +%t_rgba16float_r = OpVariable %_ptr_UniformConstant_24 UniformConstant + %27 = OpTypeImage %uint 1D 0 0 0 2 R32ui +%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27 +%t_r32uint_r = OpVariable %_ptr_UniformConstant_27 UniformConstant + %30 = OpTypeImage %int 1D 0 0 0 2 R32i +%_ptr_UniformConstant_30 = OpTypePointer UniformConstant %30 +%t_r32sint_r = OpVariable %_ptr_UniformConstant_30 UniformConstant + %33 = OpTypeImage %float 1D 0 0 0 2 R32f +%_ptr_UniformConstant_33 = OpTypePointer UniformConstant %33 +%t_r32float_r = OpVariable %_ptr_UniformConstant_33 UniformConstant + %36 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_36 = OpTypePointer UniformConstant %36 +%t_rg32uint_r = OpVariable %_ptr_UniformConstant_36 UniformConstant + %39 = OpTypeImage %int 1D 0 0 0 2 Rg32i +%_ptr_UniformConstant_39 = OpTypePointer UniformConstant %39 +%t_rg32sint_r = OpVariable %_ptr_UniformConstant_39 UniformConstant + %42 = OpTypeImage %float 1D 0 0 0 2 Rg32f +%_ptr_UniformConstant_42 = OpTypePointer UniformConstant %42 +%t_rg32float_r = OpVariable %_ptr_UniformConstant_42 UniformConstant + %45 = OpTypeImage %uint 1D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_45 = OpTypePointer UniformConstant %45 +%t_rgba32uint_r = OpVariable %_ptr_UniformConstant_45 UniformConstant + %48 = OpTypeImage %int 1D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_48 = OpTypePointer UniformConstant %48 +%t_rgba32sint_r = OpVariable %_ptr_UniformConstant_48 UniformConstant + %51 = OpTypeImage %float 1D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51 +%t_rgba32float_r = OpVariable %_ptr_UniformConstant_51 UniformConstant +%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3 +%t_rgba8unorm_w = OpVariable %_ptr_UniformConstant_3_0 UniformConstant +%_ptr_UniformConstant_7_0 = OpTypePointer UniformConstant %7 +%t_rgba8snorm_w = OpVariable %_ptr_UniformConstant_7_0 UniformConstant +%_ptr_UniformConstant_10_0 = OpTypePointer UniformConstant %10 +%t_rgba8uint_w = OpVariable %_ptr_UniformConstant_10_0 UniformConstant +%_ptr_UniformConstant_14_0 = OpTypePointer UniformConstant %14 +%t_rgba8sint_w = OpVariable %_ptr_UniformConstant_14_0 UniformConstant +%_ptr_UniformConstant_18_0 = OpTypePointer UniformConstant %18 +%t_rgba16uint_w = OpVariable %_ptr_UniformConstant_18_0 UniformConstant +%_ptr_UniformConstant_21_0 = OpTypePointer UniformConstant %21 +%t_rgba16sint_w = OpVariable %_ptr_UniformConstant_21_0 UniformConstant +%_ptr_UniformConstant_24_0 = OpTypePointer UniformConstant %24 +%t_rgba16float_w = OpVariable %_ptr_UniformConstant_24_0 UniformConstant +%_ptr_UniformConstant_27_0 = OpTypePointer UniformConstant %27 +%t_r32uint_w = OpVariable %_ptr_UniformConstant_27_0 UniformConstant +%_ptr_UniformConstant_30_0 = OpTypePointer UniformConstant %30 +%t_r32sint_w = OpVariable %_ptr_UniformConstant_30_0 UniformConstant +%_ptr_UniformConstant_33_0 = OpTypePointer UniformConstant %33 +%t_r32float_w = OpVariable %_ptr_UniformConstant_33_0 UniformConstant +%_ptr_UniformConstant_36_0 = OpTypePointer UniformConstant %36 +%t_rg32uint_w = OpVariable %_ptr_UniformConstant_36_0 UniformConstant +%_ptr_UniformConstant_39_0 = OpTypePointer UniformConstant %39 +%t_rg32sint_w = OpVariable %_ptr_UniformConstant_39_0 UniformConstant +%_ptr_UniformConstant_42_0 = OpTypePointer UniformConstant %42 +%t_rg32float_w = OpVariable %_ptr_UniformConstant_42_0 UniformConstant +%_ptr_UniformConstant_45_0 = OpTypePointer UniformConstant %45 +%t_rgba32uint_w = OpVariable %_ptr_UniformConstant_45_0 UniformConstant +%_ptr_UniformConstant_48_0 = OpTypePointer UniformConstant %48 +%t_rgba32sint_w = OpVariable %_ptr_UniformConstant_48_0 UniformConstant +%_ptr_UniformConstant_51_0 = OpTypePointer UniformConstant %51 +%t_rgba32float_w = OpVariable %_ptr_UniformConstant_51_0 UniformConstant + %void = OpTypeVoid + %84 = OpTypeFunction %void + %main = OpFunction %void None %84 + %87 = OpLabel + %89 = OpLoad %3 %t_rgba8unorm_r + %91 = OpLoad %7 %t_rgba8snorm_r + %93 = OpLoad %10 %t_rgba8uint_r + %95 = OpLoad %14 %t_rgba8sint_r + %97 = OpLoad %18 %t_rgba16uint_r + %99 = OpLoad %21 %t_rgba16sint_r + %101 = OpLoad %24 %t_rgba16float_r + %103 = OpLoad %27 %t_r32uint_r + %105 = OpLoad %30 %t_r32sint_r + %107 = OpLoad %33 %t_r32float_r + %109 = OpLoad %36 %t_rg32uint_r + %111 = OpLoad %39 %t_rg32sint_r + %113 = OpLoad %42 %t_rg32float_r + %115 = OpLoad %45 %t_rgba32uint_r + %117 = OpLoad %48 %t_rgba32sint_r + %119 = OpLoad %51 %t_rgba32float_r + %121 = OpLoad %3 %t_rgba8unorm_w + %123 = OpLoad %7 %t_rgba8snorm_w + %125 = OpLoad %10 %t_rgba8uint_w + %127 = OpLoad %14 %t_rgba8sint_w + %129 = OpLoad %18 %t_rgba16uint_w + %131 = OpLoad %21 %t_rgba16sint_w + %133 = OpLoad %24 %t_rgba16float_w + %135 = OpLoad %27 %t_r32uint_w + %137 = OpLoad %30 %t_r32sint_w + %139 = OpLoad %33 %t_r32float_w + %141 = OpLoad %36 %t_rg32uint_w + %143 = OpLoad %39 %t_rg32sint_w + %145 = OpLoad %42 %t_rg32float_w + %147 = OpLoad %45 %t_rgba32uint_w + %149 = OpLoad %48 %t_rgba32sint_w + %151 = OpLoad %51 %t_rgba32float_w + OpReturn + OpFunctionEnd diff --git a/test/types/texture/storage/1d.wgsl.expected.wgsl b/test/types/texture/storage/1d.wgsl.expected.wgsl new file mode 100644 index 0000000000..47eae77056 --- /dev/null +++ b/test/types/texture/storage/1d.wgsl.expected.wgsl @@ -0,0 +1,99 @@ +[[group(0), binding(0)]] var t_rgba8unorm_r : texture_storage_1d; + +[[group(0), binding(1)]] var t_rgba8snorm_r : texture_storage_1d; + +[[group(0), binding(2)]] var t_rgba8uint_r : texture_storage_1d; + +[[group(0), binding(3)]] var t_rgba8sint_r : texture_storage_1d; + +[[group(0), binding(4)]] var t_rgba16uint_r : texture_storage_1d; + +[[group(0), binding(5)]] var t_rgba16sint_r : texture_storage_1d; + +[[group(0), binding(6)]] var t_rgba16float_r : texture_storage_1d; + +[[group(0), binding(7)]] var t_r32uint_r : texture_storage_1d; + +[[group(0), binding(8)]] var t_r32sint_r : texture_storage_1d; + +[[group(0), binding(9)]] var t_r32float_r : texture_storage_1d; + +[[group(0), binding(10)]] var t_rg32uint_r : texture_storage_1d; + +[[group(0), binding(11)]] var t_rg32sint_r : texture_storage_1d; + +[[group(0), binding(12)]] var t_rg32float_r : texture_storage_1d; + +[[group(0), binding(13)]] var t_rgba32uint_r : texture_storage_1d; + +[[group(0), binding(14)]] var t_rgba32sint_r : texture_storage_1d; + +[[group(0), binding(15)]] var t_rgba32float_r : texture_storage_1d; + +[[group(0), binding(50)]] var t_rgba8unorm_w : texture_storage_1d; + +[[group(0), binding(51)]] var t_rgba8snorm_w : texture_storage_1d; + +[[group(0), binding(52)]] var t_rgba8uint_w : texture_storage_1d; + +[[group(0), binding(53)]] var t_rgba8sint_w : texture_storage_1d; + +[[group(0), binding(54)]] var t_rgba16uint_w : texture_storage_1d; + +[[group(0), binding(55)]] var t_rgba16sint_w : texture_storage_1d; + +[[group(0), binding(56)]] var t_rgba16float_w : texture_storage_1d; + +[[group(0), binding(57)]] var t_r32uint_w : texture_storage_1d; + +[[group(0), binding(58)]] var t_r32sint_w : texture_storage_1d; + +[[group(0), binding(59)]] var t_r32float_w : texture_storage_1d; + +[[group(0), binding(60)]] var t_rg32uint_w : texture_storage_1d; + +[[group(0), binding(61)]] var t_rg32sint_w : texture_storage_1d; + +[[group(0), binding(62)]] var t_rg32float_w : texture_storage_1d; + +[[group(0), binding(63)]] var t_rgba32uint_w : texture_storage_1d; + +[[group(0), binding(64)]] var t_rgba32sint_w : texture_storage_1d; + +[[group(0), binding(65)]] var t_rgba32float_w : texture_storage_1d; + +[[stage(compute)]] +fn main() { + ignore(t_rgba8unorm_r); + ignore(t_rgba8snorm_r); + ignore(t_rgba8uint_r); + ignore(t_rgba8sint_r); + ignore(t_rgba16uint_r); + ignore(t_rgba16sint_r); + ignore(t_rgba16float_r); + ignore(t_r32uint_r); + ignore(t_r32sint_r); + ignore(t_r32float_r); + ignore(t_rg32uint_r); + ignore(t_rg32sint_r); + ignore(t_rg32float_r); + ignore(t_rgba32uint_r); + ignore(t_rgba32sint_r); + ignore(t_rgba32float_r); + ignore(t_rgba8unorm_w); + ignore(t_rgba8snorm_w); + ignore(t_rgba8uint_w); + ignore(t_rgba8sint_w); + ignore(t_rgba16uint_w); + ignore(t_rgba16sint_w); + ignore(t_rgba16float_w); + ignore(t_r32uint_w); + ignore(t_r32sint_w); + ignore(t_r32float_w); + ignore(t_rg32uint_w); + ignore(t_rg32sint_w); + ignore(t_rg32float_w); + ignore(t_rgba32uint_w); + ignore(t_rgba32sint_w); + ignore(t_rgba32float_w); +} diff --git a/test/types/texture/storage/2d.wgsl b/test/types/texture/storage/2d.wgsl new file mode 100644 index 0000000000..99b04e8f2a --- /dev/null +++ b/test/types/texture/storage/2d.wgsl @@ -0,0 +1,68 @@ +[[group(0), binding(0)]] var t_rgba8unorm_r : texture_storage_2d; +[[group(0), binding(1)]] var t_rgba8snorm_r : texture_storage_2d; +[[group(0), binding(2)]] var t_rgba8uint_r : texture_storage_2d; +[[group(0), binding(3)]] var t_rgba8sint_r : texture_storage_2d; +[[group(0), binding(4)]] var t_rgba16uint_r : texture_storage_2d; +[[group(0), binding(5)]] var t_rgba16sint_r : texture_storage_2d; +[[group(0), binding(6)]] var t_rgba16float_r : texture_storage_2d; +[[group(0), binding(7)]] var t_r32uint_r : texture_storage_2d; +[[group(0), binding(8)]] var t_r32sint_r : texture_storage_2d; +[[group(0), binding(9)]] var t_r32float_r : texture_storage_2d; +[[group(0), binding(10)]] var t_rg32uint_r : texture_storage_2d; +[[group(0), binding(11)]] var t_rg32sint_r : texture_storage_2d; +[[group(0), binding(12)]] var t_rg32float_r : texture_storage_2d; +[[group(0), binding(13)]] var t_rgba32uint_r : texture_storage_2d; +[[group(0), binding(14)]] var t_rgba32sint_r : texture_storage_2d; +[[group(0), binding(15)]] var t_rgba32float_r : texture_storage_2d; +[[group(0), binding(50)]] var t_rgba8unorm_w : texture_storage_2d; +[[group(0), binding(51)]] var t_rgba8snorm_w : texture_storage_2d; +[[group(0), binding(52)]] var t_rgba8uint_w : texture_storage_2d; +[[group(0), binding(53)]] var t_rgba8sint_w : texture_storage_2d; +[[group(0), binding(54)]] var t_rgba16uint_w : texture_storage_2d; +[[group(0), binding(55)]] var t_rgba16sint_w : texture_storage_2d; +[[group(0), binding(56)]] var t_rgba16float_w : texture_storage_2d; +[[group(0), binding(57)]] var t_r32uint_w : texture_storage_2d; +[[group(0), binding(58)]] var t_r32sint_w : texture_storage_2d; +[[group(0), binding(59)]] var t_r32float_w : texture_storage_2d; +[[group(0), binding(60)]] var t_rg32uint_w : texture_storage_2d; +[[group(0), binding(61)]] var t_rg32sint_w : texture_storage_2d; +[[group(0), binding(62)]] var t_rg32float_w : texture_storage_2d; +[[group(0), binding(63)]] var t_rgba32uint_w : texture_storage_2d; +[[group(0), binding(64)]] var t_rgba32sint_w : texture_storage_2d; +[[group(0), binding(65)]] var t_rgba32float_w : texture_storage_2d; + +[[stage(compute)]] +fn main() { + ignore(t_rgba8unorm_r); + ignore(t_rgba8snorm_r); + ignore(t_rgba8uint_r); + ignore(t_rgba8sint_r); + ignore(t_rgba16uint_r); + ignore(t_rgba16sint_r); + ignore(t_rgba16float_r); + ignore(t_r32uint_r); + ignore(t_r32sint_r); + ignore(t_r32float_r); + ignore(t_rg32uint_r); + ignore(t_rg32sint_r); + ignore(t_rg32float_r); + ignore(t_rgba32uint_r); + ignore(t_rgba32sint_r); + ignore(t_rgba32float_r); + ignore(t_rgba8unorm_w); + ignore(t_rgba8snorm_w); + ignore(t_rgba8uint_w); + ignore(t_rgba8sint_w); + ignore(t_rgba16uint_w); + ignore(t_rgba16sint_w); + ignore(t_rgba16float_w); + ignore(t_r32uint_w); + ignore(t_r32sint_w); + ignore(t_r32float_w); + ignore(t_rg32uint_w); + ignore(t_rg32sint_w); + ignore(t_rg32float_w); + ignore(t_rgba32uint_w); + ignore(t_rgba32sint_w); + ignore(t_rgba32float_w); +} diff --git a/test/types/texture/storage/2d.wgsl.expected.hlsl b/test/types/texture/storage/2d.wgsl.expected.hlsl new file mode 100644 index 0000000000..998ecfbd7c --- /dev/null +++ b/test/types/texture/storage/2d.wgsl.expected.hlsl @@ -0,0 +1,70 @@ +Texture2D t_rgba8unorm_r : register(t0, space0); +Texture2D t_rgba8snorm_r : register(t1, space0); +Texture2D t_rgba8uint_r : register(t2, space0); +Texture2D t_rgba8sint_r : register(t3, space0); +Texture2D t_rgba16uint_r : register(t4, space0); +Texture2D t_rgba16sint_r : register(t5, space0); +Texture2D t_rgba16float_r : register(t6, space0); +Texture2D t_r32uint_r : register(t7, space0); +Texture2D t_r32sint_r : register(t8, space0); +Texture2D t_r32float_r : register(t9, space0); +Texture2D t_rg32uint_r : register(t10, space0); +Texture2D t_rg32sint_r : register(t11, space0); +Texture2D t_rg32float_r : register(t12, space0); +Texture2D t_rgba32uint_r : register(t13, space0); +Texture2D t_rgba32sint_r : register(t14, space0); +Texture2D t_rgba32float_r : register(t15, space0); +RWTexture2D t_rgba8unorm_w : register(u50, space0); +RWTexture2D t_rgba8snorm_w : register(u51, space0); +RWTexture2D t_rgba8uint_w : register(u52, space0); +RWTexture2D t_rgba8sint_w : register(u53, space0); +RWTexture2D t_rgba16uint_w : register(u54, space0); +RWTexture2D t_rgba16sint_w : register(u55, space0); +RWTexture2D t_rgba16float_w : register(u56, space0); +RWTexture2D t_r32uint_w : register(u57, space0); +RWTexture2D t_r32sint_w : register(u58, space0); +RWTexture2D t_r32float_w : register(u59, space0); +RWTexture2D t_rg32uint_w : register(u60, space0); +RWTexture2D t_rg32sint_w : register(u61, space0); +RWTexture2D t_rg32float_w : register(u62, space0); +RWTexture2D t_rgba32uint_w : register(u63, space0); +RWTexture2D t_rgba32sint_w : register(u64, space0); +RWTexture2D t_rgba32float_w : register(u65, space0); + +[numthreads(1, 1, 1)] +void main() { + t_rgba8unorm_r; + t_rgba8snorm_r; + t_rgba8uint_r; + t_rgba8sint_r; + t_rgba16uint_r; + t_rgba16sint_r; + t_rgba16float_r; + t_r32uint_r; + t_r32sint_r; + t_r32float_r; + t_rg32uint_r; + t_rg32sint_r; + t_rg32float_r; + t_rgba32uint_r; + t_rgba32sint_r; + t_rgba32float_r; + t_rgba8unorm_w; + t_rgba8snorm_w; + t_rgba8uint_w; + t_rgba8sint_w; + t_rgba16uint_w; + t_rgba16sint_w; + t_rgba16float_w; + t_r32uint_w; + t_r32sint_w; + t_r32float_w; + t_rg32uint_w; + t_rg32sint_w; + t_rg32float_w; + t_rgba32uint_w; + t_rgba32sint_w; + t_rgba32float_w; + return; +} + diff --git a/test/types/texture/storage/2d.wgsl.expected.msl b/test/types/texture/storage/2d.wgsl.expected.msl new file mode 100644 index 0000000000..ca5b9a1b5b --- /dev/null +++ b/test/types/texture/storage/2d.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +kernel void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], texture2d tint_symbol_2 [[texture(1)]], texture2d tint_symbol_3 [[texture(2)]], texture2d tint_symbol_4 [[texture(3)]], texture2d tint_symbol_5 [[texture(4)]], texture2d tint_symbol_6 [[texture(5)]], texture2d tint_symbol_7 [[texture(6)]], texture2d tint_symbol_8 [[texture(7)]], texture2d tint_symbol_9 [[texture(8)]], texture2d tint_symbol_10 [[texture(9)]], texture2d tint_symbol_11 [[texture(10)]], texture2d tint_symbol_12 [[texture(11)]], texture2d tint_symbol_13 [[texture(12)]], texture2d tint_symbol_14 [[texture(13)]], texture2d tint_symbol_15 [[texture(14)]], texture2d tint_symbol_16 [[texture(15)]], texture2d tint_symbol_17 [[texture(50)]], texture2d tint_symbol_18 [[texture(51)]], texture2d tint_symbol_19 [[texture(52)]], texture2d tint_symbol_20 [[texture(53)]], texture2d tint_symbol_21 [[texture(54)]], texture2d tint_symbol_22 [[texture(55)]], texture2d tint_symbol_23 [[texture(56)]], texture2d tint_symbol_24 [[texture(57)]], texture2d tint_symbol_25 [[texture(58)]], texture2d tint_symbol_26 [[texture(59)]], texture2d tint_symbol_27 [[texture(60)]], texture2d tint_symbol_28 [[texture(61)]], texture2d tint_symbol_29 [[texture(62)]], texture2d tint_symbol_30 [[texture(63)]], texture2d tint_symbol_31 [[texture(64)]], texture2d tint_symbol_32 [[texture(65)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + (void) tint_symbol_4; + (void) tint_symbol_5; + (void) tint_symbol_6; + (void) tint_symbol_7; + (void) tint_symbol_8; + (void) tint_symbol_9; + (void) tint_symbol_10; + (void) tint_symbol_11; + (void) tint_symbol_12; + (void) tint_symbol_13; + (void) tint_symbol_14; + (void) tint_symbol_15; + (void) tint_symbol_16; + (void) tint_symbol_17; + (void) tint_symbol_18; + (void) tint_symbol_19; + (void) tint_symbol_20; + (void) tint_symbol_21; + (void) tint_symbol_22; + (void) tint_symbol_23; + (void) tint_symbol_24; + (void) tint_symbol_25; + (void) tint_symbol_26; + (void) tint_symbol_27; + (void) tint_symbol_28; + (void) tint_symbol_29; + (void) tint_symbol_30; + (void) tint_symbol_31; + (void) tint_symbol_32; + return; +} + diff --git a/test/types/texture/storage/2d.wgsl.expected.spvasm b/test/types/texture/storage/2d.wgsl.expected.spvasm new file mode 100644 index 0000000000..c41c90cd37 --- /dev/null +++ b/test/types/texture/storage/2d.wgsl.expected.spvasm @@ -0,0 +1,260 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 152 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_rgba8unorm_r "t_rgba8unorm_r" + OpName %t_rgba8snorm_r "t_rgba8snorm_r" + OpName %t_rgba8uint_r "t_rgba8uint_r" + OpName %t_rgba8sint_r "t_rgba8sint_r" + OpName %t_rgba16uint_r "t_rgba16uint_r" + OpName %t_rgba16sint_r "t_rgba16sint_r" + OpName %t_rgba16float_r "t_rgba16float_r" + OpName %t_r32uint_r "t_r32uint_r" + OpName %t_r32sint_r "t_r32sint_r" + OpName %t_r32float_r "t_r32float_r" + OpName %t_rg32uint_r "t_rg32uint_r" + OpName %t_rg32sint_r "t_rg32sint_r" + OpName %t_rg32float_r "t_rg32float_r" + OpName %t_rgba32uint_r "t_rgba32uint_r" + OpName %t_rgba32sint_r "t_rgba32sint_r" + OpName %t_rgba32float_r "t_rgba32float_r" + OpName %t_rgba8unorm_w "t_rgba8unorm_w" + OpName %t_rgba8snorm_w "t_rgba8snorm_w" + OpName %t_rgba8uint_w "t_rgba8uint_w" + OpName %t_rgba8sint_w "t_rgba8sint_w" + OpName %t_rgba16uint_w "t_rgba16uint_w" + OpName %t_rgba16sint_w "t_rgba16sint_w" + OpName %t_rgba16float_w "t_rgba16float_w" + OpName %t_r32uint_w "t_r32uint_w" + OpName %t_r32sint_w "t_r32sint_w" + OpName %t_r32float_w "t_r32float_w" + OpName %t_rg32uint_w "t_rg32uint_w" + OpName %t_rg32sint_w "t_rg32sint_w" + OpName %t_rg32float_w "t_rg32float_w" + OpName %t_rgba32uint_w "t_rgba32uint_w" + OpName %t_rgba32sint_w "t_rgba32sint_w" + OpName %t_rgba32float_w "t_rgba32float_w" + OpName %main "main" + OpDecorate %t_rgba8unorm_r NonWritable + OpDecorate %t_rgba8unorm_r DescriptorSet 0 + OpDecorate %t_rgba8unorm_r Binding 0 + OpDecorate %t_rgba8snorm_r NonWritable + OpDecorate %t_rgba8snorm_r DescriptorSet 0 + OpDecorate %t_rgba8snorm_r Binding 1 + OpDecorate %t_rgba8uint_r NonWritable + OpDecorate %t_rgba8uint_r DescriptorSet 0 + OpDecorate %t_rgba8uint_r Binding 2 + OpDecorate %t_rgba8sint_r NonWritable + OpDecorate %t_rgba8sint_r DescriptorSet 0 + OpDecorate %t_rgba8sint_r Binding 3 + OpDecorate %t_rgba16uint_r NonWritable + OpDecorate %t_rgba16uint_r DescriptorSet 0 + OpDecorate %t_rgba16uint_r Binding 4 + OpDecorate %t_rgba16sint_r NonWritable + OpDecorate %t_rgba16sint_r DescriptorSet 0 + OpDecorate %t_rgba16sint_r Binding 5 + OpDecorate %t_rgba16float_r NonWritable + OpDecorate %t_rgba16float_r DescriptorSet 0 + OpDecorate %t_rgba16float_r Binding 6 + OpDecorate %t_r32uint_r NonWritable + OpDecorate %t_r32uint_r DescriptorSet 0 + OpDecorate %t_r32uint_r Binding 7 + OpDecorate %t_r32sint_r NonWritable + OpDecorate %t_r32sint_r DescriptorSet 0 + OpDecorate %t_r32sint_r Binding 8 + OpDecorate %t_r32float_r NonWritable + OpDecorate %t_r32float_r DescriptorSet 0 + OpDecorate %t_r32float_r Binding 9 + OpDecorate %t_rg32uint_r NonWritable + OpDecorate %t_rg32uint_r DescriptorSet 0 + OpDecorate %t_rg32uint_r Binding 10 + OpDecorate %t_rg32sint_r NonWritable + OpDecorate %t_rg32sint_r DescriptorSet 0 + OpDecorate %t_rg32sint_r Binding 11 + OpDecorate %t_rg32float_r NonWritable + OpDecorate %t_rg32float_r DescriptorSet 0 + OpDecorate %t_rg32float_r Binding 12 + OpDecorate %t_rgba32uint_r NonWritable + OpDecorate %t_rgba32uint_r DescriptorSet 0 + OpDecorate %t_rgba32uint_r Binding 13 + OpDecorate %t_rgba32sint_r NonWritable + OpDecorate %t_rgba32sint_r DescriptorSet 0 + OpDecorate %t_rgba32sint_r Binding 14 + OpDecorate %t_rgba32float_r NonWritable + OpDecorate %t_rgba32float_r DescriptorSet 0 + OpDecorate %t_rgba32float_r Binding 15 + OpDecorate %t_rgba8unorm_w NonReadable + OpDecorate %t_rgba8unorm_w DescriptorSet 0 + OpDecorate %t_rgba8unorm_w Binding 50 + OpDecorate %t_rgba8snorm_w NonReadable + OpDecorate %t_rgba8snorm_w DescriptorSet 0 + OpDecorate %t_rgba8snorm_w Binding 51 + OpDecorate %t_rgba8uint_w NonReadable + OpDecorate %t_rgba8uint_w DescriptorSet 0 + OpDecorate %t_rgba8uint_w Binding 52 + OpDecorate %t_rgba8sint_w NonReadable + OpDecorate %t_rgba8sint_w DescriptorSet 0 + OpDecorate %t_rgba8sint_w Binding 53 + OpDecorate %t_rgba16uint_w NonReadable + OpDecorate %t_rgba16uint_w DescriptorSet 0 + OpDecorate %t_rgba16uint_w Binding 54 + OpDecorate %t_rgba16sint_w NonReadable + OpDecorate %t_rgba16sint_w DescriptorSet 0 + OpDecorate %t_rgba16sint_w Binding 55 + OpDecorate %t_rgba16float_w NonReadable + OpDecorate %t_rgba16float_w DescriptorSet 0 + OpDecorate %t_rgba16float_w Binding 56 + OpDecorate %t_r32uint_w NonReadable + OpDecorate %t_r32uint_w DescriptorSet 0 + OpDecorate %t_r32uint_w Binding 57 + OpDecorate %t_r32sint_w NonReadable + OpDecorate %t_r32sint_w DescriptorSet 0 + OpDecorate %t_r32sint_w Binding 58 + OpDecorate %t_r32float_w NonReadable + OpDecorate %t_r32float_w DescriptorSet 0 + OpDecorate %t_r32float_w Binding 59 + OpDecorate %t_rg32uint_w NonReadable + OpDecorate %t_rg32uint_w DescriptorSet 0 + OpDecorate %t_rg32uint_w Binding 60 + OpDecorate %t_rg32sint_w NonReadable + OpDecorate %t_rg32sint_w DescriptorSet 0 + OpDecorate %t_rg32sint_w Binding 61 + OpDecorate %t_rg32float_w NonReadable + OpDecorate %t_rg32float_w DescriptorSet 0 + OpDecorate %t_rg32float_w Binding 62 + OpDecorate %t_rgba32uint_w NonReadable + OpDecorate %t_rgba32uint_w DescriptorSet 0 + OpDecorate %t_rgba32uint_w Binding 63 + OpDecorate %t_rgba32sint_w NonReadable + OpDecorate %t_rgba32sint_w DescriptorSet 0 + OpDecorate %t_rgba32sint_w Binding 64 + OpDecorate %t_rgba32float_w NonReadable + OpDecorate %t_rgba32float_w DescriptorSet 0 + OpDecorate %t_rgba32float_w Binding 65 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 +%t_rgba8unorm_r = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeImage %float 2D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 +%t_rgba8snorm_r = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %10 = OpTypeImage %uint 2D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 +%t_rgba8uint_r = OpVariable %_ptr_UniformConstant_10 UniformConstant + %int = OpTypeInt 32 1 + %14 = OpTypeImage %int 2D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 +%t_rgba8sint_r = OpVariable %_ptr_UniformConstant_14 UniformConstant + %18 = OpTypeImage %uint 2D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 +%t_rgba16uint_r = OpVariable %_ptr_UniformConstant_18 UniformConstant + %21 = OpTypeImage %int 2D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_21 = OpTypePointer UniformConstant %21 +%t_rgba16sint_r = OpVariable %_ptr_UniformConstant_21 UniformConstant + %24 = OpTypeImage %float 2D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24 +%t_rgba16float_r = OpVariable %_ptr_UniformConstant_24 UniformConstant + %27 = OpTypeImage %uint 2D 0 0 0 2 R32ui +%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27 +%t_r32uint_r = OpVariable %_ptr_UniformConstant_27 UniformConstant + %30 = OpTypeImage %int 2D 0 0 0 2 R32i +%_ptr_UniformConstant_30 = OpTypePointer UniformConstant %30 +%t_r32sint_r = OpVariable %_ptr_UniformConstant_30 UniformConstant + %33 = OpTypeImage %float 2D 0 0 0 2 R32f +%_ptr_UniformConstant_33 = OpTypePointer UniformConstant %33 +%t_r32float_r = OpVariable %_ptr_UniformConstant_33 UniformConstant + %36 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_36 = OpTypePointer UniformConstant %36 +%t_rg32uint_r = OpVariable %_ptr_UniformConstant_36 UniformConstant + %39 = OpTypeImage %int 2D 0 0 0 2 Rg32i +%_ptr_UniformConstant_39 = OpTypePointer UniformConstant %39 +%t_rg32sint_r = OpVariable %_ptr_UniformConstant_39 UniformConstant + %42 = OpTypeImage %float 2D 0 0 0 2 Rg32f +%_ptr_UniformConstant_42 = OpTypePointer UniformConstant %42 +%t_rg32float_r = OpVariable %_ptr_UniformConstant_42 UniformConstant + %45 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_45 = OpTypePointer UniformConstant %45 +%t_rgba32uint_r = OpVariable %_ptr_UniformConstant_45 UniformConstant + %48 = OpTypeImage %int 2D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_48 = OpTypePointer UniformConstant %48 +%t_rgba32sint_r = OpVariable %_ptr_UniformConstant_48 UniformConstant + %51 = OpTypeImage %float 2D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51 +%t_rgba32float_r = OpVariable %_ptr_UniformConstant_51 UniformConstant +%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3 +%t_rgba8unorm_w = OpVariable %_ptr_UniformConstant_3_0 UniformConstant +%_ptr_UniformConstant_7_0 = OpTypePointer UniformConstant %7 +%t_rgba8snorm_w = OpVariable %_ptr_UniformConstant_7_0 UniformConstant +%_ptr_UniformConstant_10_0 = OpTypePointer UniformConstant %10 +%t_rgba8uint_w = OpVariable %_ptr_UniformConstant_10_0 UniformConstant +%_ptr_UniformConstant_14_0 = OpTypePointer UniformConstant %14 +%t_rgba8sint_w = OpVariable %_ptr_UniformConstant_14_0 UniformConstant +%_ptr_UniformConstant_18_0 = OpTypePointer UniformConstant %18 +%t_rgba16uint_w = OpVariable %_ptr_UniformConstant_18_0 UniformConstant +%_ptr_UniformConstant_21_0 = OpTypePointer UniformConstant %21 +%t_rgba16sint_w = OpVariable %_ptr_UniformConstant_21_0 UniformConstant +%_ptr_UniformConstant_24_0 = OpTypePointer UniformConstant %24 +%t_rgba16float_w = OpVariable %_ptr_UniformConstant_24_0 UniformConstant +%_ptr_UniformConstant_27_0 = OpTypePointer UniformConstant %27 +%t_r32uint_w = OpVariable %_ptr_UniformConstant_27_0 UniformConstant +%_ptr_UniformConstant_30_0 = OpTypePointer UniformConstant %30 +%t_r32sint_w = OpVariable %_ptr_UniformConstant_30_0 UniformConstant +%_ptr_UniformConstant_33_0 = OpTypePointer UniformConstant %33 +%t_r32float_w = OpVariable %_ptr_UniformConstant_33_0 UniformConstant +%_ptr_UniformConstant_36_0 = OpTypePointer UniformConstant %36 +%t_rg32uint_w = OpVariable %_ptr_UniformConstant_36_0 UniformConstant +%_ptr_UniformConstant_39_0 = OpTypePointer UniformConstant %39 +%t_rg32sint_w = OpVariable %_ptr_UniformConstant_39_0 UniformConstant +%_ptr_UniformConstant_42_0 = OpTypePointer UniformConstant %42 +%t_rg32float_w = OpVariable %_ptr_UniformConstant_42_0 UniformConstant +%_ptr_UniformConstant_45_0 = OpTypePointer UniformConstant %45 +%t_rgba32uint_w = OpVariable %_ptr_UniformConstant_45_0 UniformConstant +%_ptr_UniformConstant_48_0 = OpTypePointer UniformConstant %48 +%t_rgba32sint_w = OpVariable %_ptr_UniformConstant_48_0 UniformConstant +%_ptr_UniformConstant_51_0 = OpTypePointer UniformConstant %51 +%t_rgba32float_w = OpVariable %_ptr_UniformConstant_51_0 UniformConstant + %void = OpTypeVoid + %84 = OpTypeFunction %void + %main = OpFunction %void None %84 + %87 = OpLabel + %89 = OpLoad %3 %t_rgba8unorm_r + %91 = OpLoad %7 %t_rgba8snorm_r + %93 = OpLoad %10 %t_rgba8uint_r + %95 = OpLoad %14 %t_rgba8sint_r + %97 = OpLoad %18 %t_rgba16uint_r + %99 = OpLoad %21 %t_rgba16sint_r + %101 = OpLoad %24 %t_rgba16float_r + %103 = OpLoad %27 %t_r32uint_r + %105 = OpLoad %30 %t_r32sint_r + %107 = OpLoad %33 %t_r32float_r + %109 = OpLoad %36 %t_rg32uint_r + %111 = OpLoad %39 %t_rg32sint_r + %113 = OpLoad %42 %t_rg32float_r + %115 = OpLoad %45 %t_rgba32uint_r + %117 = OpLoad %48 %t_rgba32sint_r + %119 = OpLoad %51 %t_rgba32float_r + %121 = OpLoad %3 %t_rgba8unorm_w + %123 = OpLoad %7 %t_rgba8snorm_w + %125 = OpLoad %10 %t_rgba8uint_w + %127 = OpLoad %14 %t_rgba8sint_w + %129 = OpLoad %18 %t_rgba16uint_w + %131 = OpLoad %21 %t_rgba16sint_w + %133 = OpLoad %24 %t_rgba16float_w + %135 = OpLoad %27 %t_r32uint_w + %137 = OpLoad %30 %t_r32sint_w + %139 = OpLoad %33 %t_r32float_w + %141 = OpLoad %36 %t_rg32uint_w + %143 = OpLoad %39 %t_rg32sint_w + %145 = OpLoad %42 %t_rg32float_w + %147 = OpLoad %45 %t_rgba32uint_w + %149 = OpLoad %48 %t_rgba32sint_w + %151 = OpLoad %51 %t_rgba32float_w + OpReturn + OpFunctionEnd diff --git a/test/types/texture/storage/2d.wgsl.expected.wgsl b/test/types/texture/storage/2d.wgsl.expected.wgsl new file mode 100644 index 0000000000..28750a3f4d --- /dev/null +++ b/test/types/texture/storage/2d.wgsl.expected.wgsl @@ -0,0 +1,99 @@ +[[group(0), binding(0)]] var t_rgba8unorm_r : texture_storage_2d; + +[[group(0), binding(1)]] var t_rgba8snorm_r : texture_storage_2d; + +[[group(0), binding(2)]] var t_rgba8uint_r : texture_storage_2d; + +[[group(0), binding(3)]] var t_rgba8sint_r : texture_storage_2d; + +[[group(0), binding(4)]] var t_rgba16uint_r : texture_storage_2d; + +[[group(0), binding(5)]] var t_rgba16sint_r : texture_storage_2d; + +[[group(0), binding(6)]] var t_rgba16float_r : texture_storage_2d; + +[[group(0), binding(7)]] var t_r32uint_r : texture_storage_2d; + +[[group(0), binding(8)]] var t_r32sint_r : texture_storage_2d; + +[[group(0), binding(9)]] var t_r32float_r : texture_storage_2d; + +[[group(0), binding(10)]] var t_rg32uint_r : texture_storage_2d; + +[[group(0), binding(11)]] var t_rg32sint_r : texture_storage_2d; + +[[group(0), binding(12)]] var t_rg32float_r : texture_storage_2d; + +[[group(0), binding(13)]] var t_rgba32uint_r : texture_storage_2d; + +[[group(0), binding(14)]] var t_rgba32sint_r : texture_storage_2d; + +[[group(0), binding(15)]] var t_rgba32float_r : texture_storage_2d; + +[[group(0), binding(50)]] var t_rgba8unorm_w : texture_storage_2d; + +[[group(0), binding(51)]] var t_rgba8snorm_w : texture_storage_2d; + +[[group(0), binding(52)]] var t_rgba8uint_w : texture_storage_2d; + +[[group(0), binding(53)]] var t_rgba8sint_w : texture_storage_2d; + +[[group(0), binding(54)]] var t_rgba16uint_w : texture_storage_2d; + +[[group(0), binding(55)]] var t_rgba16sint_w : texture_storage_2d; + +[[group(0), binding(56)]] var t_rgba16float_w : texture_storage_2d; + +[[group(0), binding(57)]] var t_r32uint_w : texture_storage_2d; + +[[group(0), binding(58)]] var t_r32sint_w : texture_storage_2d; + +[[group(0), binding(59)]] var t_r32float_w : texture_storage_2d; + +[[group(0), binding(60)]] var t_rg32uint_w : texture_storage_2d; + +[[group(0), binding(61)]] var t_rg32sint_w : texture_storage_2d; + +[[group(0), binding(62)]] var t_rg32float_w : texture_storage_2d; + +[[group(0), binding(63)]] var t_rgba32uint_w : texture_storage_2d; + +[[group(0), binding(64)]] var t_rgba32sint_w : texture_storage_2d; + +[[group(0), binding(65)]] var t_rgba32float_w : texture_storage_2d; + +[[stage(compute)]] +fn main() { + ignore(t_rgba8unorm_r); + ignore(t_rgba8snorm_r); + ignore(t_rgba8uint_r); + ignore(t_rgba8sint_r); + ignore(t_rgba16uint_r); + ignore(t_rgba16sint_r); + ignore(t_rgba16float_r); + ignore(t_r32uint_r); + ignore(t_r32sint_r); + ignore(t_r32float_r); + ignore(t_rg32uint_r); + ignore(t_rg32sint_r); + ignore(t_rg32float_r); + ignore(t_rgba32uint_r); + ignore(t_rgba32sint_r); + ignore(t_rgba32float_r); + ignore(t_rgba8unorm_w); + ignore(t_rgba8snorm_w); + ignore(t_rgba8uint_w); + ignore(t_rgba8sint_w); + ignore(t_rgba16uint_w); + ignore(t_rgba16sint_w); + ignore(t_rgba16float_w); + ignore(t_r32uint_w); + ignore(t_r32sint_w); + ignore(t_r32float_w); + ignore(t_rg32uint_w); + ignore(t_rg32sint_w); + ignore(t_rg32float_w); + ignore(t_rgba32uint_w); + ignore(t_rgba32sint_w); + ignore(t_rgba32float_w); +} diff --git a/test/types/texture/storage/2d_array.wgsl b/test/types/texture/storage/2d_array.wgsl new file mode 100644 index 0000000000..ca8fc03203 --- /dev/null +++ b/test/types/texture/storage/2d_array.wgsl @@ -0,0 +1,68 @@ +[[group(0), binding(0)]] var t_rgba8unorm_r : texture_storage_2d_array; +[[group(0), binding(1)]] var t_rgba8snorm_r : texture_storage_2d_array; +[[group(0), binding(2)]] var t_rgba8uint_r : texture_storage_2d_array; +[[group(0), binding(3)]] var t_rgba8sint_r : texture_storage_2d_array; +[[group(0), binding(4)]] var t_rgba16uint_r : texture_storage_2d_array; +[[group(0), binding(5)]] var t_rgba16sint_r : texture_storage_2d_array; +[[group(0), binding(6)]] var t_rgba16float_r : texture_storage_2d_array; +[[group(0), binding(7)]] var t_r32uint_r : texture_storage_2d_array; +[[group(0), binding(8)]] var t_r32sint_r : texture_storage_2d_array; +[[group(0), binding(9)]] var t_r32float_r : texture_storage_2d_array; +[[group(0), binding(10)]] var t_rg32uint_r : texture_storage_2d_array; +[[group(0), binding(11)]] var t_rg32sint_r : texture_storage_2d_array; +[[group(0), binding(12)]] var t_rg32float_r : texture_storage_2d_array; +[[group(0), binding(13)]] var t_rgba32uint_r : texture_storage_2d_array; +[[group(0), binding(14)]] var t_rgba32sint_r : texture_storage_2d_array; +[[group(0), binding(15)]] var t_rgba32float_r : texture_storage_2d_array; +[[group(0), binding(50)]] var t_rgba8unorm_w : texture_storage_2d_array; +[[group(0), binding(51)]] var t_rgba8snorm_w : texture_storage_2d_array; +[[group(0), binding(52)]] var t_rgba8uint_w : texture_storage_2d_array; +[[group(0), binding(53)]] var t_rgba8sint_w : texture_storage_2d_array; +[[group(0), binding(54)]] var t_rgba16uint_w : texture_storage_2d_array; +[[group(0), binding(55)]] var t_rgba16sint_w : texture_storage_2d_array; +[[group(0), binding(56)]] var t_rgba16float_w : texture_storage_2d_array; +[[group(0), binding(57)]] var t_r32uint_w : texture_storage_2d_array; +[[group(0), binding(58)]] var t_r32sint_w : texture_storage_2d_array; +[[group(0), binding(59)]] var t_r32float_w : texture_storage_2d_array; +[[group(0), binding(60)]] var t_rg32uint_w : texture_storage_2d_array; +[[group(0), binding(61)]] var t_rg32sint_w : texture_storage_2d_array; +[[group(0), binding(62)]] var t_rg32float_w : texture_storage_2d_array; +[[group(0), binding(63)]] var t_rgba32uint_w : texture_storage_2d_array; +[[group(0), binding(64)]] var t_rgba32sint_w : texture_storage_2d_array; +[[group(0), binding(65)]] var t_rgba32float_w : texture_storage_2d_array; + +[[stage(compute)]] +fn main() { + ignore(t_rgba8unorm_r); + ignore(t_rgba8snorm_r); + ignore(t_rgba8uint_r); + ignore(t_rgba8sint_r); + ignore(t_rgba16uint_r); + ignore(t_rgba16sint_r); + ignore(t_rgba16float_r); + ignore(t_r32uint_r); + ignore(t_r32sint_r); + ignore(t_r32float_r); + ignore(t_rg32uint_r); + ignore(t_rg32sint_r); + ignore(t_rg32float_r); + ignore(t_rgba32uint_r); + ignore(t_rgba32sint_r); + ignore(t_rgba32float_r); + ignore(t_rgba8unorm_w); + ignore(t_rgba8snorm_w); + ignore(t_rgba8uint_w); + ignore(t_rgba8sint_w); + ignore(t_rgba16uint_w); + ignore(t_rgba16sint_w); + ignore(t_rgba16float_w); + ignore(t_r32uint_w); + ignore(t_r32sint_w); + ignore(t_r32float_w); + ignore(t_rg32uint_w); + ignore(t_rg32sint_w); + ignore(t_rg32float_w); + ignore(t_rgba32uint_w); + ignore(t_rgba32sint_w); + ignore(t_rgba32float_w); +} diff --git a/test/types/texture/storage/2d_array.wgsl.expected.hlsl b/test/types/texture/storage/2d_array.wgsl.expected.hlsl new file mode 100644 index 0000000000..b5ea5c119e --- /dev/null +++ b/test/types/texture/storage/2d_array.wgsl.expected.hlsl @@ -0,0 +1,70 @@ +Texture2DArray t_rgba8unorm_r : register(t0, space0); +Texture2DArray t_rgba8snorm_r : register(t1, space0); +Texture2DArray t_rgba8uint_r : register(t2, space0); +Texture2DArray t_rgba8sint_r : register(t3, space0); +Texture2DArray t_rgba16uint_r : register(t4, space0); +Texture2DArray t_rgba16sint_r : register(t5, space0); +Texture2DArray t_rgba16float_r : register(t6, space0); +Texture2DArray t_r32uint_r : register(t7, space0); +Texture2DArray t_r32sint_r : register(t8, space0); +Texture2DArray t_r32float_r : register(t9, space0); +Texture2DArray t_rg32uint_r : register(t10, space0); +Texture2DArray t_rg32sint_r : register(t11, space0); +Texture2DArray t_rg32float_r : register(t12, space0); +Texture2DArray t_rgba32uint_r : register(t13, space0); +Texture2DArray t_rgba32sint_r : register(t14, space0); +Texture2DArray t_rgba32float_r : register(t15, space0); +RWTexture2DArray t_rgba8unorm_w : register(u50, space0); +RWTexture2DArray t_rgba8snorm_w : register(u51, space0); +RWTexture2DArray t_rgba8uint_w : register(u52, space0); +RWTexture2DArray t_rgba8sint_w : register(u53, space0); +RWTexture2DArray t_rgba16uint_w : register(u54, space0); +RWTexture2DArray t_rgba16sint_w : register(u55, space0); +RWTexture2DArray t_rgba16float_w : register(u56, space0); +RWTexture2DArray t_r32uint_w : register(u57, space0); +RWTexture2DArray t_r32sint_w : register(u58, space0); +RWTexture2DArray t_r32float_w : register(u59, space0); +RWTexture2DArray t_rg32uint_w : register(u60, space0); +RWTexture2DArray t_rg32sint_w : register(u61, space0); +RWTexture2DArray t_rg32float_w : register(u62, space0); +RWTexture2DArray t_rgba32uint_w : register(u63, space0); +RWTexture2DArray t_rgba32sint_w : register(u64, space0); +RWTexture2DArray t_rgba32float_w : register(u65, space0); + +[numthreads(1, 1, 1)] +void main() { + t_rgba8unorm_r; + t_rgba8snorm_r; + t_rgba8uint_r; + t_rgba8sint_r; + t_rgba16uint_r; + t_rgba16sint_r; + t_rgba16float_r; + t_r32uint_r; + t_r32sint_r; + t_r32float_r; + t_rg32uint_r; + t_rg32sint_r; + t_rg32float_r; + t_rgba32uint_r; + t_rgba32sint_r; + t_rgba32float_r; + t_rgba8unorm_w; + t_rgba8snorm_w; + t_rgba8uint_w; + t_rgba8sint_w; + t_rgba16uint_w; + t_rgba16sint_w; + t_rgba16float_w; + t_r32uint_w; + t_r32sint_w; + t_r32float_w; + t_rg32uint_w; + t_rg32sint_w; + t_rg32float_w; + t_rgba32uint_w; + t_rgba32sint_w; + t_rgba32float_w; + return; +} + diff --git a/test/types/texture/storage/2d_array.wgsl.expected.msl b/test/types/texture/storage/2d_array.wgsl.expected.msl new file mode 100644 index 0000000000..9678bd3272 --- /dev/null +++ b/test/types/texture/storage/2d_array.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +kernel void tint_symbol(texture2d_array tint_symbol_1 [[texture(0)]], texture2d_array tint_symbol_2 [[texture(1)]], texture2d_array tint_symbol_3 [[texture(2)]], texture2d_array tint_symbol_4 [[texture(3)]], texture2d_array tint_symbol_5 [[texture(4)]], texture2d_array tint_symbol_6 [[texture(5)]], texture2d_array tint_symbol_7 [[texture(6)]], texture2d_array tint_symbol_8 [[texture(7)]], texture2d_array tint_symbol_9 [[texture(8)]], texture2d_array tint_symbol_10 [[texture(9)]], texture2d_array tint_symbol_11 [[texture(10)]], texture2d_array tint_symbol_12 [[texture(11)]], texture2d_array tint_symbol_13 [[texture(12)]], texture2d_array tint_symbol_14 [[texture(13)]], texture2d_array tint_symbol_15 [[texture(14)]], texture2d_array tint_symbol_16 [[texture(15)]], texture2d_array tint_symbol_17 [[texture(50)]], texture2d_array tint_symbol_18 [[texture(51)]], texture2d_array tint_symbol_19 [[texture(52)]], texture2d_array tint_symbol_20 [[texture(53)]], texture2d_array tint_symbol_21 [[texture(54)]], texture2d_array tint_symbol_22 [[texture(55)]], texture2d_array tint_symbol_23 [[texture(56)]], texture2d_array tint_symbol_24 [[texture(57)]], texture2d_array tint_symbol_25 [[texture(58)]], texture2d_array tint_symbol_26 [[texture(59)]], texture2d_array tint_symbol_27 [[texture(60)]], texture2d_array tint_symbol_28 [[texture(61)]], texture2d_array tint_symbol_29 [[texture(62)]], texture2d_array tint_symbol_30 [[texture(63)]], texture2d_array tint_symbol_31 [[texture(64)]], texture2d_array tint_symbol_32 [[texture(65)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + (void) tint_symbol_4; + (void) tint_symbol_5; + (void) tint_symbol_6; + (void) tint_symbol_7; + (void) tint_symbol_8; + (void) tint_symbol_9; + (void) tint_symbol_10; + (void) tint_symbol_11; + (void) tint_symbol_12; + (void) tint_symbol_13; + (void) tint_symbol_14; + (void) tint_symbol_15; + (void) tint_symbol_16; + (void) tint_symbol_17; + (void) tint_symbol_18; + (void) tint_symbol_19; + (void) tint_symbol_20; + (void) tint_symbol_21; + (void) tint_symbol_22; + (void) tint_symbol_23; + (void) tint_symbol_24; + (void) tint_symbol_25; + (void) tint_symbol_26; + (void) tint_symbol_27; + (void) tint_symbol_28; + (void) tint_symbol_29; + (void) tint_symbol_30; + (void) tint_symbol_31; + (void) tint_symbol_32; + return; +} + diff --git a/test/types/texture/storage/2d_array.wgsl.expected.spvasm b/test/types/texture/storage/2d_array.wgsl.expected.spvasm new file mode 100644 index 0000000000..998c280c4a --- /dev/null +++ b/test/types/texture/storage/2d_array.wgsl.expected.spvasm @@ -0,0 +1,260 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 152 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_rgba8unorm_r "t_rgba8unorm_r" + OpName %t_rgba8snorm_r "t_rgba8snorm_r" + OpName %t_rgba8uint_r "t_rgba8uint_r" + OpName %t_rgba8sint_r "t_rgba8sint_r" + OpName %t_rgba16uint_r "t_rgba16uint_r" + OpName %t_rgba16sint_r "t_rgba16sint_r" + OpName %t_rgba16float_r "t_rgba16float_r" + OpName %t_r32uint_r "t_r32uint_r" + OpName %t_r32sint_r "t_r32sint_r" + OpName %t_r32float_r "t_r32float_r" + OpName %t_rg32uint_r "t_rg32uint_r" + OpName %t_rg32sint_r "t_rg32sint_r" + OpName %t_rg32float_r "t_rg32float_r" + OpName %t_rgba32uint_r "t_rgba32uint_r" + OpName %t_rgba32sint_r "t_rgba32sint_r" + OpName %t_rgba32float_r "t_rgba32float_r" + OpName %t_rgba8unorm_w "t_rgba8unorm_w" + OpName %t_rgba8snorm_w "t_rgba8snorm_w" + OpName %t_rgba8uint_w "t_rgba8uint_w" + OpName %t_rgba8sint_w "t_rgba8sint_w" + OpName %t_rgba16uint_w "t_rgba16uint_w" + OpName %t_rgba16sint_w "t_rgba16sint_w" + OpName %t_rgba16float_w "t_rgba16float_w" + OpName %t_r32uint_w "t_r32uint_w" + OpName %t_r32sint_w "t_r32sint_w" + OpName %t_r32float_w "t_r32float_w" + OpName %t_rg32uint_w "t_rg32uint_w" + OpName %t_rg32sint_w "t_rg32sint_w" + OpName %t_rg32float_w "t_rg32float_w" + OpName %t_rgba32uint_w "t_rgba32uint_w" + OpName %t_rgba32sint_w "t_rgba32sint_w" + OpName %t_rgba32float_w "t_rgba32float_w" + OpName %main "main" + OpDecorate %t_rgba8unorm_r NonWritable + OpDecorate %t_rgba8unorm_r DescriptorSet 0 + OpDecorate %t_rgba8unorm_r Binding 0 + OpDecorate %t_rgba8snorm_r NonWritable + OpDecorate %t_rgba8snorm_r DescriptorSet 0 + OpDecorate %t_rgba8snorm_r Binding 1 + OpDecorate %t_rgba8uint_r NonWritable + OpDecorate %t_rgba8uint_r DescriptorSet 0 + OpDecorate %t_rgba8uint_r Binding 2 + OpDecorate %t_rgba8sint_r NonWritable + OpDecorate %t_rgba8sint_r DescriptorSet 0 + OpDecorate %t_rgba8sint_r Binding 3 + OpDecorate %t_rgba16uint_r NonWritable + OpDecorate %t_rgba16uint_r DescriptorSet 0 + OpDecorate %t_rgba16uint_r Binding 4 + OpDecorate %t_rgba16sint_r NonWritable + OpDecorate %t_rgba16sint_r DescriptorSet 0 + OpDecorate %t_rgba16sint_r Binding 5 + OpDecorate %t_rgba16float_r NonWritable + OpDecorate %t_rgba16float_r DescriptorSet 0 + OpDecorate %t_rgba16float_r Binding 6 + OpDecorate %t_r32uint_r NonWritable + OpDecorate %t_r32uint_r DescriptorSet 0 + OpDecorate %t_r32uint_r Binding 7 + OpDecorate %t_r32sint_r NonWritable + OpDecorate %t_r32sint_r DescriptorSet 0 + OpDecorate %t_r32sint_r Binding 8 + OpDecorate %t_r32float_r NonWritable + OpDecorate %t_r32float_r DescriptorSet 0 + OpDecorate %t_r32float_r Binding 9 + OpDecorate %t_rg32uint_r NonWritable + OpDecorate %t_rg32uint_r DescriptorSet 0 + OpDecorate %t_rg32uint_r Binding 10 + OpDecorate %t_rg32sint_r NonWritable + OpDecorate %t_rg32sint_r DescriptorSet 0 + OpDecorate %t_rg32sint_r Binding 11 + OpDecorate %t_rg32float_r NonWritable + OpDecorate %t_rg32float_r DescriptorSet 0 + OpDecorate %t_rg32float_r Binding 12 + OpDecorate %t_rgba32uint_r NonWritable + OpDecorate %t_rgba32uint_r DescriptorSet 0 + OpDecorate %t_rgba32uint_r Binding 13 + OpDecorate %t_rgba32sint_r NonWritable + OpDecorate %t_rgba32sint_r DescriptorSet 0 + OpDecorate %t_rgba32sint_r Binding 14 + OpDecorate %t_rgba32float_r NonWritable + OpDecorate %t_rgba32float_r DescriptorSet 0 + OpDecorate %t_rgba32float_r Binding 15 + OpDecorate %t_rgba8unorm_w NonReadable + OpDecorate %t_rgba8unorm_w DescriptorSet 0 + OpDecorate %t_rgba8unorm_w Binding 50 + OpDecorate %t_rgba8snorm_w NonReadable + OpDecorate %t_rgba8snorm_w DescriptorSet 0 + OpDecorate %t_rgba8snorm_w Binding 51 + OpDecorate %t_rgba8uint_w NonReadable + OpDecorate %t_rgba8uint_w DescriptorSet 0 + OpDecorate %t_rgba8uint_w Binding 52 + OpDecorate %t_rgba8sint_w NonReadable + OpDecorate %t_rgba8sint_w DescriptorSet 0 + OpDecorate %t_rgba8sint_w Binding 53 + OpDecorate %t_rgba16uint_w NonReadable + OpDecorate %t_rgba16uint_w DescriptorSet 0 + OpDecorate %t_rgba16uint_w Binding 54 + OpDecorate %t_rgba16sint_w NonReadable + OpDecorate %t_rgba16sint_w DescriptorSet 0 + OpDecorate %t_rgba16sint_w Binding 55 + OpDecorate %t_rgba16float_w NonReadable + OpDecorate %t_rgba16float_w DescriptorSet 0 + OpDecorate %t_rgba16float_w Binding 56 + OpDecorate %t_r32uint_w NonReadable + OpDecorate %t_r32uint_w DescriptorSet 0 + OpDecorate %t_r32uint_w Binding 57 + OpDecorate %t_r32sint_w NonReadable + OpDecorate %t_r32sint_w DescriptorSet 0 + OpDecorate %t_r32sint_w Binding 58 + OpDecorate %t_r32float_w NonReadable + OpDecorate %t_r32float_w DescriptorSet 0 + OpDecorate %t_r32float_w Binding 59 + OpDecorate %t_rg32uint_w NonReadable + OpDecorate %t_rg32uint_w DescriptorSet 0 + OpDecorate %t_rg32uint_w Binding 60 + OpDecorate %t_rg32sint_w NonReadable + OpDecorate %t_rg32sint_w DescriptorSet 0 + OpDecorate %t_rg32sint_w Binding 61 + OpDecorate %t_rg32float_w NonReadable + OpDecorate %t_rg32float_w DescriptorSet 0 + OpDecorate %t_rg32float_w Binding 62 + OpDecorate %t_rgba32uint_w NonReadable + OpDecorate %t_rgba32uint_w DescriptorSet 0 + OpDecorate %t_rgba32uint_w Binding 63 + OpDecorate %t_rgba32sint_w NonReadable + OpDecorate %t_rgba32sint_w DescriptorSet 0 + OpDecorate %t_rgba32sint_w Binding 64 + OpDecorate %t_rgba32float_w NonReadable + OpDecorate %t_rgba32float_w DescriptorSet 0 + OpDecorate %t_rgba32float_w Binding 65 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 2D 0 1 0 2 Rgba8 +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 +%t_rgba8unorm_r = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 +%t_rgba8snorm_r = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %10 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 +%t_rgba8uint_r = OpVariable %_ptr_UniformConstant_10 UniformConstant + %int = OpTypeInt 32 1 + %14 = OpTypeImage %int 2D 0 1 0 2 Rgba8i +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 +%t_rgba8sint_r = OpVariable %_ptr_UniformConstant_14 UniformConstant + %18 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 +%t_rgba16uint_r = OpVariable %_ptr_UniformConstant_18 UniformConstant + %21 = OpTypeImage %int 2D 0 1 0 2 Rgba16i +%_ptr_UniformConstant_21 = OpTypePointer UniformConstant %21 +%t_rgba16sint_r = OpVariable %_ptr_UniformConstant_21 UniformConstant + %24 = OpTypeImage %float 2D 0 1 0 2 Rgba16f +%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24 +%t_rgba16float_r = OpVariable %_ptr_UniformConstant_24 UniformConstant + %27 = OpTypeImage %uint 2D 0 1 0 2 R32ui +%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27 +%t_r32uint_r = OpVariable %_ptr_UniformConstant_27 UniformConstant + %30 = OpTypeImage %int 2D 0 1 0 2 R32i +%_ptr_UniformConstant_30 = OpTypePointer UniformConstant %30 +%t_r32sint_r = OpVariable %_ptr_UniformConstant_30 UniformConstant + %33 = OpTypeImage %float 2D 0 1 0 2 R32f +%_ptr_UniformConstant_33 = OpTypePointer UniformConstant %33 +%t_r32float_r = OpVariable %_ptr_UniformConstant_33 UniformConstant + %36 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui +%_ptr_UniformConstant_36 = OpTypePointer UniformConstant %36 +%t_rg32uint_r = OpVariable %_ptr_UniformConstant_36 UniformConstant + %39 = OpTypeImage %int 2D 0 1 0 2 Rg32i +%_ptr_UniformConstant_39 = OpTypePointer UniformConstant %39 +%t_rg32sint_r = OpVariable %_ptr_UniformConstant_39 UniformConstant + %42 = OpTypeImage %float 2D 0 1 0 2 Rg32f +%_ptr_UniformConstant_42 = OpTypePointer UniformConstant %42 +%t_rg32float_r = OpVariable %_ptr_UniformConstant_42 UniformConstant + %45 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui +%_ptr_UniformConstant_45 = OpTypePointer UniformConstant %45 +%t_rgba32uint_r = OpVariable %_ptr_UniformConstant_45 UniformConstant + %48 = OpTypeImage %int 2D 0 1 0 2 Rgba32i +%_ptr_UniformConstant_48 = OpTypePointer UniformConstant %48 +%t_rgba32sint_r = OpVariable %_ptr_UniformConstant_48 UniformConstant + %51 = OpTypeImage %float 2D 0 1 0 2 Rgba32f +%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51 +%t_rgba32float_r = OpVariable %_ptr_UniformConstant_51 UniformConstant +%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3 +%t_rgba8unorm_w = OpVariable %_ptr_UniformConstant_3_0 UniformConstant +%_ptr_UniformConstant_7_0 = OpTypePointer UniformConstant %7 +%t_rgba8snorm_w = OpVariable %_ptr_UniformConstant_7_0 UniformConstant +%_ptr_UniformConstant_10_0 = OpTypePointer UniformConstant %10 +%t_rgba8uint_w = OpVariable %_ptr_UniformConstant_10_0 UniformConstant +%_ptr_UniformConstant_14_0 = OpTypePointer UniformConstant %14 +%t_rgba8sint_w = OpVariable %_ptr_UniformConstant_14_0 UniformConstant +%_ptr_UniformConstant_18_0 = OpTypePointer UniformConstant %18 +%t_rgba16uint_w = OpVariable %_ptr_UniformConstant_18_0 UniformConstant +%_ptr_UniformConstant_21_0 = OpTypePointer UniformConstant %21 +%t_rgba16sint_w = OpVariable %_ptr_UniformConstant_21_0 UniformConstant +%_ptr_UniformConstant_24_0 = OpTypePointer UniformConstant %24 +%t_rgba16float_w = OpVariable %_ptr_UniformConstant_24_0 UniformConstant +%_ptr_UniformConstant_27_0 = OpTypePointer UniformConstant %27 +%t_r32uint_w = OpVariable %_ptr_UniformConstant_27_0 UniformConstant +%_ptr_UniformConstant_30_0 = OpTypePointer UniformConstant %30 +%t_r32sint_w = OpVariable %_ptr_UniformConstant_30_0 UniformConstant +%_ptr_UniformConstant_33_0 = OpTypePointer UniformConstant %33 +%t_r32float_w = OpVariable %_ptr_UniformConstant_33_0 UniformConstant +%_ptr_UniformConstant_36_0 = OpTypePointer UniformConstant %36 +%t_rg32uint_w = OpVariable %_ptr_UniformConstant_36_0 UniformConstant +%_ptr_UniformConstant_39_0 = OpTypePointer UniformConstant %39 +%t_rg32sint_w = OpVariable %_ptr_UniformConstant_39_0 UniformConstant +%_ptr_UniformConstant_42_0 = OpTypePointer UniformConstant %42 +%t_rg32float_w = OpVariable %_ptr_UniformConstant_42_0 UniformConstant +%_ptr_UniformConstant_45_0 = OpTypePointer UniformConstant %45 +%t_rgba32uint_w = OpVariable %_ptr_UniformConstant_45_0 UniformConstant +%_ptr_UniformConstant_48_0 = OpTypePointer UniformConstant %48 +%t_rgba32sint_w = OpVariable %_ptr_UniformConstant_48_0 UniformConstant +%_ptr_UniformConstant_51_0 = OpTypePointer UniformConstant %51 +%t_rgba32float_w = OpVariable %_ptr_UniformConstant_51_0 UniformConstant + %void = OpTypeVoid + %84 = OpTypeFunction %void + %main = OpFunction %void None %84 + %87 = OpLabel + %89 = OpLoad %3 %t_rgba8unorm_r + %91 = OpLoad %7 %t_rgba8snorm_r + %93 = OpLoad %10 %t_rgba8uint_r + %95 = OpLoad %14 %t_rgba8sint_r + %97 = OpLoad %18 %t_rgba16uint_r + %99 = OpLoad %21 %t_rgba16sint_r + %101 = OpLoad %24 %t_rgba16float_r + %103 = OpLoad %27 %t_r32uint_r + %105 = OpLoad %30 %t_r32sint_r + %107 = OpLoad %33 %t_r32float_r + %109 = OpLoad %36 %t_rg32uint_r + %111 = OpLoad %39 %t_rg32sint_r + %113 = OpLoad %42 %t_rg32float_r + %115 = OpLoad %45 %t_rgba32uint_r + %117 = OpLoad %48 %t_rgba32sint_r + %119 = OpLoad %51 %t_rgba32float_r + %121 = OpLoad %3 %t_rgba8unorm_w + %123 = OpLoad %7 %t_rgba8snorm_w + %125 = OpLoad %10 %t_rgba8uint_w + %127 = OpLoad %14 %t_rgba8sint_w + %129 = OpLoad %18 %t_rgba16uint_w + %131 = OpLoad %21 %t_rgba16sint_w + %133 = OpLoad %24 %t_rgba16float_w + %135 = OpLoad %27 %t_r32uint_w + %137 = OpLoad %30 %t_r32sint_w + %139 = OpLoad %33 %t_r32float_w + %141 = OpLoad %36 %t_rg32uint_w + %143 = OpLoad %39 %t_rg32sint_w + %145 = OpLoad %42 %t_rg32float_w + %147 = OpLoad %45 %t_rgba32uint_w + %149 = OpLoad %48 %t_rgba32sint_w + %151 = OpLoad %51 %t_rgba32float_w + OpReturn + OpFunctionEnd diff --git a/test/types/texture/storage/2d_array.wgsl.expected.wgsl b/test/types/texture/storage/2d_array.wgsl.expected.wgsl new file mode 100644 index 0000000000..9e45527f04 --- /dev/null +++ b/test/types/texture/storage/2d_array.wgsl.expected.wgsl @@ -0,0 +1,99 @@ +[[group(0), binding(0)]] var t_rgba8unorm_r : texture_storage_2d_array; + +[[group(0), binding(1)]] var t_rgba8snorm_r : texture_storage_2d_array; + +[[group(0), binding(2)]] var t_rgba8uint_r : texture_storage_2d_array; + +[[group(0), binding(3)]] var t_rgba8sint_r : texture_storage_2d_array; + +[[group(0), binding(4)]] var t_rgba16uint_r : texture_storage_2d_array; + +[[group(0), binding(5)]] var t_rgba16sint_r : texture_storage_2d_array; + +[[group(0), binding(6)]] var t_rgba16float_r : texture_storage_2d_array; + +[[group(0), binding(7)]] var t_r32uint_r : texture_storage_2d_array; + +[[group(0), binding(8)]] var t_r32sint_r : texture_storage_2d_array; + +[[group(0), binding(9)]] var t_r32float_r : texture_storage_2d_array; + +[[group(0), binding(10)]] var t_rg32uint_r : texture_storage_2d_array; + +[[group(0), binding(11)]] var t_rg32sint_r : texture_storage_2d_array; + +[[group(0), binding(12)]] var t_rg32float_r : texture_storage_2d_array; + +[[group(0), binding(13)]] var t_rgba32uint_r : texture_storage_2d_array; + +[[group(0), binding(14)]] var t_rgba32sint_r : texture_storage_2d_array; + +[[group(0), binding(15)]] var t_rgba32float_r : texture_storage_2d_array; + +[[group(0), binding(50)]] var t_rgba8unorm_w : texture_storage_2d_array; + +[[group(0), binding(51)]] var t_rgba8snorm_w : texture_storage_2d_array; + +[[group(0), binding(52)]] var t_rgba8uint_w : texture_storage_2d_array; + +[[group(0), binding(53)]] var t_rgba8sint_w : texture_storage_2d_array; + +[[group(0), binding(54)]] var t_rgba16uint_w : texture_storage_2d_array; + +[[group(0), binding(55)]] var t_rgba16sint_w : texture_storage_2d_array; + +[[group(0), binding(56)]] var t_rgba16float_w : texture_storage_2d_array; + +[[group(0), binding(57)]] var t_r32uint_w : texture_storage_2d_array; + +[[group(0), binding(58)]] var t_r32sint_w : texture_storage_2d_array; + +[[group(0), binding(59)]] var t_r32float_w : texture_storage_2d_array; + +[[group(0), binding(60)]] var t_rg32uint_w : texture_storage_2d_array; + +[[group(0), binding(61)]] var t_rg32sint_w : texture_storage_2d_array; + +[[group(0), binding(62)]] var t_rg32float_w : texture_storage_2d_array; + +[[group(0), binding(63)]] var t_rgba32uint_w : texture_storage_2d_array; + +[[group(0), binding(64)]] var t_rgba32sint_w : texture_storage_2d_array; + +[[group(0), binding(65)]] var t_rgba32float_w : texture_storage_2d_array; + +[[stage(compute)]] +fn main() { + ignore(t_rgba8unorm_r); + ignore(t_rgba8snorm_r); + ignore(t_rgba8uint_r); + ignore(t_rgba8sint_r); + ignore(t_rgba16uint_r); + ignore(t_rgba16sint_r); + ignore(t_rgba16float_r); + ignore(t_r32uint_r); + ignore(t_r32sint_r); + ignore(t_r32float_r); + ignore(t_rg32uint_r); + ignore(t_rg32sint_r); + ignore(t_rg32float_r); + ignore(t_rgba32uint_r); + ignore(t_rgba32sint_r); + ignore(t_rgba32float_r); + ignore(t_rgba8unorm_w); + ignore(t_rgba8snorm_w); + ignore(t_rgba8uint_w); + ignore(t_rgba8sint_w); + ignore(t_rgba16uint_w); + ignore(t_rgba16sint_w); + ignore(t_rgba16float_w); + ignore(t_r32uint_w); + ignore(t_r32sint_w); + ignore(t_r32float_w); + ignore(t_rg32uint_w); + ignore(t_rg32sint_w); + ignore(t_rg32float_w); + ignore(t_rgba32uint_w); + ignore(t_rgba32sint_w); + ignore(t_rgba32float_w); +} diff --git a/test/types/texture/storage/3d.wgsl b/test/types/texture/storage/3d.wgsl new file mode 100644 index 0000000000..7404dc73af --- /dev/null +++ b/test/types/texture/storage/3d.wgsl @@ -0,0 +1,68 @@ +[[group(0), binding(0)]] var t_rgba8unorm_r : texture_storage_3d; +[[group(0), binding(1)]] var t_rgba8snorm_r : texture_storage_3d; +[[group(0), binding(2)]] var t_rgba8uint_r : texture_storage_3d; +[[group(0), binding(3)]] var t_rgba8sint_r : texture_storage_3d; +[[group(0), binding(4)]] var t_rgba16uint_r : texture_storage_3d; +[[group(0), binding(5)]] var t_rgba16sint_r : texture_storage_3d; +[[group(0), binding(6)]] var t_rgba16float_r : texture_storage_3d; +[[group(0), binding(7)]] var t_r32uint_r : texture_storage_3d; +[[group(0), binding(8)]] var t_r32sint_r : texture_storage_3d; +[[group(0), binding(9)]] var t_r32float_r : texture_storage_3d; +[[group(0), binding(10)]] var t_rg32uint_r : texture_storage_3d; +[[group(0), binding(11)]] var t_rg32sint_r : texture_storage_3d; +[[group(0), binding(12)]] var t_rg32float_r : texture_storage_3d; +[[group(0), binding(13)]] var t_rgba32uint_r : texture_storage_3d; +[[group(0), binding(14)]] var t_rgba32sint_r : texture_storage_3d; +[[group(0), binding(15)]] var t_rgba32float_r : texture_storage_3d; +[[group(0), binding(50)]] var t_rgba8unorm_w : texture_storage_3d; +[[group(0), binding(51)]] var t_rgba8snorm_w : texture_storage_3d; +[[group(0), binding(52)]] var t_rgba8uint_w : texture_storage_3d; +[[group(0), binding(53)]] var t_rgba8sint_w : texture_storage_3d; +[[group(0), binding(54)]] var t_rgba16uint_w : texture_storage_3d; +[[group(0), binding(55)]] var t_rgba16sint_w : texture_storage_3d; +[[group(0), binding(56)]] var t_rgba16float_w : texture_storage_3d; +[[group(0), binding(57)]] var t_r32uint_w : texture_storage_3d; +[[group(0), binding(58)]] var t_r32sint_w : texture_storage_3d; +[[group(0), binding(59)]] var t_r32float_w : texture_storage_3d; +[[group(0), binding(60)]] var t_rg32uint_w : texture_storage_3d; +[[group(0), binding(61)]] var t_rg32sint_w : texture_storage_3d; +[[group(0), binding(62)]] var t_rg32float_w : texture_storage_3d; +[[group(0), binding(63)]] var t_rgba32uint_w : texture_storage_3d; +[[group(0), binding(64)]] var t_rgba32sint_w : texture_storage_3d; +[[group(0), binding(65)]] var t_rgba32float_w : texture_storage_3d; + +[[stage(compute)]] +fn main() { + ignore(t_rgba8unorm_r); + ignore(t_rgba8snorm_r); + ignore(t_rgba8uint_r); + ignore(t_rgba8sint_r); + ignore(t_rgba16uint_r); + ignore(t_rgba16sint_r); + ignore(t_rgba16float_r); + ignore(t_r32uint_r); + ignore(t_r32sint_r); + ignore(t_r32float_r); + ignore(t_rg32uint_r); + ignore(t_rg32sint_r); + ignore(t_rg32float_r); + ignore(t_rgba32uint_r); + ignore(t_rgba32sint_r); + ignore(t_rgba32float_r); + ignore(t_rgba8unorm_w); + ignore(t_rgba8snorm_w); + ignore(t_rgba8uint_w); + ignore(t_rgba8sint_w); + ignore(t_rgba16uint_w); + ignore(t_rgba16sint_w); + ignore(t_rgba16float_w); + ignore(t_r32uint_w); + ignore(t_r32sint_w); + ignore(t_r32float_w); + ignore(t_rg32uint_w); + ignore(t_rg32sint_w); + ignore(t_rg32float_w); + ignore(t_rgba32uint_w); + ignore(t_rgba32sint_w); + ignore(t_rgba32float_w); +} diff --git a/test/types/texture/storage/3d.wgsl.expected.hlsl b/test/types/texture/storage/3d.wgsl.expected.hlsl new file mode 100644 index 0000000000..6541963ead --- /dev/null +++ b/test/types/texture/storage/3d.wgsl.expected.hlsl @@ -0,0 +1,70 @@ +Texture3D t_rgba8unorm_r : register(t0, space0); +Texture3D t_rgba8snorm_r : register(t1, space0); +Texture3D t_rgba8uint_r : register(t2, space0); +Texture3D t_rgba8sint_r : register(t3, space0); +Texture3D t_rgba16uint_r : register(t4, space0); +Texture3D t_rgba16sint_r : register(t5, space0); +Texture3D t_rgba16float_r : register(t6, space0); +Texture3D t_r32uint_r : register(t7, space0); +Texture3D t_r32sint_r : register(t8, space0); +Texture3D t_r32float_r : register(t9, space0); +Texture3D t_rg32uint_r : register(t10, space0); +Texture3D t_rg32sint_r : register(t11, space0); +Texture3D t_rg32float_r : register(t12, space0); +Texture3D t_rgba32uint_r : register(t13, space0); +Texture3D t_rgba32sint_r : register(t14, space0); +Texture3D t_rgba32float_r : register(t15, space0); +RWTexture3D t_rgba8unorm_w : register(u50, space0); +RWTexture3D t_rgba8snorm_w : register(u51, space0); +RWTexture3D t_rgba8uint_w : register(u52, space0); +RWTexture3D t_rgba8sint_w : register(u53, space0); +RWTexture3D t_rgba16uint_w : register(u54, space0); +RWTexture3D t_rgba16sint_w : register(u55, space0); +RWTexture3D t_rgba16float_w : register(u56, space0); +RWTexture3D t_r32uint_w : register(u57, space0); +RWTexture3D t_r32sint_w : register(u58, space0); +RWTexture3D t_r32float_w : register(u59, space0); +RWTexture3D t_rg32uint_w : register(u60, space0); +RWTexture3D t_rg32sint_w : register(u61, space0); +RWTexture3D t_rg32float_w : register(u62, space0); +RWTexture3D t_rgba32uint_w : register(u63, space0); +RWTexture3D t_rgba32sint_w : register(u64, space0); +RWTexture3D t_rgba32float_w : register(u65, space0); + +[numthreads(1, 1, 1)] +void main() { + t_rgba8unorm_r; + t_rgba8snorm_r; + t_rgba8uint_r; + t_rgba8sint_r; + t_rgba16uint_r; + t_rgba16sint_r; + t_rgba16float_r; + t_r32uint_r; + t_r32sint_r; + t_r32float_r; + t_rg32uint_r; + t_rg32sint_r; + t_rg32float_r; + t_rgba32uint_r; + t_rgba32sint_r; + t_rgba32float_r; + t_rgba8unorm_w; + t_rgba8snorm_w; + t_rgba8uint_w; + t_rgba8sint_w; + t_rgba16uint_w; + t_rgba16sint_w; + t_rgba16float_w; + t_r32uint_w; + t_r32sint_w; + t_r32float_w; + t_rg32uint_w; + t_rg32sint_w; + t_rg32float_w; + t_rgba32uint_w; + t_rgba32sint_w; + t_rgba32float_w; + return; +} + diff --git a/test/types/texture/storage/3d.wgsl.expected.msl b/test/types/texture/storage/3d.wgsl.expected.msl new file mode 100644 index 0000000000..5783c35e13 --- /dev/null +++ b/test/types/texture/storage/3d.wgsl.expected.msl @@ -0,0 +1,39 @@ +#include + +using namespace metal; +kernel void tint_symbol(texture3d tint_symbol_1 [[texture(0)]], texture3d tint_symbol_2 [[texture(1)]], texture3d tint_symbol_3 [[texture(2)]], texture3d tint_symbol_4 [[texture(3)]], texture3d tint_symbol_5 [[texture(4)]], texture3d tint_symbol_6 [[texture(5)]], texture3d tint_symbol_7 [[texture(6)]], texture3d tint_symbol_8 [[texture(7)]], texture3d tint_symbol_9 [[texture(8)]], texture3d tint_symbol_10 [[texture(9)]], texture3d tint_symbol_11 [[texture(10)]], texture3d tint_symbol_12 [[texture(11)]], texture3d tint_symbol_13 [[texture(12)]], texture3d tint_symbol_14 [[texture(13)]], texture3d tint_symbol_15 [[texture(14)]], texture3d tint_symbol_16 [[texture(15)]], texture3d tint_symbol_17 [[texture(50)]], texture3d tint_symbol_18 [[texture(51)]], texture3d tint_symbol_19 [[texture(52)]], texture3d tint_symbol_20 [[texture(53)]], texture3d tint_symbol_21 [[texture(54)]], texture3d tint_symbol_22 [[texture(55)]], texture3d tint_symbol_23 [[texture(56)]], texture3d tint_symbol_24 [[texture(57)]], texture3d tint_symbol_25 [[texture(58)]], texture3d tint_symbol_26 [[texture(59)]], texture3d tint_symbol_27 [[texture(60)]], texture3d tint_symbol_28 [[texture(61)]], texture3d tint_symbol_29 [[texture(62)]], texture3d tint_symbol_30 [[texture(63)]], texture3d tint_symbol_31 [[texture(64)]], texture3d tint_symbol_32 [[texture(65)]]) { + (void) tint_symbol_1; + (void) tint_symbol_2; + (void) tint_symbol_3; + (void) tint_symbol_4; + (void) tint_symbol_5; + (void) tint_symbol_6; + (void) tint_symbol_7; + (void) tint_symbol_8; + (void) tint_symbol_9; + (void) tint_symbol_10; + (void) tint_symbol_11; + (void) tint_symbol_12; + (void) tint_symbol_13; + (void) tint_symbol_14; + (void) tint_symbol_15; + (void) tint_symbol_16; + (void) tint_symbol_17; + (void) tint_symbol_18; + (void) tint_symbol_19; + (void) tint_symbol_20; + (void) tint_symbol_21; + (void) tint_symbol_22; + (void) tint_symbol_23; + (void) tint_symbol_24; + (void) tint_symbol_25; + (void) tint_symbol_26; + (void) tint_symbol_27; + (void) tint_symbol_28; + (void) tint_symbol_29; + (void) tint_symbol_30; + (void) tint_symbol_31; + (void) tint_symbol_32; + return; +} + diff --git a/test/types/texture/storage/3d.wgsl.expected.spvasm b/test/types/texture/storage/3d.wgsl.expected.spvasm new file mode 100644 index 0000000000..feeabd0427 --- /dev/null +++ b/test/types/texture/storage/3d.wgsl.expected.spvasm @@ -0,0 +1,260 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 152 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %t_rgba8unorm_r "t_rgba8unorm_r" + OpName %t_rgba8snorm_r "t_rgba8snorm_r" + OpName %t_rgba8uint_r "t_rgba8uint_r" + OpName %t_rgba8sint_r "t_rgba8sint_r" + OpName %t_rgba16uint_r "t_rgba16uint_r" + OpName %t_rgba16sint_r "t_rgba16sint_r" + OpName %t_rgba16float_r "t_rgba16float_r" + OpName %t_r32uint_r "t_r32uint_r" + OpName %t_r32sint_r "t_r32sint_r" + OpName %t_r32float_r "t_r32float_r" + OpName %t_rg32uint_r "t_rg32uint_r" + OpName %t_rg32sint_r "t_rg32sint_r" + OpName %t_rg32float_r "t_rg32float_r" + OpName %t_rgba32uint_r "t_rgba32uint_r" + OpName %t_rgba32sint_r "t_rgba32sint_r" + OpName %t_rgba32float_r "t_rgba32float_r" + OpName %t_rgba8unorm_w "t_rgba8unorm_w" + OpName %t_rgba8snorm_w "t_rgba8snorm_w" + OpName %t_rgba8uint_w "t_rgba8uint_w" + OpName %t_rgba8sint_w "t_rgba8sint_w" + OpName %t_rgba16uint_w "t_rgba16uint_w" + OpName %t_rgba16sint_w "t_rgba16sint_w" + OpName %t_rgba16float_w "t_rgba16float_w" + OpName %t_r32uint_w "t_r32uint_w" + OpName %t_r32sint_w "t_r32sint_w" + OpName %t_r32float_w "t_r32float_w" + OpName %t_rg32uint_w "t_rg32uint_w" + OpName %t_rg32sint_w "t_rg32sint_w" + OpName %t_rg32float_w "t_rg32float_w" + OpName %t_rgba32uint_w "t_rgba32uint_w" + OpName %t_rgba32sint_w "t_rgba32sint_w" + OpName %t_rgba32float_w "t_rgba32float_w" + OpName %main "main" + OpDecorate %t_rgba8unorm_r NonWritable + OpDecorate %t_rgba8unorm_r DescriptorSet 0 + OpDecorate %t_rgba8unorm_r Binding 0 + OpDecorate %t_rgba8snorm_r NonWritable + OpDecorate %t_rgba8snorm_r DescriptorSet 0 + OpDecorate %t_rgba8snorm_r Binding 1 + OpDecorate %t_rgba8uint_r NonWritable + OpDecorate %t_rgba8uint_r DescriptorSet 0 + OpDecorate %t_rgba8uint_r Binding 2 + OpDecorate %t_rgba8sint_r NonWritable + OpDecorate %t_rgba8sint_r DescriptorSet 0 + OpDecorate %t_rgba8sint_r Binding 3 + OpDecorate %t_rgba16uint_r NonWritable + OpDecorate %t_rgba16uint_r DescriptorSet 0 + OpDecorate %t_rgba16uint_r Binding 4 + OpDecorate %t_rgba16sint_r NonWritable + OpDecorate %t_rgba16sint_r DescriptorSet 0 + OpDecorate %t_rgba16sint_r Binding 5 + OpDecorate %t_rgba16float_r NonWritable + OpDecorate %t_rgba16float_r DescriptorSet 0 + OpDecorate %t_rgba16float_r Binding 6 + OpDecorate %t_r32uint_r NonWritable + OpDecorate %t_r32uint_r DescriptorSet 0 + OpDecorate %t_r32uint_r Binding 7 + OpDecorate %t_r32sint_r NonWritable + OpDecorate %t_r32sint_r DescriptorSet 0 + OpDecorate %t_r32sint_r Binding 8 + OpDecorate %t_r32float_r NonWritable + OpDecorate %t_r32float_r DescriptorSet 0 + OpDecorate %t_r32float_r Binding 9 + OpDecorate %t_rg32uint_r NonWritable + OpDecorate %t_rg32uint_r DescriptorSet 0 + OpDecorate %t_rg32uint_r Binding 10 + OpDecorate %t_rg32sint_r NonWritable + OpDecorate %t_rg32sint_r DescriptorSet 0 + OpDecorate %t_rg32sint_r Binding 11 + OpDecorate %t_rg32float_r NonWritable + OpDecorate %t_rg32float_r DescriptorSet 0 + OpDecorate %t_rg32float_r Binding 12 + OpDecorate %t_rgba32uint_r NonWritable + OpDecorate %t_rgba32uint_r DescriptorSet 0 + OpDecorate %t_rgba32uint_r Binding 13 + OpDecorate %t_rgba32sint_r NonWritable + OpDecorate %t_rgba32sint_r DescriptorSet 0 + OpDecorate %t_rgba32sint_r Binding 14 + OpDecorate %t_rgba32float_r NonWritable + OpDecorate %t_rgba32float_r DescriptorSet 0 + OpDecorate %t_rgba32float_r Binding 15 + OpDecorate %t_rgba8unorm_w NonReadable + OpDecorate %t_rgba8unorm_w DescriptorSet 0 + OpDecorate %t_rgba8unorm_w Binding 50 + OpDecorate %t_rgba8snorm_w NonReadable + OpDecorate %t_rgba8snorm_w DescriptorSet 0 + OpDecorate %t_rgba8snorm_w Binding 51 + OpDecorate %t_rgba8uint_w NonReadable + OpDecorate %t_rgba8uint_w DescriptorSet 0 + OpDecorate %t_rgba8uint_w Binding 52 + OpDecorate %t_rgba8sint_w NonReadable + OpDecorate %t_rgba8sint_w DescriptorSet 0 + OpDecorate %t_rgba8sint_w Binding 53 + OpDecorate %t_rgba16uint_w NonReadable + OpDecorate %t_rgba16uint_w DescriptorSet 0 + OpDecorate %t_rgba16uint_w Binding 54 + OpDecorate %t_rgba16sint_w NonReadable + OpDecorate %t_rgba16sint_w DescriptorSet 0 + OpDecorate %t_rgba16sint_w Binding 55 + OpDecorate %t_rgba16float_w NonReadable + OpDecorate %t_rgba16float_w DescriptorSet 0 + OpDecorate %t_rgba16float_w Binding 56 + OpDecorate %t_r32uint_w NonReadable + OpDecorate %t_r32uint_w DescriptorSet 0 + OpDecorate %t_r32uint_w Binding 57 + OpDecorate %t_r32sint_w NonReadable + OpDecorate %t_r32sint_w DescriptorSet 0 + OpDecorate %t_r32sint_w Binding 58 + OpDecorate %t_r32float_w NonReadable + OpDecorate %t_r32float_w DescriptorSet 0 + OpDecorate %t_r32float_w Binding 59 + OpDecorate %t_rg32uint_w NonReadable + OpDecorate %t_rg32uint_w DescriptorSet 0 + OpDecorate %t_rg32uint_w Binding 60 + OpDecorate %t_rg32sint_w NonReadable + OpDecorate %t_rg32sint_w DescriptorSet 0 + OpDecorate %t_rg32sint_w Binding 61 + OpDecorate %t_rg32float_w NonReadable + OpDecorate %t_rg32float_w DescriptorSet 0 + OpDecorate %t_rg32float_w Binding 62 + OpDecorate %t_rgba32uint_w NonReadable + OpDecorate %t_rgba32uint_w DescriptorSet 0 + OpDecorate %t_rgba32uint_w Binding 63 + OpDecorate %t_rgba32sint_w NonReadable + OpDecorate %t_rgba32sint_w DescriptorSet 0 + OpDecorate %t_rgba32sint_w Binding 64 + OpDecorate %t_rgba32float_w NonReadable + OpDecorate %t_rgba32float_w DescriptorSet 0 + OpDecorate %t_rgba32float_w Binding 65 + %float = OpTypeFloat 32 + %3 = OpTypeImage %float 3D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3 +%t_rgba8unorm_r = OpVariable %_ptr_UniformConstant_3 UniformConstant + %7 = OpTypeImage %float 3D 0 0 0 2 Rgba8Snorm +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 +%t_rgba8snorm_r = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uint = OpTypeInt 32 0 + %10 = OpTypeImage %uint 3D 0 0 0 2 Rgba8ui +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 +%t_rgba8uint_r = OpVariable %_ptr_UniformConstant_10 UniformConstant + %int = OpTypeInt 32 1 + %14 = OpTypeImage %int 3D 0 0 0 2 Rgba8i +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 +%t_rgba8sint_r = OpVariable %_ptr_UniformConstant_14 UniformConstant + %18 = OpTypeImage %uint 3D 0 0 0 2 Rgba16ui +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 +%t_rgba16uint_r = OpVariable %_ptr_UniformConstant_18 UniformConstant + %21 = OpTypeImage %int 3D 0 0 0 2 Rgba16i +%_ptr_UniformConstant_21 = OpTypePointer UniformConstant %21 +%t_rgba16sint_r = OpVariable %_ptr_UniformConstant_21 UniformConstant + %24 = OpTypeImage %float 3D 0 0 0 2 Rgba16f +%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24 +%t_rgba16float_r = OpVariable %_ptr_UniformConstant_24 UniformConstant + %27 = OpTypeImage %uint 3D 0 0 0 2 R32ui +%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27 +%t_r32uint_r = OpVariable %_ptr_UniformConstant_27 UniformConstant + %30 = OpTypeImage %int 3D 0 0 0 2 R32i +%_ptr_UniformConstant_30 = OpTypePointer UniformConstant %30 +%t_r32sint_r = OpVariable %_ptr_UniformConstant_30 UniformConstant + %33 = OpTypeImage %float 3D 0 0 0 2 R32f +%_ptr_UniformConstant_33 = OpTypePointer UniformConstant %33 +%t_r32float_r = OpVariable %_ptr_UniformConstant_33 UniformConstant + %36 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui +%_ptr_UniformConstant_36 = OpTypePointer UniformConstant %36 +%t_rg32uint_r = OpVariable %_ptr_UniformConstant_36 UniformConstant + %39 = OpTypeImage %int 3D 0 0 0 2 Rg32i +%_ptr_UniformConstant_39 = OpTypePointer UniformConstant %39 +%t_rg32sint_r = OpVariable %_ptr_UniformConstant_39 UniformConstant + %42 = OpTypeImage %float 3D 0 0 0 2 Rg32f +%_ptr_UniformConstant_42 = OpTypePointer UniformConstant %42 +%t_rg32float_r = OpVariable %_ptr_UniformConstant_42 UniformConstant + %45 = OpTypeImage %uint 3D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_45 = OpTypePointer UniformConstant %45 +%t_rgba32uint_r = OpVariable %_ptr_UniformConstant_45 UniformConstant + %48 = OpTypeImage %int 3D 0 0 0 2 Rgba32i +%_ptr_UniformConstant_48 = OpTypePointer UniformConstant %48 +%t_rgba32sint_r = OpVariable %_ptr_UniformConstant_48 UniformConstant + %51 = OpTypeImage %float 3D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51 +%t_rgba32float_r = OpVariable %_ptr_UniformConstant_51 UniformConstant +%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3 +%t_rgba8unorm_w = OpVariable %_ptr_UniformConstant_3_0 UniformConstant +%_ptr_UniformConstant_7_0 = OpTypePointer UniformConstant %7 +%t_rgba8snorm_w = OpVariable %_ptr_UniformConstant_7_0 UniformConstant +%_ptr_UniformConstant_10_0 = OpTypePointer UniformConstant %10 +%t_rgba8uint_w = OpVariable %_ptr_UniformConstant_10_0 UniformConstant +%_ptr_UniformConstant_14_0 = OpTypePointer UniformConstant %14 +%t_rgba8sint_w = OpVariable %_ptr_UniformConstant_14_0 UniformConstant +%_ptr_UniformConstant_18_0 = OpTypePointer UniformConstant %18 +%t_rgba16uint_w = OpVariable %_ptr_UniformConstant_18_0 UniformConstant +%_ptr_UniformConstant_21_0 = OpTypePointer UniformConstant %21 +%t_rgba16sint_w = OpVariable %_ptr_UniformConstant_21_0 UniformConstant +%_ptr_UniformConstant_24_0 = OpTypePointer UniformConstant %24 +%t_rgba16float_w = OpVariable %_ptr_UniformConstant_24_0 UniformConstant +%_ptr_UniformConstant_27_0 = OpTypePointer UniformConstant %27 +%t_r32uint_w = OpVariable %_ptr_UniformConstant_27_0 UniformConstant +%_ptr_UniformConstant_30_0 = OpTypePointer UniformConstant %30 +%t_r32sint_w = OpVariable %_ptr_UniformConstant_30_0 UniformConstant +%_ptr_UniformConstant_33_0 = OpTypePointer UniformConstant %33 +%t_r32float_w = OpVariable %_ptr_UniformConstant_33_0 UniformConstant +%_ptr_UniformConstant_36_0 = OpTypePointer UniformConstant %36 +%t_rg32uint_w = OpVariable %_ptr_UniformConstant_36_0 UniformConstant +%_ptr_UniformConstant_39_0 = OpTypePointer UniformConstant %39 +%t_rg32sint_w = OpVariable %_ptr_UniformConstant_39_0 UniformConstant +%_ptr_UniformConstant_42_0 = OpTypePointer UniformConstant %42 +%t_rg32float_w = OpVariable %_ptr_UniformConstant_42_0 UniformConstant +%_ptr_UniformConstant_45_0 = OpTypePointer UniformConstant %45 +%t_rgba32uint_w = OpVariable %_ptr_UniformConstant_45_0 UniformConstant +%_ptr_UniformConstant_48_0 = OpTypePointer UniformConstant %48 +%t_rgba32sint_w = OpVariable %_ptr_UniformConstant_48_0 UniformConstant +%_ptr_UniformConstant_51_0 = OpTypePointer UniformConstant %51 +%t_rgba32float_w = OpVariable %_ptr_UniformConstant_51_0 UniformConstant + %void = OpTypeVoid + %84 = OpTypeFunction %void + %main = OpFunction %void None %84 + %87 = OpLabel + %89 = OpLoad %3 %t_rgba8unorm_r + %91 = OpLoad %7 %t_rgba8snorm_r + %93 = OpLoad %10 %t_rgba8uint_r + %95 = OpLoad %14 %t_rgba8sint_r + %97 = OpLoad %18 %t_rgba16uint_r + %99 = OpLoad %21 %t_rgba16sint_r + %101 = OpLoad %24 %t_rgba16float_r + %103 = OpLoad %27 %t_r32uint_r + %105 = OpLoad %30 %t_r32sint_r + %107 = OpLoad %33 %t_r32float_r + %109 = OpLoad %36 %t_rg32uint_r + %111 = OpLoad %39 %t_rg32sint_r + %113 = OpLoad %42 %t_rg32float_r + %115 = OpLoad %45 %t_rgba32uint_r + %117 = OpLoad %48 %t_rgba32sint_r + %119 = OpLoad %51 %t_rgba32float_r + %121 = OpLoad %3 %t_rgba8unorm_w + %123 = OpLoad %7 %t_rgba8snorm_w + %125 = OpLoad %10 %t_rgba8uint_w + %127 = OpLoad %14 %t_rgba8sint_w + %129 = OpLoad %18 %t_rgba16uint_w + %131 = OpLoad %21 %t_rgba16sint_w + %133 = OpLoad %24 %t_rgba16float_w + %135 = OpLoad %27 %t_r32uint_w + %137 = OpLoad %30 %t_r32sint_w + %139 = OpLoad %33 %t_r32float_w + %141 = OpLoad %36 %t_rg32uint_w + %143 = OpLoad %39 %t_rg32sint_w + %145 = OpLoad %42 %t_rg32float_w + %147 = OpLoad %45 %t_rgba32uint_w + %149 = OpLoad %48 %t_rgba32sint_w + %151 = OpLoad %51 %t_rgba32float_w + OpReturn + OpFunctionEnd diff --git a/test/types/texture/storage/3d.wgsl.expected.wgsl b/test/types/texture/storage/3d.wgsl.expected.wgsl new file mode 100644 index 0000000000..795597e903 --- /dev/null +++ b/test/types/texture/storage/3d.wgsl.expected.wgsl @@ -0,0 +1,99 @@ +[[group(0), binding(0)]] var t_rgba8unorm_r : texture_storage_3d; + +[[group(0), binding(1)]] var t_rgba8snorm_r : texture_storage_3d; + +[[group(0), binding(2)]] var t_rgba8uint_r : texture_storage_3d; + +[[group(0), binding(3)]] var t_rgba8sint_r : texture_storage_3d; + +[[group(0), binding(4)]] var t_rgba16uint_r : texture_storage_3d; + +[[group(0), binding(5)]] var t_rgba16sint_r : texture_storage_3d; + +[[group(0), binding(6)]] var t_rgba16float_r : texture_storage_3d; + +[[group(0), binding(7)]] var t_r32uint_r : texture_storage_3d; + +[[group(0), binding(8)]] var t_r32sint_r : texture_storage_3d; + +[[group(0), binding(9)]] var t_r32float_r : texture_storage_3d; + +[[group(0), binding(10)]] var t_rg32uint_r : texture_storage_3d; + +[[group(0), binding(11)]] var t_rg32sint_r : texture_storage_3d; + +[[group(0), binding(12)]] var t_rg32float_r : texture_storage_3d; + +[[group(0), binding(13)]] var t_rgba32uint_r : texture_storage_3d; + +[[group(0), binding(14)]] var t_rgba32sint_r : texture_storage_3d; + +[[group(0), binding(15)]] var t_rgba32float_r : texture_storage_3d; + +[[group(0), binding(50)]] var t_rgba8unorm_w : texture_storage_3d; + +[[group(0), binding(51)]] var t_rgba8snorm_w : texture_storage_3d; + +[[group(0), binding(52)]] var t_rgba8uint_w : texture_storage_3d; + +[[group(0), binding(53)]] var t_rgba8sint_w : texture_storage_3d; + +[[group(0), binding(54)]] var t_rgba16uint_w : texture_storage_3d; + +[[group(0), binding(55)]] var t_rgba16sint_w : texture_storage_3d; + +[[group(0), binding(56)]] var t_rgba16float_w : texture_storage_3d; + +[[group(0), binding(57)]] var t_r32uint_w : texture_storage_3d; + +[[group(0), binding(58)]] var t_r32sint_w : texture_storage_3d; + +[[group(0), binding(59)]] var t_r32float_w : texture_storage_3d; + +[[group(0), binding(60)]] var t_rg32uint_w : texture_storage_3d; + +[[group(0), binding(61)]] var t_rg32sint_w : texture_storage_3d; + +[[group(0), binding(62)]] var t_rg32float_w : texture_storage_3d; + +[[group(0), binding(63)]] var t_rgba32uint_w : texture_storage_3d; + +[[group(0), binding(64)]] var t_rgba32sint_w : texture_storage_3d; + +[[group(0), binding(65)]] var t_rgba32float_w : texture_storage_3d; + +[[stage(compute)]] +fn main() { + ignore(t_rgba8unorm_r); + ignore(t_rgba8snorm_r); + ignore(t_rgba8uint_r); + ignore(t_rgba8sint_r); + ignore(t_rgba16uint_r); + ignore(t_rgba16sint_r); + ignore(t_rgba16float_r); + ignore(t_r32uint_r); + ignore(t_r32sint_r); + ignore(t_r32float_r); + ignore(t_rg32uint_r); + ignore(t_rg32sint_r); + ignore(t_rg32float_r); + ignore(t_rgba32uint_r); + ignore(t_rgba32sint_r); + ignore(t_rgba32float_r); + ignore(t_rgba8unorm_w); + ignore(t_rgba8snorm_w); + ignore(t_rgba8uint_w); + ignore(t_rgba8sint_w); + ignore(t_rgba16uint_w); + ignore(t_rgba16sint_w); + ignore(t_rgba16float_w); + ignore(t_r32uint_w); + ignore(t_r32sint_w); + ignore(t_r32float_w); + ignore(t_rg32uint_w); + ignore(t_rg32sint_w); + ignore(t_rg32float_w); + ignore(t_rgba32uint_w); + ignore(t_rgba32sint_w); + ignore(t_rgba32float_w); +}