- d3d12_vulkan_device.cpp, vk_test_device.h: #760 chained VkPhysicalDeviceCustomBorderColorFeaturesEXT onto
enable13, which #1706 replaced with leonida::Vulkan13Features; it goes at *v13.next() like the other later
feature structs. The runtime and the GPU test harness didn't compile.
- check_vk_pipeline_cli.cmake: #1958's lds_bytes cases matched "malformed JSON"; the index parser reports where it
stopped ("... at byte 37"), which the check now matches.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D3D12_STANDARD_MULTISAMPLE_PATTERN and D3D12_CENTER_MULTISAMPLE_PATTERN
are only in d3d12.h from DirectX-Headers 1.613 (D3D12_SDK_VERSION 613)
on; older Windows SDK 10.0.26100 headers lack them, so gta6rt_d3d12_com
and d3d12_vulkan_device_test stop with C2065 under VS 2022. They are
enum members, so an #ifndef fallback can't detect them. Use the equal
DXGI_STANDARD/CENTER_MULTISAMPLE_QUALITY_PATTERN macros from
dxgicommon.h, which d3d12.h includes on every SDK.
Review on #1911: two containers with the same kind-6 program and different kind-0 entries (32x1x1 and 64x1x1)
translate to different modules but got the same fspx_code_sha256, so both resolved to the same pipeline.
- tools/fspx_unpack.py writes the kind-0 entry as fspx/<name>.state; tools/shader_meta.py records its SHA-256 as
fspx_state_sha256 next to fspx_code_sha256.
- make_game.py: entries with the same code and state keys must have identical modules, otherwise the FSPX step fails
naming both programs and drops the index. The same code key with other state keys is allowed.
- runtime: a container or bare payload (kinds 0 and 6 present) matches the code key and then the state key; no match
is E_INVALIDARG. A bare kind-6 program (slot 67, no kind 0) takes the code key's entries when their modules are
identical, and is refused with E_INVALIDARG and an "ambiguous" log line when they differ.
- Tests: the review case in tests/test_fspx_shaders_stage.py, shader_library_test and d3d12_fspx_compute_test.
- docs/fspx.md: the two keys and the ambiguous case.
On 1.0.2.1 the 29 kind-6 programs are distinct, so nothing resolved wrongly before: 17 translated entries, 17
distinct code keys, 17 distinct (code, state) pairs, all 17 found from the container and from the bare program.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A host run on an RTX 4070 SUPER and a UHD 770 (@CowBoYdu76) creates a
HARDWARE_PROTECTED default heap, though the D3D12_HEAP_FLAGS
documentation calls it unsupported. heap_desc_refusal no longer refuses
it; it moves from the refusal cases to compare_heap_neighbours and the
accepted list. ALLOW_DISPLAY stays refused, now confirmed on those hosts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vertex_format() mapped the unsigned and float variants of R16, R8G8 and R8 but not R16_SNORM, R16_SINT, R8G8_SNORM, R8G8_SINT, R8_SNORM or R8_SINT, so a PSO whose input layout used one was refused with E_INVALIDARG. Add the six rows and cover them in d3d12_draw_test: the SNORM formats use the float VS, the SINT formats an integer-input VS declared ivec4. The test fails on the old table at line 157 (format 58) and passes with the rows, with no validation messages on an RTX 3070.
The runtime's standalone device (d3d12_vulkan_device.cpp) still took
"the first usable device, replaced by every later discrete GPU". #915
fixed that rule in the test harnesses because Mesa's Dozen (Microsoft
vendor 0x1414, "Microsoft Direct3D12 (<gpu>)") reports a discrete GPU, so
on a PC with the OpenCL/OpenGL/Vulkan Compatibility Pack the runtime
could run on the Vulkan-on-D3D12 wrapper while the tests used the native
driver. Even without Dozen, on a two-dGPU PC the runtime took the last
GPU and vk_test_device.h the first.
- runtime/src/vulkan_device_filter.h: vulkan_device_rank() (native over
Microsoft's layers, then discrete > integrated > virtual > CPU), with
the device type as an int so the header stays Vulkan-free.
- d3d12_vulkan_device.cpp: the first usable device of the highest rank.
- vk_device_pick.h: device_rank forwards to it (static_assert on the
VkPhysicalDeviceType values).
- d3d12_indirect_rt_test, dxgi_swapchain_test, vk_image_fuzz,
vk_sampler_test had the old loop and ignored LEONIDA_VK_DEVICE: they
now filter and rank like the rest, and an unmatched filter fails
instead of skipping.
- vulkan_device_filter_test: the rank order; docs/testing.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- 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>
B8G8R8X8 has no alpha, and WARP and AMD's D3D12 driver blend into it with
destination alpha 1. Its Vulkan image is BGRA8, so the blend factors that
read destination alpha read the X byte instead. For B8G8R8X8 render
targets the PSO now turns DST_ALPHA into ONE, ONE_MINUS_DST_ALPHA into
ZERO and the colour SRC_ALPHA_SATURATE into ZERO, in the colour and alpha
factors alike.
d3d12_draw_test blends a full-screen pass into B8G8R8X8 and B8G8R8A8
targets cleared with alpha 0.25 through the five factors that read
destination alpha, and compares red, green and blue. The X byte is left
out: WARP writes 0 there after a draw and AMD the blended alpha, and no
view reads it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- For samplers with custom border colours (BorderColor::table), retain is_int in the fallback path when VK_EXT_custom_border_color is unavailable.
- Select VK_BORDER_COLOR_INT_TRANSPARENT_BLACK for UINT custom borders and VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK for float custom borders, satisfying Vulkan input validation rules on integer views (reported by Vonsek, #760).
- In vulkan_sampler(), default to VK_BORDER_COLOR_INT_TRANSPARENT_BLACK when sampler.integer_border is set for table colours.
- Update d3d12_sampler2_test with a fallback device and vkCreateSampler interception to verify that VK_BORDER_COLOR_INT_TRANSPARENT_BLACK and VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK are requested as expected.
Tested on Windows 11, MSVC 2022 x64 (Ninja, RelWithDebInfo), NVIDIA GeForce RTX 2070 SUPER.
Clean-room verification suite passed with exit code 0.
Co-Authored-By: Antigravity <antigravity@google.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>
heap_desc_refusal now also refuses D3D12_HEAP_FLAG_ALLOW_DISPLAY and
HARDWARE_PROTECTED, which the D3D12_HEAP_FLAGS documentation says
CreateHeap does not support (review on #1820). Both are host-comparison
cases in compare_invalid_arguments, awaiting a host run, and direct
refusal checks on the standalone device.
CreateHeap1, its heap1 test cases and the heap_create1 helper are
removed: #1846 implements CreateHeap1 over CreateHeap and inherits these
checks. The docs keep #1846's CreateHeap1 line untouched and describe
the CreateHeap checks under the heap bullet instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CreateGraphicsPipelineState refused every SampleDesc.Quality but 0. Native
D3D12 (RX 7800 XT, a Radeon iGPU and WARP) accepts 0,
D3D12_STANDARD_MULTISAMPLE_PATTERN and D3D12_CENTER_MULTISAMPLE_PATTERN and
refuses 1 (past NumQualityLevels). The standard pattern is Vulkan's standard
positions, so it is accepted; the centre pattern needs custom sample
locations and is refused with a log until those exist.
At replay every bound render target and depth target must have the PSO's
sample count (D3D12 leaves a mismatch undefined, Vulkan's dynamic rendering
forbids it), so a mismatched draw fails the list with invalid_subresource
instead of reaching the driver.
d3d12_msaa_draw_test (in ctest): 4x draws with a depth target, SampleMask 0x1
and ResolveSubresource; the quality rules; a 4x PSO into a 1x target.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--wave64-emulate adds %x_buf (2L + 6W + 7 dwords) on top of the LDS
array, so a 64 KiB LDS made modules over maxComputeSharedMemorySize,
which spirv-val accepts and RADV dies on (#1721).
Translator: a 64 KiB hard cap (MAX_SHARED_BYTES, --max-shared-memory).
Over it, the pow2-rounded LDS array shrinks to the room left when the
program's need fits (indices wrap with OpUMod); otherwise the shader is
refused (Unsupported, with the byte counts). lds_bytes in index.json is
now the whole Workgroup total.
Runtime: the D3D12 shim's create_compute compares lds_bytes with the
device's maxComputeSharedMemorySize (32768 on AMD Windows and Intel)
and refuses the pipeline with a log line instead of creating it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The graphics pipelines use the Vulkan 1.3 core dynamic states (primitive topology, primitive restart, vertex
binding stride) and their commands (vkCmdBindVertexBuffers2, vkCmdSetPrimitiveTopology,
vkCmdSetPrimitiveRestartEnable). On a Vulkan 1.2 device these come from VK_EXT_extended_dynamic_state and
VK_EXT_extended_dynamic_state2, with the same values and signatures. Vulkan13Features now enables both where
the device has them, and device_proc_or_khr also tries the EXT name. Without them a 1.2 device still works for
compute, and graphics pipelines are refused as before.
AI-assisted. No game files.