Fix D3D12 Sampler Heap tests to reference their bindings in WGSL

Tint only reflects the bindings that are statically used so before this
fix it would produce an empty pipeline layout. Fix this by statically
referencing the sampler binding in the shader.

Fixed: dawn:754
Change-Id: I381acd9adb7d1e80ccf0642b5189750a5a43de25
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47420
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Corentin Wallez 2021-04-09 12:08:18 +00:00 committed by Commit Bot service account
parent 59f2038dce
commit 5ce6472b1e
1 changed files with 3 additions and 5 deletions

View File

@ -171,9 +171,6 @@ TEST_P(D3D12DescriptorHeapTests, SwitchOverViewHeap) {
// Verify the shader visible sampler heaps does not switch over within a single submit. // Verify the shader visible sampler heaps does not switch over within a single submit.
TEST_P(D3D12DescriptorHeapTests, NoSwitchOverSamplerHeap) { TEST_P(D3D12DescriptorHeapTests, NoSwitchOverSamplerHeap) {
// TODO(crbug.com/tint/704): Fails for D3D12 with use_tint_generator
DAWN_SKIP_TEST_IF(IsD3D12() && HasToggleEnabled("use_tint_generator"));
utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor; utils::ComboRenderPipelineDescriptor2 renderPipelineDescriptor;
// Fill in a sampler heap with "sampler only" bindgroups (1x sampler per group) by creating a // Fill in a sampler heap with "sampler only" bindgroups (1x sampler per group) by creating a
@ -181,14 +178,15 @@ TEST_P(D3D12DescriptorHeapTests, NoSwitchOverSamplerHeap) {
// because the sampler heap allocations are de-duplicated. // because the sampler heap allocations are de-duplicated.
renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"( renderPipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>; [[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void { [[stage(vertex)]] fn main() {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0); Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})"); })");
renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"( renderPipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> FragColor : vec4<f32>; [[location(0)]] var<out> FragColor : vec4<f32>;
[[group(0), binding(0)]] var sampler0 : sampler; [[group(0), binding(0)]] var sampler0 : sampler;
[[stage(fragment)]] fn main() -> void { [[stage(fragment)]] fn main() {
let referenceSampler : sampler = sampler0;
FragColor = vec4<f32>(0.0, 0.0, 0.0, 0.0); FragColor = vec4<f32>(0.0, 0.0, 0.0, 0.0);
})"); })");