Repository navigation
d3d12: refuse a shader-visible sampler heap above 2048 samplers, as the host does - #4925
bunbeans2-arch wants to merge 1 commit into
Conversation
…he host does CreateDescriptorHeap accepted a shader-visible SAMPLER heap of any size. D3D12 caps it at D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE (2048), the size the layer reports in OPTIONS19 and builds its bindless set for, and the host runtime refuses 2049 with E_INVALIDARG. Refuse it after the existing flag and node checks; a CPU-only sampler heap keeps no limit. d3d12_descriptor_test now creates sampler heaps of 2048 (shader-visible, S_OK), 2049 (shader-visible, E_INVALIDARG) and 2049 (CPU-only, S_OK). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Closing this: it goes the wrong way. As #4667 shows, refusing 2049 shader-visible samplers is what older host runtimes do (Windows 10 and Windows 11 23H2, which this was tested on: 10.0.22631); newer runtimes accept it, as the layer already does. Sorry for the noise. |
|
Request changes: the new cap is defensible, but the host-agreement test now fails on NVIDIA. Built Release/Ninja with MSVC 19.51 and Vulkan SDK 1.4.363 on an RTX 5070: The bindless set is 2049 including the fallback ( Not run: multi-vendor sweep. AI-assisted review, no game files. |
|
Thanks for testing it: that matches why I closed it. Newer runtimes accept 2049 shader-visible samplers, so main is right; the old 23H2 refusal is handled by #4667. |
Claimed in the coordination issue as: #4816 (comment)
What and why
ID3D12Device::CreateDescriptorHeapaccepted aD3D12_DESCRIPTOR_HEAP_TYPE_SAMPLERheap withD3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLEand anyNumDescriptors. D3D12 caps a shader-visible sampler heap atD3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE(2048), the size the layer reports in OPTIONS19 and builds its bindless set for. The host runtime refuses 2049 withE_INVALIDARG;d3d12_vulkan_device_testalready lists it on main:descriptor heap: shader-visible 2049 samplers: ours 0x00000000, host 0x80070057.Fix: refuse it with
E_INVALIDARGafter the existing flag and node checks (a null output still answersS_FALSEfirst, as on the host). A CPU-only sampler heap keeps no limit, as on the host.Not known: whether the Xbox runtime lets a title make a shader-visible sampler heap above 2048. The layer could not hold one anyway (its bindless set is 2048 + the fallback).
Tested
Windows 11, MSVC 14.51 (VS 2026), Release, AMD Radeon RX 9070 XT, AMD Software 26.10.1 (Vulkan driver 2.0.416):
d3d12_descriptor_test: fails on main (98fa503) at the new 2049 case (create(limit + 1, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE) == E_INVALIDARG), passes with this change. The test's sampling shader was not built here (no glslangValidator), so its GPU sampling part did not run; it does not touch heap creation.d3d12_vulkan_device_test: the 2049-sampler mismatch is gone. It still fails on mismatches main already has on this GPU (HARDWARE_PROTECTED committed texture, resource flag 0x400 on a buffer and a texture, format 67 as a render target), not touched here.ctest -R d3d12: 46 of 48 pass. The other failure,d3d12_typeless_rtv(line 301,CreateCommittedResource3of an MSAA texture with castable formats), fails the same way with main'sd3d12_vulkan_device.cpp.AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code