fix(shader): fold texel offsets into base-level unnormalized samples #7240
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7240"
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 gjonn on 2026-10-17T18:48:40Z.
What
An implicit-LOD or gradient sample with a texel offset through an unnormalized S# was refused at bind time with
unnormalized guest sampler is used by an implicit-LOD sample, which is not implemented.On PPSA01317 a pixel shader
image_sample_o(implicit LOD with an offset) through an unnormalized point S# hits this on boot and the title aborts with that message; with this change it gets past it onmain.The base-level path (
SamplesBaseLevelIfUnnormalized) already samples such a sampler throughOpImageSampleExplicitLodwith LOD 0, which Vulkan allows for unnormalized samplers, but it did not accept samplers whose uses include offsets because that branch dropped the offset. The branch now adds the offset to the coordinates (FoldedOffsetCoord, as the explicit-LOD offset fold does), andSamplerUseOffsetis accepted bySamplesBaseLevelIfUnnormalized. A normalized S# keeps the implicit-LOD sample with its offset operand.The new cases in
verifyUnnormalizedSamplers(agc_shader_memory) recompile a pixelimage_sample_othrough an unnormalized S#, check the offset is folded into the base-level coordinates, and check that the normalized variant stays an implicit-LOD sample with an offset operand. Onmainthe test fails with the bind-time refusal above; it passes with the change.Tested
Windows 11, MinGW GCC Release build with
BUILD_TESTING=ON.agc_shader_memoryfails onmain(with only the test applied) withunnormalized guest sampler is used by an implicit-LOD sampleand passes with the change.agc_shader_memory_tests,agc_shader_device_profile_testsandagc_driver_graphics_tests(22 tests), plusagc_driver_image_sample_unnormalized(Vulkan execution) andagc_shader_disk_cache, pass.python tools/check_conventions.py --base origin/mainpasses;tools/check_test_registration.pyreports no unregistered tests.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T19:08:06Z.
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.
core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppImported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-17T20:05:52Z.
Independent hardware run, head
7c19c66def, Windows 11, MinGW (WinLibs GCC 15.2.0), Release:agc_shader_memory,agc_shader_device_profile,agc_shader_disk_cache,agc_driver_graphics,agc_driver_image_sample_unnormalizedall pass on NVIDIA RTX 3070 (driver 617.42); the two driver tests also pass on Intel UHD 630 (ANYPS5_GPU=UHD, igvk64).Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-18T04:15:17Z.
RTX 4090 data point on PPSA01317, continuing the chain from my #7243 and #7238 runs tonight, where the title stopped on
unnormalized guest sampler is used by an implicit-LOD sample. Short version: with this PR on top of that stack the bind-time refusal is gone on this GPU too, 3 of 3 runs, the title registers about 390 more shaders and goes into its cube map pass, and the next stop is the layered-draw refusal that #7254 describes for exactly this pass.Setup. Gran Turismo 7 PPSA01317 01.000.001 (base package), Windows 11 (26200), RTX 4090 (NVIDIA 616.92), AMD Ryzen 7 5800X, MinGW-w64 GCC 15.2.0 r7 (UCRT), Release
libstarget only (no tests built).app.exeis the relink frommain31cbb55d7(--windows --registry --module-dir .); onlylibs/is swapped between runs. Tree:maine1041f6a5+ #71372aa6bfca6+ #7207 ec28b6be8 + #7175 555b7e824 + #5958 87a9b8d28 + #7243da158d61f+ #72384aaf27699(1be778eea, the set that stopped on the sampler refusal) + #72407c19c66decherry-picked (clean, ac5e28d17;SpirvImageEmitter.cppand theResources.hppdependents rebuilt). ThelibSceSsl.prxis the one from #7319 (1f267559e), because the title callssceSslConnectafter its save-data mount and the stock export throws there. Currentmainis not usable as the base for this title since #7323 (sceHmd2ReprojectionQueryBufferSizeAlign not implemented5 s in, see the #7243 comment). No controller, no input, nobody at the keyboard; one-shot interactive task per run, 600 s cap, box otherwise idle.Result. Run 1 recompiled the shader cache (1,785 shaders, 793 MiB; the recompiler source changed), runs 2 and 3 were warm. All three get past the sampler refusal: splash, then the black loading screen with the GT spinner (title-bar counter 48 to 60 FPS, 789 frames by the last capture of run 3), save data mounted, three
sceNetResolverStartNtoa -> host DNS lookup failed, then 388 further shaders registered (all from the cache in the warm runs), and then, identically every time:That is the
State.cpprefusal of a layered draw into aCB_COLOR_VIEWof several slices, which #7254 lifts for the 512x512 cube map pass of this title (and #7256 then handles its depth side), so #7254 + #7256 are the next two to stack here. Nothing else new appears in between: nopartial writes, nocolor export formatrefusal, no device loss, and the stall I saw once on the first #7238 run did not recur (three runs, one of them cold).shader 0x1258d04700 stage 5: ... unnormalized guest sampler is used by an implicit-LOD samplelayered draws into a color view of several array slices are unsupportedstderr of run 3 (warm, box idle) from the second 10 s summary to the abort, the 388 per-shader
ShaderRegistrylines removedAI-assisted: yes (Claude Code)