Skip to content

Commit

Permalink
Fix Zero Sized Sampler Heap Issue (#7054)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored Feb 3, 2025
1 parent ff4496b commit d9e9c3a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion wgpu-hal/src/dx12/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,16 @@ impl super::Adapter {
)
};

if res.is_ok() {
// Sometimes on Windows 11 23H2, the function returns success, even though the runtime
// does not know about `Options19`. This can cause this number to be 0 as the structure isn't written to.
// This value is nonsense and creating zero-sized sampler heaps can cause drivers to explode.
// As as we're guaranteed 2048 anyway, we make sure this value is not under 2048.
//
// https://github.com/gfx-rs/wgpu/issues/7053
let is_ok = res.is_ok();
let is_above_minimum = features19.MaxSamplerDescriptorHeapSize
> Direct3D12::D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE;
if is_ok && is_above_minimum {
max_sampler_descriptor_heap_size = features19.MaxSamplerDescriptorHeapSize;
}
};
Expand Down

0 comments on commit d9e9c3a

Please sign in to comment.