fix(agc): sample formats that FORCE_DEGAMMA leaves unchanged without it #8069
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8069"
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 thuanquang on 2026-10-19T19:34:42Z.
What
A sampler with FORCE_DEGAMMA (S# word 0 bit 20) makes
mainrefuse every texture that is not sRGB and has no sRGB view, for example a 32-bit float texture:On an RX 6700 XT the bit changes only 8-bit-per-channel formats. I measured it through the hardware oracle's HIP path (scripts and tables): a 64x1 linear texture, each lane reads its own texel at its centre (point) and halfway to the next one (bilinear), with two random fills, so 512 component values per format and mode:
8,8_8and8_8_8_8with the bit read bit for bit as8_SRGB,8_8_SRGBand8_8_8_8_SRGB, asmainalready samples them (through an sRGB view);8,8_8and8_8_8_8with the bit read bit for bit as those sRGB formats over the same bytes;16,16_16and16_16_16_16UNORM, SNORM and FLOAT (guest formats 7, 8, 13, 23, 24, 29, 65, 66, 71),32,32_32and32_32_32_32FLOAT (22, 64, 77),10_11_11FLOAT (36),2_10_10_10UNORM (50),5_9_9_9FLOAT (132),5_6_5,1_5_5_5and4_4_4_4UNORM (133, 134, 136), and BC4, BC5 and BC6H, unsigned and signed (175 to 180). The sRGB formats 128 to 130 do too.ForcesDegammaOnnow leaves the formats of the last item to their plain view, as if the bit were clear. SNORM8,8_8and8_8_8_8(they would need an sRGB view of an SNORM image) and formats I did not measure still throw. The FORCE_DEGAMMA debt entry is cut to what is still open.Tested
Windows 11 26200, AMD Radeon RX 6700 XT (gfx1031), driver 32.0.21045.5002, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, onmain585075cb7. The runs useVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Vulkan-ValidationLayersvulkan-sdk-1.4.363.0, built locally),ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andctest -V, with the implicit overlay layers on this PC switched off (VK_LOADER_LAYERS_DISABLE=~implicit~); no log reports the layer as not found.agc_driver_image_sample_force_degammano longer expects guest format 22 (32_FLOAT) to be refused. It now requires a point sample of32_FLOATand of BC4 UNORM through a FORCE_DEGAMMA sampler to equal, bit for bit, the sample without it, and it expects8_8_8_8_SNORM(guest format 57) to be refused instead.agc_driver_graphicschecks the list:IgnoresForcedDegammaholds for 7, 13, 22, 36, 50, 77, 132, 133, 175 and 179, and not for 1, 2, 14, 15, 56, 57, 128, 130, 169, 171, 173 and 181 (8-bit UNORM, SNORM and sRGB formats, and BC1, BC2, BC3 and BC7 UNORM).VUID-errors.Sampler.cppline reverted,agc_driver_image_sample_force_degammafails:a texture of guest format 22, which is not sRGB and has no sRGB view, is sampled through a sampler that forces sRGB decoding, which is not implemented. NoVUID-errors.main8c9161eacwith its own version of both tests: they pass, with noVUID-errors.python tools/check_conventions.py --base origin/mainwith this title and body passes.python tools/pr_overlap.py --branch fix/force-degamma-unchanged-formatslists #6804, which adds a debt entry on the line above the FORCE_DEGAMMA entry, and #7799 (its pushed head no longer touches the debt file); the rest are pull requests that conflict withmainand share only the debt file, plus #5371, which edits the same test file for its R8 and RG8 sRGB fallback.main9127ea36don an NVIDIA RTX 5070 Ti (driver 617.42) and an AMD Radeon iGPU (RDNA2,1002:13c0, AMD proprietary driver 2026.04.17), Windows 11 Home 26300,ANYPS5_REQUIRE_VULKAN=1:agc_driver_image_sample_force_degamma,agc_driver_graphicsand the other related tests, 16 in all, pass on both, and withSampler.cppback tomainagc_driver_image_sample_force_degammafails on both with the message above. On WSL Ubuntu 24.04 with llvmpipe (Mesa 25.2.8), with this and six other PRs merged, 61 of the 62 related tests pass; the other fails on a WSL write-watch limit.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)1002:13c0), AMD proprietary driver 2026.04.17, Windows 11 Home 26300; llvmpipe (Mesa 25.2.8), WSL Ubuntu 24.04🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T19:45:01Z.
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.
docs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/execution/ImageSampleForceDegamma.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Sampler.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Sampler.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/TextureFormat.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Sampler.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-19T23:12:17Z.
NVIDIA and AMD iGPU runs of
eeb1c4f03. The PR's runs were on an RX 6700 XT only.Windows 11 Home 26300, WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON,main9127ea36dwith this head merged. GPUs: RTX 5070 Ti (NVIDIA 617.42) and the AMD Radeon iGPU (RDNA2,1002:13c0, AMD proprietary driver 2026.04.17,ANYPS5_GPU=AMD).ANYPS5_REQUIRE_VULKAN=1,ctest -j4, failures rerun serially (there were none).agc_driver_image_sample_force_degamma,agc_driver_graphics, everyagc_driver_image_sample_*test,texture_format_lookup,agc_driver_srgb8_color_targetand the emulated color compare tests (16 in all) pass on both GPUs.Sampler.cppback tomain,agc_driver_image_sample_force_degammafails on both GPUs witha texture of guest format 22, which is not sRGB and has no sRGB view, is sampled through a sampler that forces sRGB decoding, which is not implemented.IgnoresForcedDegammamatch the formats named in the description inkFormatLookup(for example 22R32_SFLOAT, 36B10G11R11_UFLOAT, 132E5B9G9R9, 175-180 BC4/BC5/BC6H). FORCE_DEGAMMA is bit 20 of S# word 0 in Mesagfx10-rsrc.json.RequireSamerows for32_FLOATand BC4 compare two samples through the same Vulkan view. They show that the refusal is gone. Whether the result matches hardware depends on the gist's RX 6700 XT measurements, which I could not repeat: the oracle needs Linux/dev/kfd.main9127ea36dwith #8078, #8046, #8069, #8070, #7668, #8015 and #8026 merged together: 61 of the 62 related tests pass; the other,agc_driver_depth_compare_copy, fails withthe guest block is not write-watchedafter WSL reportsasynchronous userfaultfd write protection failed, an environment limit.AI-assisted: yes (Claude Code); results above were run on this machine.