Repository navigation
feat(shader): load R10_G10_B10_A2 float images through a 32-bit view - #17701
Conversation
Image format 131 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, which Vulkan has no format for. Keep it in an R32_UINT image and decode the texel in the shader on an image_load that uses no sampler. Stores, packed accesses, atomics, samples, gathers, LOD queries and the 0001, 1110 and 1111 DCC fast-clear codes are refused. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Windows CPU check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2.0 UCRT r7, Release, with Vulkan hidden.
The 44 passing testsagc_address_copy_cap, agc_address_copy_cap_mirror, agc_address_copy_cap_remembered, agc_address_space_unwatched_mirror_import, agc_command_batch_fence_failure, agc_compute_descriptor_layout_flags, agc_copy_input_kept_bytes, agc_depth_copy_kept_bytes, agc_descriptor_cache, agc_descriptor_pool_reset_failure, agc_driver_address_space_teardown, agc_driver_alpha_to_coverage_state, agc_driver_covered_centroid_state, agc_driver_depth_bounds_state, agc_driver_fault_only_template_records, agc_driver_fault_only_template_records_kept, agc_driver_fault_only_template_records_loop_guard, agc_driver_fault_only_template_records_loop_guard_kept, agc_driver_linear_volume_nonresident, agc_driver_msaa_dcc_state, agc_driver_sample_location_grid_fallback, agc_driver_sample_order_planning, agc_driver_undithered_alpha_to_coverage_state, agc_driver_unobserved_provoking_vertex, agc_driver_unused_viewport_depth, agc_graphics_profile_draw, agc_heap_mirror_reference_size, agc_heap_mirror_run_unwatch, agc_heap_mirror_run_unwatch_no_space_cache, agc_heap_mirror_unwatch, agc_heap_mirror_unwatch_no_space_cache, agc_pipeline_journal, agc_pipeline_journal_extended_paths, agc_pipeline_journal_long_paths, agc_pipeline_library_clear_waits_for_build, agc_pipeline_store_fixed_bound, agc_pipeline_store_growth, agc_pipeline_store_lazy_buffer_pool, agc_pipeline_store_replay_growth, agc_pipeline_store_touch, agc_sparse_buffer_holes, agc_sparse_heap_mirror_budget, agc_sparse_heap_mirror_unwatch, agc_sparse_heap_mirror_unwatch_no_space_cache AI-assisted: yes. |
|
GPU follow-up for head Setup: Windows 11 Enterprise 22621, AMD Radeon RX 6700 XT (driver 32.0.21045.16010), WinLibs GCC 15.2 UCRT, Release,
All test and AI-assisted: yes. |
|
Ran this PR merged onto
Failures
|
|
Windows check of head Setup: Windows 11 x64, WinLibs GCC 15.2.0 (r7), Ninja, Release,
AI-assisted: yes. |
…at-131 # Conflicts: # core/libs/prx/libSceAgcDriver/Graphics/src/TextureFormat.cpp # core/libs/prx/libSceAgcDriver/tests/TextureFormat.cpp # core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp # core/shader/recompiler/RdnaDecoder/src/RdnaDescriptorFormat.cpp # docs/dev/debt/shader.md
|
I merged I ran this on macOS (AppleClang, Release): |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
NVIDIA Linux run with the Khronos validation layer of the head after the merge with #15450; the earlier GPU runs were on Setup: Arch Linux, kernel 7.3.4, GCC 16.2.1 Release, NVIDIA GeForce RTX 4090 (10de:2684), driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head
No new AI-assisted: yes (Claude Code) |
MarcZX10
left a comment
There was a problem hiding this comment.
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 f3ef4514e80aa6cc4c68f8f90a068e500b0b3fea using the prepared diff and repo_read.py source reads. No commands or tests were run; the test results in the description are author-reported.
Results
| Check | Result | Note |
|---|---|---|
| Diff and implementation review | passed | All changed files read |
| Automated checks | not run | Results in description are author-reported |
| PS5 hardware behavior | not run | No title was run |
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.
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 120onmainat c3112f0 (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.agc_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