mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:25:53 +01:00
[PR #517] [MERGED] d3d12: B4G4R4A4 render targets are RGBA8 images where no 4444 format is a colour attachment (RT-4444-TARGET) #566
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#566
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/517
Author: @VibeClauding
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:cont-4444-target📝 Commits (1)
28052acd3d12: B4G4R4A4 render targets are RGBA8 images where no 4444 format is a colour attachment (RT-4444-TARGET)📊 Changes
3 files changed (+262 additions, -1 deletions)
View changed files
📝
runtime/CMakeLists.txt(+7 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+29 -1)➕
runtime/test/d3d12_b4g4r4a4_target_test.cpp(+226 -0)📄 Description
Claimed in #14 as
RT-4444-TARGET.What and why
DXGI_FORMAT_B4G4R4A4_UNORMmaps toVK_FORMAT_A4R4G4B4_UNORM_PACK16, which NVIDIA does not offer as a colour attachment, and neither areR4G4B4A4/B4G4R4A4(all sampled only; RTX 3070, driver 610.88,vulkaninfo --show-formats). So a B4G4R4A4 texture withALLOW_RENDER_TARGETwas refused:GetResourceAllocationInfoansweredUINT64_MAXand creation failed. The retail title asks for one during boot and asserts on the answer (seen on a forge-based branch on Windows; this is the same fix ontomain).Now, only where no 4444 format renders:
DeviceState's texture format choice, next to the B5G5R5A1 and sRGB UAV cases). Every 4-bit value is exact in 8 bits.RTVFormatsentry getR8G8B8A8_UNORMas the attachment format.4_4_4_4(136), as the console's do.bind_imageviews a 4444 T# on an RGBA8 image as RGBA8 withA4R4G4B4's channels (the lookup would otherwise pickA4B4G4R4by channel order, a 16-bit view of a 32-bit image, which Vulkan validation rejects).Not covered, and said in the code:
CopyTextureRegionbetween such a texture and a buffer footprint moves 4-byte RGBA8 texels, not packed 16-bit ones. Replay's footprint bounds checks still hold, so nothing is written outside the buffer. Converting would need the footprint's format inCopyLocation, which is not recorded today.Tests
d3d12_b4g4r4a4_target(modelled ond3d12_b5g5r5a1_uav, exits 77 where A4R4G4B4 renders): a size and a committed resource for a 1920x1080 target; whole and rectangle RTV clears with 4-bit-exact colours read back as RGBA8; the SRV T# format is 4_4_4_4; a non-render-target B4G4R4A4 texture still gets a size. Passes on RTX 3070 withLEONIDA_VK_VALIDATION=1, 0 validation errors.ctest(Windows 11, MSVC, RTX 3070): 302/304.d3d12_execute_indirect_validationfails the same way on unchangedmainhere;xmemfailed once under-j 4and passes alone (3 of 3).scripts/check_no_game_data.pyon the changed files: clean.AI-assisted (Claude Code); built and tested on the machine above.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.