diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-21 17:53:20 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-21 18:28:13 -0500 |
| commit | bc14565c458489f3480a07208989096467641933 (patch) | |
| tree | f1d62260f7700992bab812e1407d784433afb53e /runtime/test/loader_test.cpp | |
| parent | d937b7f092dbc188b59754e5c73c1a9dac553cf9 (diff) | |
Runtime: texture views and samplers go into the bindless set (M2, the device's part)
The device now keeps set 0 of the translated shaders and puts into it what
views and samplers name. No pipeline binds the set yet: that comes with
the compute path. Until then rt::d3d12::bindless_set / bindless_set_layout
hand it out.
- Device: CreateShaderResourceView and CreateUnorderedAccessView of
textures write a T# into the slot, CreateSampler an S#
(gfx10_descriptors.h); each makes sure set 0 has the view or sampler and
the hash table has the key. The key is the descriptor's bytes, so a
copied descriptor needs nothing more. A view that cannot be shown (a
volume, a multisampled texture, the stencil plane, a range past the
texture) leaves a null descriptor, which finds the fallback. A texture
is named by an address of its own above 4 GiB that nothing dereferences;
its keys are erased and its indices freed when it is destroyed.
- VulkanDeviceInfo::bindless says the Vulkan device has the features; the
standalone device and the test helper enable them where the GPU has
them, with samplerAnisotropy and samplerMirrorClampToEdge.
- Every ExecuteCommandLists flushes the set before its commands are
written (VulkanContext::set_bindless_prepare).
- Layouts: a bindless descriptor has one image layout, but D3D12 samples a
texture both in a shader-resource state and while promoted from COMMON
(GENERAL here). With the set, a texture's shader-resource states use
GENERAL too (ResourceBinding::sampled_in_general). This follows from the
Vulkan rule for descriptor layouts; no test can see it broken, since the
validation layer does not follow dynamic indices into runtime arrays.
Not done, and listed in docs/d3d12_vulkan.md: buffer and constant-buffer
views, 1D/3D/multisampled and stencil views, descriptors the game writes
itself, static samplers and shaders' literal S#s, and holding back a flush
that moves table entries while earlier command lists still run.
Test: d3d12_descriptor_test, through the Xbox-ABI proxy. It decodes what
the slots hold (a view of an uploaded 8x8 texture, a sampler, a BGRA cube
view with a component mapping, an unordered-access view, null
descriptors). Then a compute shader (test/glsl/cs_sample.comp, compiled
with glslangValidator where it is found) is handed a slot's T# and the
sampler's S#, looks them up in the hash table as a translated shader does
and samples; the test creates that pipeline in Vulkan and binds the
device's set. It reads the texture through the view's own slot and
through a copy of it, and gets the fallback from a slot of bytes no view
was made for and, once the texture is destroyed, from the view's own
bytes. Without the table insert, or without the removal at destruction,
the test fails. The test no longer compiles d3d12_xs_device.cpp itself:
the COM library has it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/loader_test.cpp')
0 files changed, 0 insertions, 0 deletions