Pipeline overridable constants: D3D12 backend

D3D12 doesn't have native pipeline constants feature.
This is done by using #define. Add some new tests to make
sure these define approaches work as expected.

Also makes duplicate pipeline constant entries an invalid
case.

Bug: dawn:1137
Change-Id: Iefed44a749625b535bbafbb39f42699f0b42e06a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68860
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
This commit is contained in:
shrekshao
2021-11-18 17:47:45 +00:00
committed by Dawn LUCI CQ
parent fd066a3345
commit c6c4588036
9 changed files with 309 additions and 40 deletions

View File

@@ -105,12 +105,12 @@ TEST_F(ComputePipelineOverridableConstantsValidationTest, ConstantsIdentifierLoo
TestCreatePipeline(constants);
}
{
// Valid: set the same constant twice
// Error: set the same constant twice
std::vector<wgpu::ConstantEntry> constants{
{nullptr, "c0", 0},
{nullptr, "c0", 1},
};
TestCreatePipeline(constants);
ASSERT_DEVICE_ERROR(TestCreatePipeline(constants));
}
{
// Valid: find by constant numeric id
@@ -158,12 +158,12 @@ TEST_F(ComputePipelineOverridableConstantsValidationTest, UninitializedConstants
TestCreatePipeline(constants);
}
{
// Valid: all constants initialized (with duplicate initializations)
// Error: duplicate initializations
std::vector<wgpu::ConstantEntry> constants{
{nullptr, "c0", false}, {nullptr, "c2", 1}, {nullptr, "c5", 1},
{nullptr, "c8", 1}, {nullptr, "c2", 2},
};
TestCreatePipeline(constants);
ASSERT_DEVICE_ERROR(TestCreatePipeline(constants));
}
}