Add support for Tint's HLSL writer as a Toggle

This commit adds a Toggle that switches SPIRV-cross's HLSL generator for
Tint's HLSL writer. New Toggle currently defaults to false.

Bug: dawn:548
Change-Id: I37e238c6ba887efd65727809c8a6919df515a35e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31640
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Enrico Galli <enrico.galli@intel.com>
This commit is contained in:
Enrico Galli
2020-11-05 18:52:49 +00:00
committed by Commit Bot service account
parent c1dbb2625b
commit 2b6b0f45ff
10 changed files with 131 additions and 23 deletions

View File

@@ -637,6 +637,15 @@ bool DawnTestBase::IsAsan() const {
#endif
}
bool DawnTestBase::HasToggleEnabled(const char* toggle) const {
for (const char* toggleEnabled : mParam.forceEnabledWorkarounds) {
if (strcmp(toggle, toggleEnabled) == 0) {
return true;
}
}
return false;
}
bool DawnTestBase::HasVendorIdFilter() const {
return gTestEnv->HasVendorIdFilter();
}

View File

@@ -254,6 +254,8 @@ class DawnTestBase {
bool IsAsan() const;
bool HasToggleEnabled(const char* workaround) const;
void StartExpectDeviceError();
bool EndExpectDeviceError();

View File

@@ -72,6 +72,10 @@ TEST_P(EntryPointTests, TwoComputeInModule) {
// TODO: Reenable once Tint is able to produce Vulkan 1.0 / 1.1 SPIR-V.
DAWN_SKIP_TEST_IF(IsVulkan());
// TODO: Reenable once Tint's HLSL writer supports multiple entryPoints on a single stage.
// https://crbug.com/tint/297
DAWN_SKIP_TEST_IF(IsD3D12() && HasToggleEnabled("use_tint_generator"));
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
[[block]] struct Data {
[[offset(0)]] data : u32;
@@ -141,6 +145,7 @@ TEST_P(EntryPointTests, TwoComputeInModule) {
DAWN_INSTANTIATE_TEST(EntryPointTests,
D3D12Backend(),
D3D12Backend({"use_tint_generator"}),
MetalBackend(),
OpenGLBackend(),
VulkanBackend());