mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-11 22:44:04 +00:00
tint/SingleEntryPoint: Handle diagnostic directive
Add some E2E tests to make sure that we actually produce valid code for each backend when diagnostic filtering is present. Bug: tint:1809 Change-Id: I5e903ac0d2ca385967211bb889f86cb85de8f418 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117590 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
1226320a5b
commit
2dbb7b4f6a
@@ -114,6 +114,7 @@ Transform::ApplyResult SingleEntryPoint::Apply(const Program* src,
|
||||
}
|
||||
},
|
||||
[&](const ast::Enable* ext) { b.AST().AddEnable(ctx.Clone(ext)); },
|
||||
[&](const ast::DiagnosticControl* dc) { b.AST().AddDiagnosticControl(ctx.Clone(dc)); },
|
||||
[&](Default) {
|
||||
TINT_UNREACHABLE(Transform, b.Diagnostics())
|
||||
<< "unhandled global declaration: " << decl->TypeInfo().name;
|
||||
|
||||
@@ -611,5 +611,25 @@ fn main() {
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
TEST_F(SingleEntryPointTest, Directives) {
|
||||
// Make sure that directives are preserved.
|
||||
auto* src = R"(
|
||||
enable f16;
|
||||
diagnostic(off, derivative_uniformity);
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn main() {
|
||||
}
|
||||
)";
|
||||
|
||||
SingleEntryPoint::Config cfg("main");
|
||||
|
||||
DataMap data;
|
||||
data.Add<SingleEntryPoint::Config>(cfg);
|
||||
auto got = Run<SingleEntryPoint>(src, data);
|
||||
|
||||
EXPECT_EQ(src, str(got));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
|
||||
Reference in New Issue
Block a user