tint: Remove semicolon as struct member delimeter
Fixup a couple of internal Dawn shaders that used this syntax. Fixed: tint:1475 Change-Id: Ibd6b3309944bfd955e724fef5d71d1297a84ef5f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93361 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
5286ea9d16
commit
cfa951a662
|
@ -12,6 +12,7 @@
|
||||||
* The `smoothStep()` builtin has been removed (use `smoothstep` instead). [tint:1483](crbug.com/tint/1483)
|
* The `smoothStep()` builtin has been removed (use `smoothstep` instead). [tint:1483](crbug.com/tint/1483)
|
||||||
* Module-scope `let` has been replaced with module-scope `const`. [tint:1580](crbug.com/tint/1584)
|
* Module-scope `let` has been replaced with module-scope `const`. [tint:1580](crbug.com/tint/1584)
|
||||||
* Note: Module-scope `const` does not support structure types. Use `var<private>` if you need a module-scope structure type.
|
* Note: Module-scope `const` does not support structure types. Use `var<private>` if you need a module-scope structure type.
|
||||||
|
* Struct members can no longer be separated with semicolons (use commas instead). [tint:1475](crbug.com/tint/1475)
|
||||||
|
|
||||||
### Deprecated Features
|
### Deprecated Features
|
||||||
|
|
||||||
|
|
|
@ -46,19 +46,19 @@ ResultOrError<ComputePipelineBase*> GetOrCreateIndirectDispatchValidationPipelin
|
||||||
Ref<ShaderModuleBase> shaderModule;
|
Ref<ShaderModuleBase> shaderModule;
|
||||||
DAWN_TRY_ASSIGN(shaderModule, utils::CreateShaderModule(device, R"(
|
DAWN_TRY_ASSIGN(shaderModule, utils::CreateShaderModule(device, R"(
|
||||||
struct UniformParams {
|
struct UniformParams {
|
||||||
maxComputeWorkgroupsPerDimension: u32;
|
maxComputeWorkgroupsPerDimension: u32,
|
||||||
clientOffsetInU32: u32;
|
clientOffsetInU32: u32,
|
||||||
enableValidation: u32;
|
enableValidation: u32,
|
||||||
duplicateNumWorkgroups: u32;
|
duplicateNumWorkgroups: u32,
|
||||||
};
|
}
|
||||||
|
|
||||||
struct IndirectParams {
|
struct IndirectParams {
|
||||||
data: array<u32>;
|
data: array<u32>
|
||||||
};
|
}
|
||||||
|
|
||||||
struct ValidatedParams {
|
struct ValidatedParams {
|
||||||
data: array<u32>;
|
data: array<u32>
|
||||||
};
|
}
|
||||||
|
|
||||||
@group(0) @binding(0) var<uniform> uniformParams: UniformParams;
|
@group(0) @binding(0) var<uniform> uniformParams: UniformParams;
|
||||||
@group(0) @binding(1) var<storage, read_write> clientParams: IndirectParams;
|
@group(0) @binding(1) var<storage, read_write> clientParams: IndirectParams;
|
||||||
|
|
|
@ -40,25 +40,25 @@ static_assert(offsetof(dawn::native::TimestampParams, rightShift) == 16);
|
||||||
|
|
||||||
static const char sConvertTimestampsToNanoseconds[] = R"(
|
static const char sConvertTimestampsToNanoseconds[] = R"(
|
||||||
struct Timestamp {
|
struct Timestamp {
|
||||||
low : u32;
|
low : u32,
|
||||||
high : u32;
|
high : u32,
|
||||||
};
|
}
|
||||||
|
|
||||||
struct TimestampArr {
|
struct TimestampArr {
|
||||||
t : array<Timestamp>;
|
t : array<Timestamp>
|
||||||
};
|
}
|
||||||
|
|
||||||
struct AvailabilityArr {
|
struct AvailabilityArr {
|
||||||
v : array<u32>;
|
v : array<u32>
|
||||||
};
|
}
|
||||||
|
|
||||||
struct TimestampParams {
|
struct TimestampParams {
|
||||||
first : u32;
|
first : u32,
|
||||||
count : u32;
|
count : u32,
|
||||||
offset : u32;
|
offset : u32,
|
||||||
multiplier : u32;
|
multiplier : u32,
|
||||||
right_shift : u32;
|
right_shift : u32,
|
||||||
};
|
}
|
||||||
|
|
||||||
@group(0) @binding(0) var<storage, read_write> timestamps : TimestampArr;
|
@group(0) @binding(0) var<storage, read_write> timestamps : TimestampArr;
|
||||||
@group(0) @binding(1) var<storage, read> availability : AvailabilityArr;
|
@group(0) @binding(1) var<storage, read> availability : AvailabilityArr;
|
||||||
|
|
|
@ -541,7 +541,7 @@ TEST_F(MinBufferSizeDefaultLayoutTests, DefaultLayoutVariousWGSLTypes) {
|
||||||
CheckShaderBindingSizeReflection({{{0, 0, "a : f32,", "f32", "a", 4},
|
CheckShaderBindingSizeReflection({{{0, 0, "a : f32,", "f32", "a", 4},
|
||||||
{0, 1, "b : array<f32>,", "f32", "b[0]", 4},
|
{0, 1, "b : array<f32>,", "f32", "b[0]", 4},
|
||||||
{0, 2, "c : mat2x2<f32>,", "mat2x2<f32>", "c", 16}}});
|
{0, 2, "c : mat2x2<f32>,", "mat2x2<f32>", "c", 16}}});
|
||||||
CheckShaderBindingSizeReflection({{{0, 3, "d : u32; e : array<f32>,", "u32", "d", 8},
|
CheckShaderBindingSizeReflection({{{0, 3, "d : u32, e : array<f32>,", "u32", "d", 8},
|
||||||
{0, 4, "f : ThreeFloats,", "f32", "f.f1", 12},
|
{0, 4, "f : ThreeFloats,", "f32", "f.f1", 12},
|
||||||
{0, 5, "g : array<ThreeFloats>,", "f32", "g[0].f1", 12}}});
|
{0, 5, "g : array<ThreeFloats>,", "f32", "g[0].f1", 12}}});
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,8 +275,8 @@ TEST(ReplaceIdentifierTest, NotApplicable5) {
|
||||||
// (`read` for uniform storage class).
|
// (`read` for uniform storage class).
|
||||||
std::string shader = R"(
|
std::string shader = R"(
|
||||||
struct S {
|
struct S {
|
||||||
a: i32;
|
a: i32
|
||||||
};
|
}
|
||||||
|
|
||||||
var<private> a: S;
|
var<private> a: S;
|
||||||
@group(1) @binding(1) var<uniform> b: S;
|
@group(1) @binding(1) var<uniform> b: S;
|
||||||
|
@ -310,8 +310,8 @@ TEST(ReplaceIdentifierTest, NotApplicable6) {
|
||||||
// Can't replace `ptr_b` with `a` since the latter is not a pointer.
|
// Can't replace `ptr_b` with `a` since the latter is not a pointer.
|
||||||
std::string shader = R"(
|
std::string shader = R"(
|
||||||
struct S {
|
struct S {
|
||||||
a: i32;
|
a: i32
|
||||||
};
|
}
|
||||||
|
|
||||||
var<private> a: S;
|
var<private> a: S;
|
||||||
@group(1) @binding(1) var<uniform> b: S;
|
@group(1) @binding(1) var<uniform> b: S;
|
||||||
|
@ -346,8 +346,8 @@ TEST(ReplaceIdentifierTest, NotApplicable8) {
|
||||||
// storage class.
|
// storage class.
|
||||||
std::string shader = R"(
|
std::string shader = R"(
|
||||||
struct S {
|
struct S {
|
||||||
a: i32;
|
a: i32
|
||||||
};
|
}
|
||||||
|
|
||||||
var<private> a: S;
|
var<private> a: S;
|
||||||
@group(1) @binding(1) var<uniform> b: S;
|
@group(1) @binding(1) var<uniform> b: S;
|
||||||
|
@ -382,8 +382,8 @@ TEST(ReplaceIdentifierTest, NotApplicable9) {
|
||||||
// Can't replace `b` with `e` since the latter is not a reference.
|
// Can't replace `b` with `e` since the latter is not a reference.
|
||||||
std::string shader = R"(
|
std::string shader = R"(
|
||||||
struct S {
|
struct S {
|
||||||
a: i32;
|
a: i32
|
||||||
};
|
}
|
||||||
|
|
||||||
var<private> a: S;
|
var<private> a: S;
|
||||||
let e = 3;
|
let e = 3;
|
||||||
|
@ -418,8 +418,8 @@ TEST(ReplaceIdentifierTest, NotApplicable10) {
|
||||||
// Can't replace `b` with `e` since the latter has a wrong access mode.
|
// Can't replace `b` with `e` since the latter has a wrong access mode.
|
||||||
std::string shader = R"(
|
std::string shader = R"(
|
||||||
struct S {
|
struct S {
|
||||||
a: i32;
|
a: i32
|
||||||
};
|
}
|
||||||
|
|
||||||
var<private> a: S;
|
var<private> a: S;
|
||||||
@group(0) @binding(0) var<storage, read_write> e: S;
|
@group(0) @binding(0) var<storage, read_write> e: S;
|
||||||
|
|
|
@ -1348,12 +1348,6 @@ Expect<ast::StructMemberList> ParserImpl::expect_struct_body_decl() {
|
||||||
members.push_back(member.value);
|
members.push_back(member.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(crbug.com/tint/1475): Remove support for semicolons.
|
|
||||||
if (auto sc = peek(); sc.Is(Token::Type::kSemicolon)) {
|
|
||||||
deprecated(sc.source(), "struct members should be separated with commas");
|
|
||||||
next();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!match(Token::Type::kComma)) {
|
if (!match(Token::Type::kComma)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,23 +104,5 @@ TEST_F(ParserImplTest, StructDecl_MissingBracketLeft) {
|
||||||
EXPECT_EQ(p->error(), "1:10: expected '{' for struct declaration");
|
EXPECT_EQ(p->error(), "1:10: expected '{' for struct declaration");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(crbug.com/tint/1475): Remove this.
|
|
||||||
TEST_F(ParserImplTest, DEPRECATED_StructDecl_Parses_WithSemicolons) {
|
|
||||||
auto p = parser(R"(
|
|
||||||
struct S {
|
|
||||||
a : i32;
|
|
||||||
b : f32;
|
|
||||||
})");
|
|
||||||
auto s = p->struct_decl();
|
|
||||||
EXPECT_FALSE(p->has_error());
|
|
||||||
EXPECT_FALSE(s.errored);
|
|
||||||
EXPECT_TRUE(s.matched);
|
|
||||||
ASSERT_NE(s.value, nullptr);
|
|
||||||
ASSERT_EQ(s->name, p->builder().Symbols().Register("S"));
|
|
||||||
ASSERT_EQ(s->members.size(), 2u);
|
|
||||||
EXPECT_EQ(s->members[0]->symbol, p->builder().Symbols().Register("a"));
|
|
||||||
EXPECT_EQ(s->members[1]->symbol, p->builder().Symbols().Register("b"));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace tint::reader::wgsl
|
} // namespace tint::reader::wgsl
|
||||||
|
|
Loading…
Reference in New Issue