Repository navigation
Conversation
CopyResource, CopyTextureRegion (texture to texture, footprint to texture and back, boxes, offsets, array slices, mips, 3D) and CopyBufferRegion run on the layer and on a host D3D12 device (LEONIDA_HOST_ADAPTER picks it) and the bytes read back are compared, for 39 format/shape cases including BC1-7 and depth-stencil. Layer fixes it found: texture formats R8G8_SNORM, R16_UNORM, R32G32_UINT, R9G9B9E5, B5G6R5 and B5G5R5A1 were refused; a block-compressed texture-to-texture box reaching the padded mip edge was refused as invalid_copy. Known differences (TEXTURE1D, D24 on GPUs without it, D24 X8 byte) are documented. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Block-compressed texture-to-texture copies: the box is rounded to whole blocks, must fit the destination's padded mip (a 16-wide box into a 4-wide mip is invalid_copy again), and the extent is cut only where it reaches an edge and must satisfy both images (block multiple or at that image's edge), else invalid_copy. Test: copies between different mips (RGBA8, BC1, BC7) and boxes that do not fit, with the host's refusal compared; a LEONIDA_HOST_ADAPTER that matches nothing fails the run; D24 without a native format still checks the bit-preserving copies; the partial copies are ordered after the uploads by a COPY_SOURCE round trip; <cctype>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # runtime/test/d3d12_vulkan_device_test.cpp
|
D3D-46 landing-order check on The tests address different behavior. This PR compares copy bytes with the host. #562 samples RGB9E5 via the heap SRV to check its shared exponent, channels and alpha; #587 clears a B5G6R5 RTV and checks the two-byte result inside and outside the rectangle. All three can coexist with one mapping per format. If #610 lands first, I will merge main into our two branches and remove their redundant switch cases while preserving the tests. If #562 or #587 lands first, please keep the corresponding case from main just once in each switch when updating #610. This only affects those four labels; the other format mappings and the BC edge work are independent. Verified together on RTX 5080 (driver 616.92, validation on): I applied only the two PRs' test-file diffs to a detached checkout of #617 adds the same B5G5R5A1 resource and size mappings on top of #562, with a sampled-alpha oracle. The coordination note on #617 covers that third format and the updated descriptor slots on main. |
|
A note on overlap: three open PRs add some of the same format-table entries as this one.
The Vulkan formats are the same in every case: AI-assisted (Claude Code). |
# Conflicts: # docs/d3d12_vulkan.md # runtime/shims/d3d12_vulkan_device.cpp # runtime/src/vulkan_replay.h
|
I've merged the current With it, AI-assisted (Claude Code). |
|
Tested df0cc48 on NVIDIA GeForce RTX 3060, driver 617.14, Windows 11: pass Setup: Windows 11 Pro 24H2 (10.0.26100), RTX 3060 (Ampere), NVIDIA 617.14, MSVC 14.44.35207 + Windows SDK 10.0.26100, Ninja RelWithDebInfo, Khronos Vulkan-Headers 1.4.369, VK_LAYER_KHRONOS_validation 1.4.357. PR head built as-is (not rebased; it conflicts with main c432cdc now). Build: 0 errors, 0 warnings. ctest: 24/24, also with LEONIDA_VK_VALIDATION=1. AI-assisted: the build and test runs were done with an AI coding assistant (Claude Code) on my machine; the numbers above are its unedited output. |
|
Tested 4c5ce1a on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass
No game files used. AI-assisted run (Claude Code). |
…n now has ItsNotRexed#562/ItsNotRexed#587 landed the same R9G9B9E5_SHAREDEXP and B5G6R5_UNORM mappings this branch adds. The textual merge was clean but left duplicate case labels (MSVC C2196) in texture_format and the block-size table; keep one of each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I've merged After the merge it builds with MSVC 17.14, and AI-assisted (Claude Code). |
|
This PR's content landed on AI-assisted (Claude Code). |
The layer stores D24 as D32_SFLOAT_S8_UINT where the GPU has no D24 (the Radeon 880M, AMD generally). Footprint copies of the depth plane now convert through a compute pass: an upload turns the 24-bit words into the nearest floats of d / 16777215, a readback quantises floats back (float multiply by 16777215, round to nearest even, as WARP and AMD's D3D12 driver do) and writes 0 in the unspecified top byte. Clears store the float of the quantised value, so a texture reads back as D3D's quantisation of the clear value. - src/depth24.h, vulkan_depth24.h, depth24_convert.comp (+ compiled SPIR-V): reference conversion, the converter (pipeline, scratch, descriptors freed once the submission completes) and the shader. - vulkan_replay.h: depth24_as_float binding flag, convert jobs prepared with the list and run around the copy, depth clear value. - depth24_convert_test: all 16777216 words to float and back, 16777216 float patterns against the reference, a pitched copy; d3d12_depth24_compare.h: 5215 clear values (whole-view and rectangle) against the host. - d3d12_copy_compare.h: the D24 case now compares upload and readback with the host instead of only the bit-preserving copies. Depends on #610. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What and why
D3D-46, claimed in #313. This compares copies against the host runtime, the method #313 asks for. The same scenario runs on the layer and on a host D3D12 device, and the bytes read back are compared.
LEONIDA_HOST_ADAPTERpicks the host adapter: a GPU name or WARP. A name that matches nothing fails the run instead of silently skipping.runtime/test/d3d12_copy_compare.h, run fromd3d12_vulkan_device_test, covers 69 cases:CopyResource, plusCopyBufferRegionwith offsets.CopyTextureRegiontexture to texture: whole subresources, boxes and destination offsets, array slices, mips and 3D.ClosewithE_INVALIDARG, the layer at execution.Every partial copy from an uploaded resource is ordered after the upload by a
COPY_DEST → COPY_SOURCEround trip.Layer fixes the comparison found:
R8G8_SNORM,R16_UNORM,R32G32_UINT,R9G9B9E5_SHAREDEXP,B5G6R5_UNORMandB5G5R5A1_UNORM. The packed 16-bit ones map toR5G6B5_UNORM_PACK16andA1R5G5B5_UNORM_PACK16; the comment in the table explains the naming.invalid_copy. Invulkan_replay.hthe box is now rounded to whole blocks and must fit the destination's padded mip. The extent is cut only where it reaches an image's edge, and it must be a block multiple or end at the edge of each image separately, which is the Vulkan rule. That keepsvkCmdCopyImagevalid: there are no VUIDs under validation.Known differences, printed by the test and listed in
docs/d3d12_vulkan.md:TEXTURE1D.CopyResource, boxes, slices). Upload and readback stay unverified.vkCmdCopyImagecan't: a 6×6 mip into a larger mip, or a 4×4 box into a 3×3 mip. These stayinvalid_copyuntil a staging copy through a buffer is added.Tested
Windows 11, MSVC 17.14 RelWithDebInfo,
LEONIDA_VK_VALIDATION=1. Vulkan side on an AMD Radeon 880M (AMD 26.11.2) and an NVIDIA RTX 5070 Laptop (617.42). Host side on the NVIDIA GPU, the AMD GPU and WARP.ctest: 24/24 with the NVIDIA host, on both Vulkan GPUs.d3d12_vulkan_device_teststill exits 1 because of the existingGetResourceTilingcomparison (24 diffs). It does the same onmain.An independent review led to:
A test-side fix: the cross-mip cases share one queue per side, since a queue per case made the NVIDIA D3D12 host hang now and then.
AI-assisted (Claude Code).
Checklist
docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code