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>
This commit is contained in:
Ryan Harrison 2021-06-14 19:07:17 +00:00 committed by Dawn LUCI CQ
parent 3a9174a4c9
commit 8c584a1f4c
2 changed files with 22 additions and 0 deletions

View File

@ -886,6 +886,11 @@ namespace dawn_native {
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));

View File

@ -305,6 +305,23 @@ fn fragmentMain(input : VertexOut) -> [[location(0)]] vec4<f32> {
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(),