feat(shader): load R10_G10_B10_A2 float images through a 32-bit view #17701
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17701"
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?
Imported from boykopovar/AnyPS5. Originally posted by SHOnnay on 2026-11-09T10:53:38Z.
What
Guest image format 131 (
Format10_10_10_2Float) packs R, G and B as unsigned floats with a 4-bit exponent (bias 7) and a 6-bit mantissa, and A as a 2-bit UNORM. Vulkan has no format for it, so a T# using it made the draw or dispatch fail with theNumericClassreason, and the driver threwunsupported guest texture format 131.The format is now held in an
R32_UINTimage like the other packed formats without a host equivalent, and animage_loadthat uses no sampler decodes it in the shader. R, G and B follow the layout in the shader debt entry (bits 0-9, 10-19 and 20-29, denormal at exponent 0, finite at exponent 15, 0x3ff reads 508); A is bits 30-31 as UNORM. The layout was measured withimage_loadon RDNA2 (gfx1036) through the hardware oracle, not on the PS5's gfx1013.Refused with an error, as before or newly: a write, a packed MIMG access, an atomic, a sample, a gather, a LOD query, and DCC fast-clear codes 0001, 1110 and 1111 (a raw R32_UINT fill would not read as white in this layout). A runtime image mode for the format is generated only for images that are not written.
The shader debt entry for format 131 now lists only what is still open: the value of a denormal (decoded as the mantissa times 2^-12, which is the format's defined math, not a measured hardware result), the rounding of the 2-bit alpha (within 1 ULP of alpha/3), and the alpha of a D16 load.
Tests:
agc_driver_image_format_131loads 2048 texels that cover every 10-bit value in each of R, G and B, with swizzles X Y Z W, W Z Y X and X 0 1 W, and compares R, G and B bit-exactly with values computed from the documented layout in the test (not by calling the decoder); alpha is compared within 1 ULP for 1/3 and 2/3 and exactly for 0 and 1. It also loads with D16 on X Y Z 1, and checks thatimage_store,image_sample_lz,image_gather4,image_get_lod,image_load_pckandimage_atomic_addof the format are refused. The atomic refusal predates this change (the existing 32-bit-only atomic format check) and is pinned, not new.agc_driver_graphicsgains assertions for the driver remap, the numeric class and the DCC clear refusals. Both fail onmain(unsupported guest texture format 131;sampled image descriptor uses an unsupported format) and pass here.Evidence level: unit test bit-exact (decode, executed on a GPU through the recompiler); SPIR-V from
Recompileis validated by SPIRV-Tools in a build withANYPS5_ENABLE_SPIRV_TOOLS=ON. No title was run.Tested
Windows 11, MinGW-w64 GCC 15.2 (UCRT, SEH), Release,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON, NVIDIA GeForce RTX 4070, driver 621.01, Vulkan 1.4.357. The GCC 15.2 runtime directory was first onPATHfor the test session.ctest --timeout 120onmainatc3112f0c0f(this change's files reverted tomain): 4803 tests, 4801 passed, 2 failed:windows_integer_overflow_report(Timeout) andguest_timed_join_import_libkernel_web(libkernel_web.prxcould not be loaded, GetLastError 126).ctest --timeout 120on this branch (same base): 4804 tests, 4802 passed, the same 2 failed. The 1 extra test isagc_driver_image_format_131.ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(agc_driver_graphics,agc_driver_image_packed16_storage_*,agc_driver_image_depth24*, plusagc_driver_image_format_131here): neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither containsVUID-. These were run on an earlier base, before the final rebase.c0d23c29c1: rebuilt, and the 1181 ctest tests matchingagc_driver|shader|recompiler|spirv|rdnaran with the validation layer: 0 failed, 0VUID-, 0was not found but was requested; 10 skipped by the tests themselves (missing Vulkan features). Full suite not re-run on this base.python tools/check_conventions.py --base upstream/main: all checks passed.tools/pr_overlap.pyfailed closed (could not confirm overlap with a list of open PRs that share files); compared by hand, no open PR decodes format 131.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Format6E4Float; I will rebase whichever merges second)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T15:57:41Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the targeted implementation and regression coverage support the stated load-only behavior, though I did not run checks myself.
What I ran
Reviewed head
f3ef4514e80aa6cc4c68f8f90a068e500b0b3feausing the prepared diff andrepo_read.pysource reads. No commands or tests were run; the test results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No automated checks were run during this review. The PR description reports focused test success on the final rebase and full-suite results on an earlier base; these were not independently verified. No title or PS5 gfx1013 behavior was tested. Read all 11 changed files listed in
manifest.json, including every added line. No changed files were excluded.To get this to a good state
Nothing is required.