Commit Graph

7 Commits

Author SHA1 Message Date
efeef30822 d3d12: select integer transparent black for UINT custom border fallback
- 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>
2026-11-22 16:14:57 +01:00
3e3d94f65c d3d12: custom sampler border colours on VK_EXT_custom_border_color (D3D-73)
- 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>
2026-11-22 16:14:56 +01:00
c491cf097c Tests: d3d12_sampler2 compares non-normalized cases only with a host that has them (TEST-191)
The test compared all 22 CreateSampler2 edge cases with the host's PC
runtime. A host that reports no NonNormalizedCoordinateSamplersSupported
leaves every non-normalized description unwritten, so the test failed
at the first one ("UINT border and non-normalized: ours written 1, host
runtime 0"). It printed that the host lacks the feature, then compared
anyway. Since 817a5e9 registered it with ctest, ctest fails on such
hosts.

Each edge case now records whether its description has
D3D12_SAMPLER_FLAG_NON_NORMALIZED_COORDINATES, read from the description
itself. Without the feature on the host, only the 3 cases without the
flag are compared live. The layer's answers to all 22 are still checked
against the recorded RTX 4090 / WARP answers first, as before. The
host's normalized-vs-not descriptor check runs only when the host has
the feature.

Measured on the host's default adapter here, a Radeon 680M (D3D12
driver 31.0.14084.6002): it reports no non-normalized samplers and
leaves all 19 non-normalized descriptions unwritten, which
docs/d3d12_vulkan.md now records.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:25:13 +02:00
817a5e9f5e Tests: run the eight unregistered D3D12 GPU tests under ctest
d3d12_clear, d3d12_com, d3d12_descriptor, d3d12_method_variants,
d3d12_resource_desc, d3d12_sampler2, d3d12_typeless_rtv and d3d12_uav_clear were
built but never added with add_test, so ctest and CI never ran them. Each now
exits 77 when there is no Vulkan GPU (DeviceStatus::unavailable), as
d3d12_vulkan_device_test does, and is registered with SKIP_RETURN_CODE 77.

(cherry picked from commit 2af37e5da368dd130ba23db385e812635cb1a768)
2026-11-22 00:33:45 -05:00
fac8b022d5 fix: preserve NEVER comparison samplers in set 0
The hardware depth function is zero for both a regular sampler and a NEVER comparison. Give layer-created NEVER comparisons a separate descriptor key so Vulkan binds a comparison-enabled sampler.
2026-11-22 04:39:05 +01:00
b3e71d7a4d runtime: UINT border colours use VK_BORDER_COLOR_INT_* (#538 review)
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>
2026-11-22 01:03:36 +00:00
ffb5e34b9c runtime: CreateSampler2 on the Vulkan device (D3D-28, part 2)
CreateSampler2 wraps CreateSampler. The UINT border colour maps (0,0,0,0),
(0,0,0,1) and (1,1,1,1) to the S#'s border types, and anything else to the
table. Non-normalized coordinates set FORCE_UNNORMALIZED. A description the PC
runtime refuses (unknown flags; a non-normalized sampler with an unequal
min/mag filter, a linear mip filter, anisotropy, comparison, a U/V address mode
other than clamp/border, or a non-zero LOD or bias) leaves the slot as it was,
as the runtime does on an RTX 4090 and on WARP. The layer now answers
D3D12_OPTIONS17 with NonNormalizedCoordinateSamplersSupported, as both report.

d3d12_sampler2_test compares the S# bytes with CreateSampler's and the 22
edge cases with the host's PC runtime live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:03:36 +00:00