diff --git a/src/tint/ast/storage_class.cc b/src/tint/ast/storage_class.cc index 00d6d92fe0..d181855a0f 100644 --- a/src/tint/ast/storage_class.cc +++ b/src/tint/ast/storage_class.cc @@ -30,8 +30,8 @@ const char* ToString(StorageClass sc) { return "uniform"; case StorageClass::kWorkgroup: return "workgroup"; - case StorageClass::kUniformConstant: - return "uniform_constant"; + case StorageClass::kHandle: + return "handle"; case StorageClass::kStorage: return "storage"; case StorageClass::kPrivate: diff --git a/src/tint/ast/storage_class.h b/src/tint/ast/storage_class.h index dc7a94a4de..5052f36731 100644 --- a/src/tint/ast/storage_class.h +++ b/src/tint/ast/storage_class.h @@ -27,7 +27,7 @@ enum class StorageClass { kOutput, kUniform, kWorkgroup, - kUniformConstant, + kHandle, kStorage, kPrivate, kFunction diff --git a/src/tint/reader/spirv/parser_impl.cc b/src/tint/reader/spirv/parser_impl.cc index 6cf8e7a998..4b7e0b6701 100644 --- a/src/tint/reader/spirv/parser_impl.cc +++ b/src/tint/reader/spirv/parser_impl.cc @@ -1494,7 +1494,7 @@ bool ParserImpl::EmitModuleScopeVariables() { case ast::StorageClass::kInput: case ast::StorageClass::kOutput: case ast::StorageClass::kUniform: - case ast::StorageClass::kUniformConstant: + case ast::StorageClass::kHandle: case ast::StorageClass::kStorage: case ast::StorageClass::kWorkgroup: case ast::StorageClass::kPrivate: @@ -1632,7 +1632,7 @@ ast::Variable* ParserImpl::MakeVariable(uint32_t id, // Handle variables (textures and samplers) are always in the handle // storage class, so we don't mention the storage class. - if (sc == ast::StorageClass::kUniformConstant) { + if (sc == ast::StorageClass::kHandle) { sc = ast::StorageClass::kNone; } @@ -2535,8 +2535,7 @@ const Pointer* ParserImpl::GetTypeForHandleVar( } // Form the pointer type. - auto* result = - ty_.Pointer(ast_store_type, ast::StorageClass::kUniformConstant); + auto* result = ty_.Pointer(ast_store_type, ast::StorageClass::kHandle); // Remember it for later. handle_type_[&var] = result; return result; diff --git a/src/tint/resolver/function_validation_test.cc b/src/tint/resolver/function_validation_test.cc index d694f0ea1b..4b69e5e8af 100644 --- a/src/tint/resolver/function_validation_test.cc +++ b/src/tint/resolver/function_validation_test.cc @@ -821,7 +821,7 @@ INSTANTIATE_TEST_SUITE_P( TestParams{ast::StorageClass::kOutput, false}, TestParams{ast::StorageClass::kUniform, false}, TestParams{ast::StorageClass::kWorkgroup, true}, - TestParams{ast::StorageClass::kUniformConstant, false}, + TestParams{ast::StorageClass::kHandle, false}, TestParams{ast::StorageClass::kStorage, false}, TestParams{ast::StorageClass::kPrivate, true}, TestParams{ast::StorageClass::kFunction, true})); diff --git a/src/tint/resolver/resolver.cc b/src/tint/resolver/resolver.cc index c2e3c09f2d..21f4bf084c 100644 --- a/src/tint/resolver/resolver.cc +++ b/src/tint/resolver/resolver.cc @@ -365,7 +365,7 @@ sem::Variable* Resolver::Variable(const ast::Variable* var, // If the store type is a texture type or a sampler type, then the // variable declaration must not have a storage class attribute. The // storage class will always be handle. - storage_class = ast::StorageClass::kUniformConstant; + storage_class = ast::StorageClass::kHandle; } } @@ -472,7 +472,7 @@ ast::Access Resolver::DefaultAccessForStorageClass( switch (storage_class) { case ast::StorageClass::kStorage: case ast::StorageClass::kUniform: - case ast::StorageClass::kUniformConstant: + case ast::StorageClass::kHandle: return ast::Access::kRead; default: break; diff --git a/src/tint/resolver/resolver_test.cc b/src/tint/resolver/resolver_test.cc index e7c2fb4d1c..a1967da672 100644 --- a/src/tint/resolver/resolver_test.cc +++ b/src/tint/resolver/resolver_test.cc @@ -1765,8 +1765,7 @@ TEST_F(ResolverTest, StorageClass_SetForSampler) { EXPECT_TRUE(r()->Resolve()) << r()->error(); - EXPECT_EQ(Sem().Get(var)->StorageClass(), - ast::StorageClass::kUniformConstant); + EXPECT_EQ(Sem().Get(var)->StorageClass(), ast::StorageClass::kHandle); } TEST_F(ResolverTest, StorageClass_SetForTexture) { @@ -1779,8 +1778,7 @@ TEST_F(ResolverTest, StorageClass_SetForTexture) { EXPECT_TRUE(r()->Resolve()) << r()->error(); - EXPECT_EQ(Sem().Get(var)->StorageClass(), - ast::StorageClass::kUniformConstant); + EXPECT_EQ(Sem().Get(var)->StorageClass(), ast::StorageClass::kHandle); } TEST_F(ResolverTest, StorageClass_DoesNotSetOnConst) { diff --git a/src/tint/resolver/validation_test.cc b/src/tint/resolver/validation_test.cc index 8b89f99f5a..e7d0af4669 100644 --- a/src/tint/resolver/validation_test.cc +++ b/src/tint/resolver/validation_test.cc @@ -320,7 +320,7 @@ TEST_F(ResolverValidationTest, StorageClass_FunctionVariableI32) { TEST_F(ResolverValidationTest, StorageClass_SamplerExplicitStorageClass) { auto* t = ty.sampler(ast::SamplerKind::kSampler); - Global(Source{{12, 34}}, "var", t, ast::StorageClass::kUniformConstant, + Global(Source{{12, 34}}, "var", t, ast::StorageClass::kHandle, ast::AttributeList{ create(0), create(0), @@ -335,7 +335,7 @@ TEST_F(ResolverValidationTest, StorageClass_SamplerExplicitStorageClass) { TEST_F(ResolverValidationTest, StorageClass_TextureExplicitStorageClass) { auto* t = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32()); - Global(Source{{12, 34}}, "var", t, ast::StorageClass::kUniformConstant, + Global(Source{{12, 34}}, "var", t, ast::StorageClass::kHandle, ast::AttributeList{ create(0), create(0), diff --git a/src/tint/resolver/validator.cc b/src/tint/resolver/validator.cc index 2a24349c7e..365fb2553a 100644 --- a/src/tint/resolver/validator.cc +++ b/src/tint/resolver/validator.cc @@ -562,7 +562,7 @@ bool Validator::GlobalVariable( switch (var->StorageClass()) { case ast::StorageClass::kUniform: case ast::StorageClass::kStorage: - case ast::StorageClass::kUniformConstant: { + case ast::StorageClass::kHandle: { // https://gpuweb.github.io/gpuweb/wgsl/#resource-interface // Each resource variable must be declared with both group and binding // attributes. diff --git a/src/tint/transform/module_scope_var_to_entry_point_param.cc b/src/tint/transform/module_scope_var_to_entry_point_param.cc index b510d7d1df..fdfb3f92c4 100644 --- a/src/tint/transform/module_scope_var_to_entry_point_param.cc +++ b/src/tint/transform/module_scope_var_to_entry_point_param.cc @@ -165,7 +165,7 @@ struct ModuleScopeVarToEntryPointParam::State { if (sc != ast::StorageClass::kPrivate && sc != ast::StorageClass::kStorage && sc != ast::StorageClass::kUniform && - sc != ast::StorageClass::kUniformConstant && + sc != ast::StorageClass::kHandle && sc != ast::StorageClass::kWorkgroup) { TINT_ICE(Transform, ctx.dst->Diagnostics()) << "unhandled module-scope storage class (" << sc << ")"; diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc index 547896493c..40a9e2e5c7 100644 --- a/src/tint/writer/glsl/generator_impl.cc +++ b/src/tint/writer/glsl/generator_impl.cc @@ -1948,7 +1948,7 @@ bool GeneratorImpl::EmitGlobalVariable(const ast::Variable* global) { return EmitUniformVariable(sem); case ast::StorageClass::kStorage: return EmitStorageVariable(sem); - case ast::StorageClass::kUniformConstant: + case ast::StorageClass::kHandle: return EmitHandleVariable(sem); case ast::StorageClass::kPrivate: return EmitPrivateVariable(sem); @@ -2610,7 +2610,7 @@ bool GeneratorImpl::EmitType(std::ostream& out, break; } case ast::StorageClass::kUniform: - case ast::StorageClass::kUniformConstant: { + case ast::StorageClass::kHandle: { out << "uniform "; break; } diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc index c98b180657..9b4fc51de8 100644 --- a/src/tint/writer/hlsl/generator_impl.cc +++ b/src/tint/writer/hlsl/generator_impl.cc @@ -2851,7 +2851,7 @@ bool GeneratorImpl::EmitGlobalVariable(const ast::Variable* global) { return EmitUniformVariable(sem); case ast::StorageClass::kStorage: return EmitStorageVariable(sem); - case ast::StorageClass::kUniformConstant: + case ast::StorageClass::kHandle: return EmitHandleVariable(sem); case ast::StorageClass::kPrivate: return EmitPrivateVariable(sem); diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc index 0516f2fc34..f50ff15ce2 100644 --- a/src/tint/writer/msl/generator_impl.cc +++ b/src/tint/writer/msl/generator_impl.cc @@ -2496,7 +2496,7 @@ bool GeneratorImpl::EmitStorageClass(std::ostream& out, ast::StorageClass sc) { switch (sc) { case ast::StorageClass::kFunction: case ast::StorageClass::kPrivate: - case ast::StorageClass::kUniformConstant: + case ast::StorageClass::kHandle: out << "thread"; return true; case ast::StorageClass::kWorkgroup: @@ -2804,7 +2804,7 @@ bool GeneratorImpl::EmitVariable(const sem::Variable* var) { switch (var->StorageClass()) { case ast::StorageClass::kFunction: - case ast::StorageClass::kUniformConstant: + case ast::StorageClass::kHandle: case ast::StorageClass::kNone: break; case ast::StorageClass::kPrivate: diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc index c944a6966a..c3c677b9ce 100644 --- a/src/tint/writer/spirv/builder.cc +++ b/src/tint/writer/spirv/builder.cc @@ -4153,7 +4153,7 @@ SpvStorageClass Builder::ConvertStorageClass(ast::StorageClass klass) const { return SpvStorageClassUniform; case ast::StorageClass::kWorkgroup: return SpvStorageClassWorkgroup; - case ast::StorageClass::kUniformConstant: + case ast::StorageClass::kHandle: return SpvStorageClassUniformConstant; case ast::StorageClass::kStorage: return SpvStorageClassStorageBuffer; diff --git a/src/tint/writer/spirv/builder_type_test.cc b/src/tint/writer/spirv/builder_type_test.cc index 44e778b30c..e1c6422e6e 100644 --- a/src/tint/writer/spirv/builder_type_test.cc +++ b/src/tint/writer/spirv/builder_type_test.cc @@ -545,8 +545,7 @@ INSTANTIATE_TEST_SUITE_P( PtrData{ast::StorageClass::kOutput, SpvStorageClassOutput}, PtrData{ast::StorageClass::kUniform, SpvStorageClassUniform}, PtrData{ast::StorageClass::kWorkgroup, SpvStorageClassWorkgroup}, - PtrData{ast::StorageClass::kUniformConstant, - SpvStorageClassUniformConstant}, + PtrData{ast::StorageClass::kHandle, SpvStorageClassUniformConstant}, PtrData{ast::StorageClass::kStorage, SpvStorageClassStorageBuffer}, PtrData{ast::StorageClass::kPrivate, SpvStorageClassPrivate}, PtrData{ast::StorageClass::kFunction, SpvStorageClassFunction}));