The device can allocate 1D textures and set 0 has a sampled 1D binding, but default and explicit views previously sampled the fallback. Use the texture dimension and the requested mip range when registering the view.
Cube descriptors carry a minimum resource LOD but were excluded when building the sampled Vulkan view. Include them alongside array views so a point sample from a restricted cube cannot select an earlier mip.
Volume depth belongs in the T# depth field, while its Vulkan view has a single array layer. Route matching descriptors through the existing 3D binding so a shader can select W slices and use a view-relative mip.
A UINT opaque-white border read back as 0 (Vonsek, on an RTX 5080). The S# has
no integer border types, since the hardware reads them by the image's format.
So bind_sampler gave Vulkan VK_BORDER_COLOR_FLOAT_*, which an integer image
reads as 0. The float and UINT samplers also shared one S# key and so one
VkSampler.
An integer border is now marked in the S#: BORDER_COLOR_PTR = 0x800
(gfx10::kIntegerBorderPtr), a field the hardware reads only for table colours.
That gives it its own key, and vulkan_sampler picks VK_BORDER_COLOR_INT_*.
d3d12_descriptor_test runs Vonsek's case: an R8G8B8A8_UINT texture sampled past
its edge through UINT black and white border samplers reads 0 and 1, and a
float white border reads 255. The case fails with the float enums on an RTX
4090. gfx10_descriptors_test and d3d12_sampler2_test check the mark.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two findings from the review of #328, on MSVC 19.44 and an RTX 5080.
- bind_image did not compile with MSVC (C2397): the view's aspect, picked
between two VkImageAspectFlagBits values, went into a VkImageAspectFlags
field in braces. MSVC's enums are ints, so that is a narrowing
conversion there; GCC and clang give the enum an unsigned type and accept
it. The value is cast now.
- d3d12_descriptor_test passed with the sampler index forced to 0, because
its point, clamping sampler and the fallback sampler read the same
texels. The test's sampler now wraps in U and the shader samples one
tile to the right: the right sampler gives the texture, the fallback its
right edge. With the index forced to 0 the test fails (texel 0 reads
224, 0, 135, 255 instead of 0, 0, 128, 255).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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>