The static-sampler readback loop skipped the 1.1 OPAQUE_WHITE_UINT row and
#8706's 1.2 UINT_BORDER_COLOR + TRANSPARENT_BLACK row, so both were checked
by their registered S# words only. They now sample the R8G8B8A8_UINT view one
tile to the right (every texel is the border) and expect 1 and 0 in every
channel, alpha included. Unregistered, the lookup falls back to the clamping
sampler and reads the texture's edge, which fails the check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
register_static_samplers took D3D12_SAMPLER_FLAG_UINT_BORDER_COLOR on
any border colour without a _UINT enum value for a pair D3D12 does not
define, and skipped the sampler: CreateRootSignature succeeded, the S#
was never registered and the shader sampled through the fallback
sampler.
The static enum has no transparent _UINT value, so the 1.2 flag on
TRANSPARENT_BLACK is how a root signature writes the integer border
(0,0,0,0). D3D12 serializes and creates it; the pairs it refuses are the
flag with the float OPAQUE_BLACK and OPAQUE_WHITE, which stay refused.
d3d12_descriptor_test gets a fifth static sampler row for it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
With it, d3d12_xs reads list slot 48 as the console's IASetVertexBuffers, so the PC-shaped fixture list's
ClearRenderTargetView never runs and Close fails. The branch also changes runtime/src/pe_loader.cpp and carried
committed conflict markers in docs/fssm_crosscheck.md. Its docs rows go with it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review findings from shdann's Windows run of the new console queue/list
work:
- d3d12_debug_markers (and every GPU harness compiled against the PC
headers) drove lists through the console-shaped proxy, so PC slots past
26 — including the PIX markers at 56-58, which have no console
counterpart — reached unrelated console methods or were dropped.
create_device_proxy gains console_lists: false hands the real
(PC-shaped) list back from CreateCommandList. The GPU tests pass false;
the title path keeps the console default.
- queue_proxy asserted E_NOTIMPL for the queue's console tail, but those
slots deliberately answer S_OK now — frame pacing flows through them.
The test's contract is updated; the fence tail stays refused.
- ChildProxy::queue_layout was a plain unsigned char read and written
from many threads; it is atomic like the device-wide detection it
caches.
xs_proxy_mock_test and loader_test pass under Wine; the modified test
objects compile clean under clang-cl. The GPU harnesses need a real
adapter — covered by shdann's Windows run.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The Vulkan device parsed a root signature's static samplers and dropped them,
so a shader holding one's S# by value missed in the hash table and sampled
through the fallback sampler. Each one now gets a sampler in set 0 and a key in
the hash table at root-signature creation, encoded as CreateSampler2 encodes
the same description (1.0, 1.1 and 1.2 blobs, the static border-colour enum,
the 1.2 flags).
d3d12_descriptor_test checks the key before and after for four root
signatures and samples with three of them on the GPU. docs/d3d12_vulkan.md no
longer says both that they are registered and that they are not.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A castable-format list may name the other family of a B8G8R8X8 or
B8G8R8A8 texture (relaxed casting). WARP and AMD's D3D12 driver accept
such lists both ways, typed and TYPELESS, and an SRV in a listed format
reads by its own format: alpha 1 for B8G8R8X8, the stored byte for
B8G8R8A8, and red and blue swapped when the list crosses channel orders
(an R8G8B8A8 texture read as B8G8R8A8 or B8G8R8X8). The layer kept the
list only as Vulkan formats, where both families are BGRA8, so it refused
a view across them, and its T# took the channel order from the image's
format, so a B8G8R8A8 view of an R8G8B8A8 texture read unswapped.
The resource now also keeps the list as the application gave it,
image_descriptor lets a view cross the families when the list names its
format, the alpha swizzle follows the view's format, and a colour view in
the other channel order takes its swizzle from that order (both orders
share one T# format code).
d3d12_descriptor_test adds a B8G8R8A8_UNORM texture listing
B8G8R8X8_UNORM, a B8G8R8X8_UNORM one listing B8G8R8A8_UNORM, and two
R8G8B8A8_UNORM ones listing B8G8R8X8_UNORM and B8G8R8A8_UNORM, each viewed
through the listed format: T# formats and swizzles, an unlisted format
refused, and the same bytes sampled through the bindless set.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A flush that grows the table or changes live keys now makes a new generation (table buffers, descriptor set, descriptors rewritten from a CPU shadow) that replay binds, and frees the old one once every submission up to its ticket has completed. No vkDeviceWaitIdle. Adds d3d12_bindless_churn_test and the LEONIDA_BINDLESS_IDLE_WAIT=1 comparison knob.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On MoltenVK (1.4.2, 1.4.3) the check sampled zeros: vkGetDescriptorSetLayoutSupport there accepts only layouts
of fewer than maxPerSetDescriptors (1212) descriptors, so size_bindings keeps the default 4096 2D images and
1024 samplers, and the test's 5001st view and 2100th sampler were refused as the arrays filled. MoltenVK does
create and sample a 65536-image, 4096-sampler set correctly (a native reproduction, and the whole test passes
under Wine with growth forced), so that is MoltenVK's to fix; the runtime keeps following the driver's answer.
The test now asks the set how much room it has (rt::d3d12::bindless_room, from BindlessSet::free_images and
free_samplers). Where the set holds the full counts nothing changes. Where it holds fewer, the test fills each
short array to its last index, checks the last view through the last sampler gives the texture, and that one
more view and sampler are refused and read as the fallbacks. The device logs at startup when its set holds
fewer samplers than a full shader-visible sampler heap. bindless_sizing_test gets MoltenVK's limits;
vk_bindless_test checks the free counts.
Creating an SRV of a depth texture (D16_UNORM/R16_TYPELESS or D32_FLOAT/R32_TYPELESS) with a colour format (e.g. R16_FLOAT, R16_SNORM, R16_UINT, R16_SINT, R32_UINT, R32_SINT) previously produced a colour-format VkImageView with VK_IMAGE_ASPECT_DEPTH_BIT, violating VUID-VkImageViewCreateInfo-image-01762. Tighten vulkan_view_format(), image_descriptor() and bind_image() so depth/stencil textures only accept their own family's depth/stencil SRV formats and colour textures reject depth/stencil view formats. Adds exhaustive unit tests and GPU + Vulkan validation tests.
- UAV clears of A4B4G4R4: an R4G4B4A4_PACK16 layout row (red in bits
12-15, alpha in 0-3), unit-checked in conversion_checks and cleared end
to end where the layer reports a typed UAV (the driver's call: WARP has
one, AMD's D3D12 driver doesn't).
- FORMAT_SUPPORT reports IA_VERTEX_BUFFER only for formats input layouts
accept (vertex_format), not every format Vulkan can fetch: R8/R16
SNORM/SINT (and R8G8 SNORM/SINT) have no input-layout mapping yet.
- new_format_round_trips: each render-target format is cleared to
(-3, -0.4, 0.25, 7) on the layer and on the host and the bytes compared,
which catches a mapping of the right size but the wrong numeric type
(R16_SNORM as UNORM, R8_SINT as UINT); no value is an exact half step.
The host is the Vulkan device's own adapter, as in
compare_format_support, not the default one.
- A4B4G4R4 is skipped where the Vulkan driver can't sample
R4G4B4A4_UNORM_PACK16 (Vulkan doesn't require it), by the driver's
format properties rather than the layer's answers; B4G4R4A4 and
B5G5R5A1 are never skipped.
- d3d12_copy_xfmt: D16_UNORM <-> R16_UINT and R16_SNORM copies, the new
members of depth_colour_pair, against the host and WARP.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Implements custom float and UINT sampler border colours on VK_EXT_custom_border_color in runtime/shims/d3d12_vulkan_device.cpp.
- Maintains a device-wide border colour table of up to 4000 entries.
- Assigns table indices into S# BORDER_COLOR_PTR [11:0] (with BORDER_COLOR_TYPE = table), ensuring distinct custom colours produce distinct keys in the bindless descriptor hash table while identical colours reuse existing indices.
- Chains VkSamplerCustomBorderColorCreateInfoEXT with VK_BORDER_COLOR_FLOAT_CUSTOM_EXT / VK_BORDER_COLOR_INT_CUSTOM_EXT and format = VK_FORMAT_UNDEFINED when customBorderColorWithoutFormat is enabled. Falls back to transparent black with a diagnostic warning when the extension is absent.
- Enables VK_EXT_custom_border_color in standalone device creation and vk_test_device.h.
- Updates d3d12_sampler2_test to verify table index assignment, index reuse, S# distinction between float and UINT representations, and Vulkan sampler creation.
- Documents the architecture in docs/d3d12_vulkan.md.
Tested on Windows 11, MSVC 2022 x64 (Ninja, RelWithDebInfo), NVIDIA GeForce RTX 2070 SUPER, Driver 595.79.
Clean-room verification suite (python compileall, make_game.py CLI, 27/27 CTest, d3d12_vulkan_device_test, d3d12_sampler2_test, d3d12_descriptor_test) passed with exit code 0.
Item: D3D-73 (#634)
Co-Authored-By: Antigravity <antigravity@google.com>
vulkan_format() had no entry for R16_UINT, R16_SINT, R16_SNORM, R8_UINT,
R8_SINT, R8_SNORM, R8_TYPELESS, R16G16_UNORM, R16G16_SNORM,
R16G16B16A16_SNORM or A4B4G4R4_UNORM, so CreateCommittedResource refused
them with E_INVALIDARG and FORMAT_SUPPORT answered DXGI_ERROR_UNSUPPORTED
where native D3D12 creates them (item 1 of the FORMAT_SUPPORT finding in
#1380).
A4B4G4R4_UNORM keeps alpha in bits 0-3 and red in 12-15 (cleared and
read back on native D3D12, RX 9070 XT and WARP), which is Vulkan's
R4G4B4A4_UNORM_PACK16; its T# row reads that as W, Z, Y, X.
Copies get the formats' texel sizes, D16 copies pair with R16 SNORM/UINT/
SINT like the other R16_TYPELESS members, and the colour-resolve check
refuses every integer format by numeric class instead of a list that
missed R8/R16 and the SINT forms of R8G8B8A8, R32 and R32G32B32A32.
Tests: d3d12_vulkan_device creates each format (as the host does), copies
a 4x4 upload in and back out bit for bit, and clears an A4B4G4R4 render
target to R, G, B and A; d3d12_descriptor_test samples A4B4G4R4 through
a T# alongside B4G4R4A4 and B5G5R5A1.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Map B8G8R8X8_UNORM, _UNORM_SRGB and _TYPELESS to the B8G8R8A8 Vulkan formats, so
creation, copies, footprints and clears work as for BGRA8. Shader views of the family
read alpha as 1 (the T# selects one for the alpha channel), and views between the
B8G8R8X8 and B8G8R8A8 typeless families are refused, although both land on the same
VkFormat.
Compared with the host D3D12 runtime on an RX 9060 XT: it reports no typed UAV for the
family and refuses typed B8G8R8X8 textures that allow unordered access (the typeless
format is accepted). The BGRA8 image would have advertised storage, so
CheckFeatureSupport now leaves the typed UAV bits out, texture creation refuses typed
B8G8R8X8 with ALLOW_UNORDERED_ACCESS, CreateUnorderedAccessView gives a null descriptor
for the family, and its images get no storage usage. WARP writes the clear's alpha into
the X byte, as Vulkan does, so clears need no change.
Tests: d3d12_clear_test clears B8G8R8A8_UNORM and B8G8R8X8_UNORM against WARP;
d3d12_vulkan_device_test compares B8G8R8X8 footprints, the typed UAV bits and UAV/RTV
resource creation with the host runtime; d3d12_descriptor_test samples a B8G8R8X8 and a
B8G8R8A8 texture with the same bytes through the bindless set (alpha 1 against the
stored byte) and checks the refused views.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sampler_descriptor() already encodes D3D12_FILTER_REDUCTION_TYPE_MINIMUM and MAXIMUM into the S# filter_mode and gfx10_descriptors.h already provides vulkan_reduction_mode(), but bind_sampler() ignored it and logged that minimum/maximum samplers blend for now.
Enable Vulkan 1.2 samplerFilterMinmax in device creation and vk_test_device.h, chain VkSamplerReductionModeCreateInfo in bind_sampler() when supported and not combined with compareEnable (falling back to blend with a log otherwise), update docs/d3d12_vulkan.md, and add a synthetic 2x2 GPU sampling test in d3d12_descriptor_test comparing MINIMUM, MAXIMUM, and STANDARD (negative control) linear filters.
Texture3D SRVs already encode ResourceMinLODClamp into the T# descriptor, but image_descriptor() rejected non-zero clamps and bind_image() only applied VK_EXT_image_view_min_lod / empty-mip-set swizzle zeroing to 2D, 2D-array and cube colour views.
Allow non-zero ResourceMinLODClamp on sampled 3D colour views, forward the T# clamp to Vulkan in bind_image(), update docs/d3d12_vulkan.md, and add synthetic GPU sampling and negative-control checks in d3d12_descriptor_test.
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.
R32G32B32_FLOAT/UINT/SINT/TYPELESS textures were refused ("texture format not
supported yet"). They are now R32G32B32A32 images on every GPU: most have no
optimal-tiling RGB32 image, and one that has would not avoid the repack, since
D3D12 places subresources at multiples of 512 bytes and Vulkan wants a copy's
buffer offset to be a multiple of the texel size
(VUID-vkCmdCopyBufferToImage-dstImage-07975).
- Footprints keep D3D12's 12-byte texels (compared with WARP).
- CopyTextureRegion between a texture and a buffer is repacked by the D24
compute pass (depth24_convert.comp modes 2 and 3, Depth24Job::rgb96): the
same scratch, parts and lifetime, texels of three words in the footprint and
four in the scratch, copied uninterpreted. depth24_convert.inc is
regenerated with the documented glslc command; the same glslc reproduces the
previous blob byte for byte from the previous source.
- WriteToSubresource/ReadFromSubresource take the staged copy, as D24-as-D32.
- A view's T# names GFX10_FORMAT_32_32_32_*, so alpha reads as one.
- Refused: unordered access and depth (as WARP), render targets (WARP has
them; not done, and FORMAT_SUPPORT and GetResourceAllocationInfo agree),
copies between a 96-bit and a four-channel texture, views of another
format family.
Tested on an RX 9070 XT (AMD 26.11.2), Windows 11: d3d12_rgb96_test matches
WARP and the expected texels bit for bit for 4 formats as 2D arrays with mips
and as volumes; d3d12_descriptor_test samples FLOAT, UINT and TYPELESS views.
Clean under the validation layer with sync validation; depth24_convert_test
and ctest (62) pass.
AI-assisted (Claude Code).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>