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)
|
||||
* 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.
|
||||
* Struct members can no longer be separated with semicolons (use commas instead). [tint:1475](crbug.com/tint/1475)
|
||||
|
||||
### Deprecated Features
|
||||
|
||||
|
|
|
@ -46,19 +46,19 @@ ResultOrError<ComputePipelineBase*> GetOrCreateIndirectDispatchValidationPipelin
|
|||
Ref<ShaderModuleBase> shaderModule;
|
||||
DAWN_TRY_ASSIGN(shaderModule, utils::CreateShaderModule(device, R"(
|
||||
struct UniformParams {
|
||||
maxComputeWorkgroupsPerDimension: u32;
|
||||
clientOffsetInU32: u32;
|
||||
enableValidation: u32;
|
||||
duplicateNumWorkgroups: u32;
|
||||
};
|
||||
maxComputeWorkgroupsPerDimension: u32,
|
||||
clientOffsetInU32: u32,
|
||||
enableValidation: u32,
|
||||
duplicateNumWorkgroups: u32,
|
||||
}
|
||||
|
||||
struct IndirectParams {
|
||||
data: array<u32>;
|
||||
};
|
||||
data: array<u32>
|
||||
}
|
||||
|
||||
struct ValidatedParams {
|
||||
data: array<u32>;
|
||||
};
|
||||
data: array<u32>
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> uniformParams: UniformParams;
|
||||
@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"(
|
||||
struct Timestamp {
|
||||
low : u32;
|
||||
high : u32;
|
||||
};
|
||||
low : u32,
|
||||
high : u32,
|
||||
}
|
||||
|
||||
struct TimestampArr {
|
||||
t : array<Timestamp>;
|
||||
};
|
||||
t : array<Timestamp>
|
||||
}
|
||||
|
||||
struct AvailabilityArr {
|
||||
v : array<u32>;
|
||||
};
|
||||
v : array<u32>
|
||||
}
|
||||
|
||||
struct TimestampParams {
|
||||
first : u32;
|
||||
count : u32;
|
||||
offset : u32;
|
||||
multiplier : u32;
|
||||
right_shift : u32;
|
||||
};
|
||||
first : u32,
|
||||
count : u32,
|
||||
offset : u32,
|
||||
multiplier : u32,
|
||||
right_shift : u32,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<storage, read_write> timestamps : TimestampArr;
|
||||
@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},
|
||||
{0, 1, "b : array<f32>,", "f32", "b[0]", 4},
|
||||
{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, 5, "g : array<ThreeFloats>,", "f32", "g[0].f1", 12}}});
|
||||
}
|
||||
|
|
|
@ -275,8 +275,8 @@ TEST(ReplaceIdentifierTest, NotApplicable5) {
|
|||
// (`read` for uniform storage class).
|
||||
std::string shader = R"(
|
||||
struct S {
|
||||
a: i32;
|
||||
};
|
||||
a: i32
|
||||
}
|
||||
|
||||
var<private> a: 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.
|
||||
std::string shader = R"(
|
||||
struct S {
|
||||
a: i32;
|
||||
};
|
||||
a: i32
|
||||
}
|
||||
|
||||
var<private> a: S;
|
||||
@group(1) @binding(1) var<uniform> b: S;
|
||||
|
@ -346,8 +346,8 @@ TEST(ReplaceIdentifierTest, NotApplicable8) {
|
|||
// storage class.
|
||||
std::string shader = R"(
|
||||
struct S {
|
||||
a: i32;
|
||||
};
|
||||
a: i32
|
||||
}
|
||||
|
||||
var<private> a: 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.
|
||||
std::string shader = R"(
|
||||
struct S {
|
||||
a: i32;
|
||||
};
|
||||
a: i32
|
||||
}
|
||||
|
||||
var<private> a: S;
|
||||
let e = 3;
|
||||
|
@ -418,8 +418,8 @@ TEST(ReplaceIdentifierTest, NotApplicable10) {
|
|||
// Can't replace `b` with `e` since the latter has a wrong access mode.
|
||||
std::string shader = R"(
|
||||
struct S {
|
||||
a: i32;
|
||||
};
|
||||
a: i32
|
||||
}
|
||||
|
||||
var<private> a: 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);
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -104,23 +104,5 @@ TEST_F(ParserImplTest, StructDecl_MissingBracketLeft) {
|
|||
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 tint::reader::wgsl
|
||||
|
|
Loading…
Reference in New Issue