Rename UniformConstant to Handle.
The UniformConstant storage class was renamed to Handle in the WGSL spec. This CL updates Tint internals to match. Bug: tint:1138 Change-Id: I93ec581575955ab6830eb8aea44f74dbc28e9ef5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88280 Auto-Submit: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
6bdd6592d9
commit
f7ec85f9bd
|
@ -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:
|
||||
|
|
|
@ -27,7 +27,7 @@ enum class StorageClass {
|
|||
kOutput,
|
||||
kUniform,
|
||||
kWorkgroup,
|
||||
kUniformConstant,
|
||||
kHandle,
|
||||
kStorage,
|
||||
kPrivate,
|
||||
kFunction
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(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<ast::BindingAttribute>(0),
|
||||
create<ast::GroupAttribute>(0),
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 << ")";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}));
|
||||
|
|
Loading…
Reference in New Issue