feat(agc): accept texel offsets with unnormalized sampler coordinates #822
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/822"
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 Celegans12 on 2026-10-06T07:16:39Z.
What
An
image_sample_*_othrough an S# withFORCE_UNNORMALIZEDthrows inPrepare: Vulkan forbids offset operands with unnormalized coordinates.For supported explicit-LOD samples, the registered artifact adds signed texel offsets to f32 coordinates with
OpFAdd/NoContraction, selected from the S# bit. Normalized sampling retains native offsets. Without maintenance8, nonconstant offsets require the folded form; normalized samplers throw.Offset folding excludes gathers, comparison, derivatives, implicit LOD and
_a. Preserve #1417's direct constant-selector modes, including 3D; ordinary selectors cannot match them, and indirect images remain rejected. The rebase retains main'sflatVolumeCompatibleandflatLineCompatiblebesidefoldTexelOffsetsOnly, with matching codec fields and fixtures. Disk format is 34; main's runtime ABI 11 and request 15 remain unchanged.PPSA26344's compute shader 0x8000265d00 uses
image_sample_lz_o. adriadam10 measured 3840 bit-identical offset-versus-coordinate-shift cells on RDNA2 gfx1035 with point/linear filtering and clamp edge cases.Tested
Exact source
93d9b5dd, based onmain57f96fd2: Windows 11 / MinGW-w64 GCC 15.2.0 / NVIDIA and Linux / GCC 13.3 / lavapipe, SPIRV-Tools ON. Focused builds, patched libraries and registration passed. Both platforms passed 4/4 CTests with zero failures or whole-case skips; raw targeted skip checks pass.Cases:
agc_driver,agc_shader_memory,agc_shader_disk_cache,agc_driver_image_sample_unnormalized.Default Recorder also passed on both platforms, including main's swept-buffer staging and image memoization cases. It omitted watched-import refresh, draw-snapshot reuse, unit-shadow and snapshot-patching cases on Windows; Linux also omitted other write-watch cases and the unavailable minimum-LOD extension. These are internal omissions, not passing coverage.
Historical full suites at published
14399efb(mainc72d5ce1): Windows 570 passed/2 skipped/1 unexplainedvideo_out_flip_lifetimeheap-corruption failure (0xc0000374); unchanged-binary retry 570/3/0. The strict skip gate failed; both VideoOut cases passed native SDL, third skip used a missing ICD. Linux 558/29/0; raw skip checker rejected WSL asynchronous-userfaultfd write tracking, accepted locally, not an upstream pass. Both independent constant-mode controls failed as expected and restored shader-memory passed on that earlier head.Not rerun on this rebase: full suites, earlier constant-mode negative controls, PPSA26344 or console behaviour. Linux uses memory comparisons when write protection is unavailable.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T07:32:15Z.
Checked the last commit:
main); the execution test fails onmainwith the texel-offset refusal, as it should.image_sample_lz_othrough aFORCE_UNNORMALIZEDS# againstimage_sample_lzat (u + Δu, v + Δv), point and linear, last-texel and border clamp, offsets -32..31, coordinates outside the image and off the 1/256 grid: 3840 cells, all bit-identical. The offset is applied before clamping, so folding it into the coordinate is exact. The TechnicalDebt line can say it was measured on RDNA2 instead of "unmeasured".@boykopovar @oneandonlydean one design question before merging: this adds
foldTexelOffsetstoResourceSpecialization, i.e. a new compile-time variant chosen from an S# bit (and a new disk-cache key field). #639 replaces resource specialization with runtime descriptors and samplers are still pending there. Is it fine to land this now and let #639 absorb it, or should offset folding wait for the sampler side of #639? Otherwise it's ready from our side.Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-07T07:38:14Z.
Thanks for measuring it. 3840 bit-identical cells on gfx1035 is much better evidence than I had. I'll change the TechnicalDebt line to say the folding was measured on RDNA2 (offset applied before the clamp) and push it together with the rebase onto
main, now that #799 is in, so the branch drops #799's commit.The ResourceSpecialization question is the owner's call. If #639 should absorb it, I'm happy to hold this one or port the fold into #639's sampler path when that lands.
Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T14:56:22Z.
A title that needs this: Ghost of Yōtei (PPSA26344 v01.008.000, retail). Linux, RX 9070 XT, Mesa 26.2.4 RADV.
On current
mainthe title stops earlier, on an image descriptor read from a buffer (see #759). With #759 applied (older base,main6b573862+ #759 c838c167), the run stops here:That is the message this PR replaces. I couldn't run both together: #759 and this PR merged on current
maingive 8 recompiler conflicts. So I have no in-game result with this PR yet, only that it is the next blocker for this title.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-08T15:11:47Z.
Thanks for running Yotei on the 9070 XT. Seeing #759 stop on the texel-offset error in the compute shader 0x8000265d00 on RADV is really useful, because it confirms that #822 is the next stop after #759 on AMD as well.
The conflicts come from both PRs editing the same sampler and specialization structs, the disk cache encoder and the sample emitter, and from both moving the cache format from 9 to 10. I've pushed the merge of the two current heads (#759 at 6fb7f68e, #822 at d84d4ce7, both on main
b3fcd6d6) to https://github.com/Celegans12/AnyPS5/tree/test/yotei-759-822. Both behaviours are kept, and the cache format goes to 11 because the two encodings differ. Upstream's Linux job passes on it with lavapipe (464/464), and the image table, null pointer, unnormalized sampler and disk cache tests also pass on Windows.I haven't run that exact branch in the game, so I can't tell you where it stops next. In our integration branch, which has these two plus a lot of other open PRs, Yotei compiles that shader and gets into the opening cinematic, though only at a few frames a minute.
If you get a chance to run it on RADV, I'd like to know where it stops.
Details
tests/ShaderDiskCache.cpp,IrMetadata/Resources.hpp,ResourceMaterializer.hpp/.cpp,ShaderDiskCache.cppandSpirvImageEmitter.cpp.SamplerResourcekeepsfoldTexelOffsetsbeforetableView(20 bytes),ResourceSpecializationcarriestableViewClasses,srtPoisonandfoldTexelOffsets(128 bytes), the info encoder/decoder andBuildKeywrite both sides' fields, andSampleValuefolds the offset into the coordinate beforeAccessSampledImage.FormatVersionis 11.guest_audio_in_captureaborted once in the parallel pass and passed when rerun serially, the way the job runs it.agc_shader_disk_cache,agc_shader_memory,agc_driver_image_table,agc_driver_image_table_cache,agc_driver_guarded_null_pointer,agc_driver_image_sample_unnormalizedandagc_driver_graphicspass on an RTX 3080 Laptop and on lavapipe (Mesa 26.2.4).Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T20:07:42Z.
Ran
test/yotei-759-822(477f2b3e) in the game: Ghost of Yōtei PPSA26344 v01.008.000, Linux, RX 9070 XT, Mesa 26.2.4 RADV, headless, 240 s.Both earlier stops are gone. Neither 0x80003aa700 nor 0x8000265d00 fails. It stops before the first present, after 95 resource builds, on a buffer descriptor this time:
The V# is read from a buffer at an offset that a loop counter scales (
IMul32(Phi(...), Immediate)). That looks like the runtime-selected V# case. #1183 extends that path, but I haven't tried it, so I can't say whether it covers this one. No amdgpu faults in the kernel log.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T20:09:31Z.
I tested #1183 on top of
test/yotei-759-822(477f2b3e +a8dda42c, clean merge). There is no change: same stop on compute shader 0x8000289300, sameGetBufferResource dword 0 is not a valid runtime value, after the same 95 builds.In the chain, the offset is a scalar loop counter (
Phi(Immediate, IAdd32(Phi, Immediate))times an immediate), not a per-lane value. So this looks like a V# read at an offset that changes per loop iteration, rather than the waterfall case #1183 extends.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-08T20:14:32Z.
Thanks for running it, and for trying #1183 on top. We hit the same 0x8000289300 stop in our runs: with our probe tolerance on, it shows up as skipped dispatches instead of ending the run, so we hadn't looked at it closely yet. Your read of the chain matches what I'd expect: a scalar loop over V#s, not the waterfall case. It's on our list next.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T08:06:07Z.
#2133 added
flatVolumeCompatiblenext to yourfoldTexelOffsetsOnly, so this conflicts inResources.hpp,ShaderDiskCache.cpp/.hppandtests/ShaderDiskCache.cpp. Please rebase, keep both fields and take the next freeFormatVersion. It tested fine at 14399efb, so it can go in after that.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T01:08:30Z.
#2920 landed and this conflicts with it in
ResourceMaterializer.cpp; please rebase, keeping #2920's message and yourfoldTexelOffsetsOnlythrow before it.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:19:37Z.
Rebased onto current
main(two mechanical conflicts):ResourceMaterializer.cpp: thefoldTexelOffsetsOnlythrow sits before #2920's detailed message, as asked.ShaderDiskCache.hpp:FormatVersion25 -> 26, the next free one.Checked on the rebased tree: build + ctest 388/388 (libSceAgc, libSceAgcDriver); the three PR tests no longer compile without the change; the offset-vs-coordinate-shift fold was measured bit-identical on RDNA2 (3840 cells). Merging once CI is green.