Repository navigation
Runtime: typed RTVs of every typeless color family (D3D-275) - #2103
Conversation
- ColorViewFormat now holds the view's VkFormat number (the RGBA8 names keep their values), and CreateRenderTargetView accepts any typed format of a TYPELESS color texture's family (B8G8R8A8 and B8G8R8X8 kept apart), not only RGBA8. - ResourceBinding::rgba8_typeless becomes typeless (any TYPELESS color resource); color_view_format accepts a format of the resource's family (typeless_view_family, R8 included for when it is mapped), so clears go through a view in the RTV's format. Attachment views of every typeless image ask for color-attachment usage only. - d3d12_typeless_families_test: every typed RTV format of each family, two clear values, bytes compared with the host D3D12 on the same adapter (LUID) and reported against WARP. - docs/d3d12_vulkan.md: the typeless RTV section. AI-assisted.
- d3d12_typeless_families_test also draws a full-screen pass (GLSL stand-ins of translated shaders found by FSSM hash; the host's HLSL through d3dcompiler_47) into R16G16B16A16_UINT/FLOAT/UNORM, R32_UINT/FLOAT, R10G10B10A2_UINT/UNORM and R8G8B8A8_UINT RTVs of TYPELESS textures, PSO RTVFormats naming the typed format: 8 of 8 equal the host D3D12 on the same adapter, no validation error. - Draws need no layer change: the replay's draw attachment view already takes the PSO's RTVFormats[slot] (GraphicsPipeline::color_formats), which D3D12 requires to equal the RTV's; the same draws matched before the clear fix too. - test/glsl/ps_typeless_float.frag, ps_typeless_uint.frag; docs/d3d12_vulkan.md typeless RTV section. AI-assisted.
|
Tested
|
|
Tested All 62 clears and all 8 draws matched native D3D12 byte for byte. The test skipped 10 unsupported view formats (20 clear cases). No draws were skipped. WARP differed from the hardware reference on 8 clears. CTest passed. AI-assisted test run. |
|
AI-assisted Radeon verification of D3D-275 on AMD Radeon(TM) Graphics (1002:13c0, Ryzen 7 9800X3D iGPU), Windows 11 25H2 build 26200.9974, Windows display driver
Both runs used the same cases and native reference bytes. Ten clear view formats were skipped on each revision because the layer currently has no mapping: R16G16B16A16_SNORM, R16G16_UNORM/SNORM, R16_UINT/SNORM/SINT and the four R8 views. There were no additional Radeon format skips. Radeon rounds the R16G16B16A16_UNORM clear of 0.5 to I ran only Runs were serial with a 60-second process deadline, one physical Vulkan device, the AMD ICD only, an empty implicit-layer path, and Khronos 1.4.363 core and synchronization validation. Scope was synthetic 4×4, single-sample, 2D RTV clears and draws with readback. The other parts of the original finding (UAV clears, depth SRVs and resolves) were outside GPU test scope. Original finding |
0xTehuti
left a comment
There was a problem hiding this comment.
GPU Verification & Review (NVIDIA Turing / RTX 2070 SUPER)
Tested and verified on Windows 11 with MSVC 2022, Ninja, CMake, and Vulkan SDK 1.4:
- GPU: NVIDIA GeForce RTX 2070 SUPER (Driver 595.79, 8192 MB VRAM, Vulkan 1.4.363)
- Validation Layers: Khronos Validation Layer active (
LEONIDA_VK_VALIDATION=1)
Test Results
d3d12_vulkan_device: PASSED (8.57s, 0 validation errors)d3d12_typeless_families_test: PASSED (62 clears and 8 full-screen draws matched byte-for-byte with the native host D3D12 on the RTX 2070 SUPER; 0 validation errors)
Engineering Review Notes
- The extension of
ColorViewFormatand handling of typeless color resource families (B8G8R8A8,R16G16B16A16,R32G32B32A32,R32G32,R16G16,R10G10B10A2,R8G8,R32,R16) works cleanly and eliminates clears falling back to incorrect formats. - Minor observation: in
d3d12_typeless_families_test.cpp, line 395 introduceswarning C4189: 'drawn': local variable is initialized but not referencedwhen shaders are conditionally omitted. Not blocking, but can be cleaned up in a future pass.
LGTM. Ready to merge from a Windows + NVIDIA hardware perspective.
AI-assisted verification (Orca / Antigravity). No game data used.
|
Tested AI-assisted (Claude Code). |
|
Tested
AI-assisted (Claude Code). |
What and why
D3D-275 (claim), the views half of @zneel's finding; the resolves (D3D-274) are not touched.
CreateRenderTargetViewreinterpreted only the RGBA8 typeless family andcolor_view_format(runtime/src/vulkan_replay.h) returned the resource's own format for the others, so a clear through a typed RTV of a non-RGBA8 TYPELESS texture wrote the resource's format.ColorViewFormatholds the view's Vulkan format (the existing RGBA8 names keep their values, so callers are unchanged);CreateRenderTargetViewaccepts any typed format of a typeless texture's family.color_view_formataccepts any format of the family, so the clear goes through a view in the RTV's format. Typeless images were already created mutable, so no image change.RTVFormats(viewed.format = pipeline->color_formats[slot]), which D3D12 requires to equal the RTV's. Confirmed by reverting the layer half of this PR: clears go back to 34 differing, draws still match. The test now covers both.docs/d3d12_vulkan.md, typeless RTV section.Tested
New
d3d12_typeless_families_test: every typed view of each family, cleared to (0.5, 7, -1, 300) and read back, compared byte for byte with the host D3D12 on the same adapter (matched by LUID, not the default adapter); plus 8 full-screen draws (R16G16B16A16 UINT/FLOAT/UNORM, R32 UINT/FLOAT, R10G10B10A2 UINT/UNORM, R8G8B8A8_UINT) against the host with HLSL fromd3dcompiler_47.origin/main4eb6155 (test only): 34 of 62 clears differ, e.g. an R16G16B16A16_UNORM view of R16G16B16A16_TYPELESS: hostff7fffff0000ffff, main0038004700bcb05c(the clear written as half floats); a B8G8R8A8_UNORM_SRGB view: host00ffbcff, main00ff7fff(no sRGB encoding).main(the R8 family, R16G16B16A16_SNORM, R16G16_UNORM/SNORM, R16_UINT/SNORM/SINT; d3d12: map the 11 R8/R16 and A4B4G4R4 formats the host creates (D3D-259) #1914 maps some). The test is driven by the layer's own format support, so they get covered when they are mapped; nothing here touches d3d12: map the 11 R8/R16 and A4B4G4R4 formats the host creates (D3D-259) #1914's files.LEONIDA_VK_VALIDATION=1: 0 validation errors.d3d12_com(segfault),d3d12_debug_markers,d3d12_indirect_rt,d3d12_draw,d3d12_set0_compute, which fail the same way onorigin/main4eb6155 without this branch.NVIDIA GeForce RTX 3060, driver 32.0.16.1714, Windows 11, MSVC 19.51, Windows SDK 10.0.26100. No game files. AI-assisted (Claude).