From 3148e83cffa02734942f7fa28cb783090430d939 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Mon, 17 May 2021 15:37:18 +0000 Subject: [PATCH] Use Tint as much as possible in fuzzers. Force the use_tint_generator toggle so that Tint is used as much as possible in fuzzers to get coverage of the relevant code. This will also fix a recurring fuzzer issue that required a code transform that only exists in the Tint path: bindings must be renumbered otherwise we hit an integer overflow in Swiftshader's descriptor set writes. Bug: chromium:1209602 Change-Id: Ie868fb07306f96a8ecf42a687313e0a466041a45 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51240 Reviewed-by: Corentin Wallez Reviewed-by: Ryan Harrison Reviewed-by: Austin Eng Auto-Submit: Corentin Wallez Commit-Queue: Ryan Harrison --- src/fuzzers/DawnWireServerAndD3D12BackendFuzzer.cpp | 7 ++++++- src/fuzzers/DawnWireServerAndFrontendFuzzer.cpp | 7 ++++++- src/fuzzers/DawnWireServerAndVulkanBackendFuzzer.cpp | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/fuzzers/DawnWireServerAndD3D12BackendFuzzer.cpp b/src/fuzzers/DawnWireServerAndD3D12BackendFuzzer.cpp index 79211361a8..ae7c05a364 100644 --- a/src/fuzzers/DawnWireServerAndD3D12BackendFuzzer.cpp +++ b/src/fuzzers/DawnWireServerAndD3D12BackendFuzzer.cpp @@ -34,7 +34,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (properties.backendType == wgpu::BackendType::D3D12 && properties.adapterType == wgpu::AdapterType::CPU) { - device = wgpu::Device::Acquire(adapter.CreateDevice()); + // Force usage of Tint to provide coverage of that code path until it becomes + // the default. + dawn_native::DeviceDescriptor desc; + desc.forceEnabledToggles.push_back("use_tint_generator"); + + device = wgpu::Device::Acquire(adapter.CreateDevice(&desc)); break; } } diff --git a/src/fuzzers/DawnWireServerAndFrontendFuzzer.cpp b/src/fuzzers/DawnWireServerAndFrontendFuzzer.cpp index f41b8cb195..3b1480caa0 100644 --- a/src/fuzzers/DawnWireServerAndFrontendFuzzer.cpp +++ b/src/fuzzers/DawnWireServerAndFrontendFuzzer.cpp @@ -34,7 +34,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { adapter.GetProperties(&properties); if (properties.backendType == wgpu::BackendType::Null) { - nullDevice = wgpu::Device::Acquire(adapter.CreateDevice()); + // Force usage of Tint to provide coverage of that code path until it becomes + // the default. + dawn_native::DeviceDescriptor desc; + desc.forceEnabledToggles.push_back("use_tint_generator"); + + nullDevice = wgpu::Device::Acquire(adapter.CreateDevice(&desc)); break; } } diff --git a/src/fuzzers/DawnWireServerAndVulkanBackendFuzzer.cpp b/src/fuzzers/DawnWireServerAndVulkanBackendFuzzer.cpp index b23b132e8c..0159a48252 100644 --- a/src/fuzzers/DawnWireServerAndVulkanBackendFuzzer.cpp +++ b/src/fuzzers/DawnWireServerAndVulkanBackendFuzzer.cpp @@ -34,7 +34,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (properties.backendType == wgpu::BackendType::Vulkan && properties.adapterType == wgpu::AdapterType::CPU) { - device = wgpu::Device::Acquire(adapter.CreateDevice()); + // Force usage of Tint to provide coverage of that code path until it becomes + // the default. + dawn_native::DeviceDescriptor desc; + desc.forceEnabledToggles.push_back("use_tint_generator"); + + device = wgpu::Device::Acquire(adapter.CreateDevice(&desc)); break; } }