Skip to content

Runtime: sample RGB9E5 shared-exponent textures (D3D-61) - #562

Merged
ItsNotRexed merged 3 commits into
ItsNotRexed:mainfrom
Vonsek:codex/rgb9e5-texture
Nov 22, 2026
Merged

ItsNotRexed merged 3 commits into
ItsNotRexed:mainfrom
Vonsek:codex/rgb9e5-texture

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as D3D-61, RGB9E5 portion.

What and why

CreateCommittedResource refused DXGI_FORMAT_R9G9B9E5_SHAREDEXP even though the GFX10 descriptor table already supports its shader view. Map it to VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 and use a four-byte texel for footprints and buffer-image copies. The other D3D-61 formats remain available.

Tested

Windows 11, GeForce RTX 5080, driver 616.92, Vulkan validation enabled. Before the change the new synthetic test exited 1 at packed resource creation on ee97b84.

  • d3d12_descriptor_test uploaded and sampled an 8×8 packed texture through the runtime's D3D12 copy queue and shader-visible SRV. The existing fixture dispatches its compute shader in Vulkan with the runtime's bindless set. All 64 texels matched four independently specified RGBA8 colors, including default alpha 255. Varying just the shared exponent gave (16,32,64), (32,64,128) and (64,128,255). A local control exchanging the uploaded red and blue mantissas failed at texel 0 with (64,32,16,255) versus (16,32,64,255).
  • d3d12_vulkan_device_test matched host D3D12 copy footprints for a 13×7 two-layer texture with four mips at base offsets 0 and 1024.
  • ctest --test-dir build-review/runtime -R "^gfx10_descriptors$" --no-tests=error --output-on-failure and python -I tests/test_gfx10_descriptors.py passed.

AI-assisted with OpenAI Codex.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (N/A, runtime format mapping.)

Map the shared-exponent format through resource creation and buffer-image copies so shaders can resolve its existing GFX10 view. Check the sampled channels and compare the mip-array footprints with the host runtime.
@Vonsek

Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

CI on 3973ce8 finished. The Windows runtime build passed. I compared each failed check with the run on the unmodified base ee97b84:

  • llvmpipe reports the same output words for cs_w32_lane_wrap and cs_wqm_w32 on both commits. Base runtime run
  • Both revisions fail the seeded v_ashrrev_i64 semantic test with the same input, and the s_load test with expected 0x7f8295f4, observed 0x7fc295f4. The matrix cancelled the other semantic runner after the first failed. Base CI run

@Vonsek

Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Merged 22590c7 and reran the format test on RTX 5080 with Vulkan validation. With the same new test object linked against unmodified main, resource creation still fails. On b3edaf3 it succeeds. The packed texture's 64 sampled texels and the D3D12 footprint comparison passed.

Eight of nine CI jobs passed, including Windows runtime and both semantic suites. The only failing job, llvmpipe, returns the same words for cs_w32_lane_wrap and cs_wqm_w32 as on the unmodified base. Separately, the newly merged local d3d12_clear_test reports format 28, case 0, byte 2: Vulkan 7f, WARP 80. I reproduced that result on unmodified 22590c7.

# Conflicts:
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/vulkan_replay.h
#	runtime/test/d3d12_descriptor_test.cpp
@oVolkra

oVolkra commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested b3edaf3 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.
d3d12_descriptor_test (glslangValidator 16.6.0 found, so the bindless compute sample ran): exit 0, "64 RGBA8 and RGB9E5 texels matched".
With LEONIDA_VK_VALIDATION=1: 0 messages from the validation layer (see below).
About the LEONIDA_VK_VALIDATION=1 exit code: on this machine the test prints "3 validation errors" and exits 1 on main c432cdc too. All three are Vulkan loader messages ("loader_get_json: Failed to open JSON file") for stale implicit-layer registry entries of uninstalled overlays, not messages from the validation layer. The validation layer itself reported 0 messages, the same as on main.

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.

@Vonsek

Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for confirming the 64-texel readback on Ampere and for identifying the loader messages separately. b3edaf3 was the earlier head. The current head f5f4cb0 incorporates c432cdc and passes all nine checks. The updated descriptor test also exercises the packed texture alongside the new border-colour cases.

@troythedecoyx

Copy link
Copy Markdown
Contributor

Tested f5f4cb0 merged onto main c432cdc on NVIDIA GeForce RTX 4060 Ti (Ada), driver 32.0.16.2124 (NVIDIA 621.24), Windows 11 Home 26300, MSVC 2022 / Ninja, Vulkan SDK 1.4.363: pass.

Besides ctest, I ran each test program this PR changes directly (several aren't registered with ctest):

  • d3d12_descriptor_test: exit 0
  • d3d12_vulkan_device_test: exit 0

ctest: 100% tests passed, 0 tests failed out of 27.

AI-assisted.

@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested f5f4cb0 on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass

No game files used. AI-assisted run (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit ef3e774 into ItsNotRexed:main Nov 22, 2026
9 checks passed
AlxcBTW added a commit to AlxcBTW/Leonida that referenced this pull request Nov 22, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants