Make usage of overridable constants a validation error
This feature is not yet implemented in Tint and it not planned for OT.
BUG=dawn:799
Change-Id: Ib97dcd39e8ae956aa6fdc4cc1b148ec7f101b061
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/54280
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp
index 96fe955..930fcf4 100644
--- a/src/dawn_native/ShaderModule.cpp
+++ b/src/dawn_native/ShaderModule.cpp
@@ -886,6 +886,11 @@
for (auto& entryPoint : entryPoints) {
ASSERT(result.count(entryPoint.name) == 0);
+ if (!entryPoint.overridable_constants.empty()) {
+ return DAWN_VALIDATION_ERROR(
+ "Pipeline overridable constants are not implemented yet");
+ }
+
auto metadata = std::make_unique<EntryPointMetadata>();
DAWN_TRY_ASSIGN(metadata->stage, TintPipelineStageToShaderStage(entryPoint.stage));
diff --git a/src/tests/end2end/ShaderTests.cpp b/src/tests/end2end/ShaderTests.cpp
index 6184a5e..75a3eb8 100644
--- a/src/tests/end2end/ShaderTests.cpp
+++ b/src/tests/end2end/ShaderTests.cpp
@@ -305,6 +305,23 @@
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&rpDesc);
}
+// Feature currently not implemented in Tint, so should fail validation.
+TEST_P(ShaderTests, PipelineOverridableUsed) {
+ DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("skip_validation"));
+ DAWN_TEST_UNSUPPORTED_IF(!HasToggleEnabled("use_tint_generator"));
+
+ std::string shader = R"(
+[[override]] let foo : f32;
+
+[[stage(compute)]]
+fn ep_func() {
+ var local_foo : f32;
+ local_foo = foo;
+ return;
+})";
+ ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, shader.c_str()));
+}
+
DAWN_INSTANTIATE_TEST(ShaderTests,
D3D12Backend(),
MetalBackend(),