Commit Graph
548 Commits
Author SHA1 Message Date
Yunus Shaikh 0b84427db3 Merge main into perf/agc-host-import-aligned-blocks 2026-10-17 22:25:50 -07:00
Dean 66e71b63d1 Merge pull request #5390 from hugodearaujo/feat/agc-sparse-unaligned-import
feat(agc): import shared ranges whose backing offset is not 64 KiB aligned
2026-10-18 18:22:50 +13:00
Yunus Shaikh 543d7cf5eb Merge main into fix/agc-heap-mirror-replan-unwatched 2026-10-17 21:33:59 -07:00
Yunus Shaikh 3e2ff056b6 Merge perf/agc-host-import-aligned-blocks into perf/agc-remember-evicting-refusals 2026-10-17 21:32:44 -07:00
Yunus Shaikh 698491c2d6 Merge perf/agc-host-import-aligned-blocks into perf/agc-host-import-blocks 2026-10-17 21:31:56 -07:00
Yunus Shaikh 399cc69e9f Merge main into perf/agc-host-import-aligned-blocks 2026-10-17 21:29:30 -07:00
Dean 755fecb333 Merge pull request #6678 from EagleBearerYS/perf/agc-async-settle
perf(agc): settle Windows imports under 1 MiB without waiting
2026-10-18 17:22:05 +13:00
Dean bf34e3a009 Merge pull request #7199 from pushkarreddyy/feat/agc-driver-cmask-mipmapped
feat(libSceAgcDriver): support CMASK fast clears on base mip 0 of mipmapped 2D targets
2026-10-18 17:20:25 +13:00
Dean Galvin 57d3e85ca8 Merge main into pr/depth-clear-2 2026-10-18 16:37:09 +13:00
Dean 1e2d9b369b Merge pull request #7346 from thuanquang/fix/depth-bits-32-guest-memory
fix(agc): read a 32-bit depth-bits T# over guest memory through a float view
2026-10-18 16:22:26 +13:00
thuanquangandClaude Opus 5.5 8f03282f5e fix(agc): draw geometry programs with the last provoking vertex
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-18 10:07:02 +07:00
Dean Galvin 70e444582d Merge main into perf/agc-async-settle 2026-10-18 16:04:01 +13:00
Crimson af0af833c1 fix(shader): use 64-bit buffer atomics for device-memory LDS
Compute LDS beyond the device's shared-memory limit lives in a storage
buffer, and its 64-bit atomics took a lock in that buffer. AMD's Windows
driver compiles the lock's acquire and release to s_barrier, which inside
the divergent lock loop pairs with the program's own barriers, so the
device-memory case of agc_driver_lds_lock_budget read half its sum.

With shaderBufferInt64Atomics the device-memory LDS now uses a 64-bit view
of the buffer instead: 64-bit atomics are compare-exchange loops on it and
32-bit atomics stay native, so no lock is taken. Without the feature the
lock is kept. The per-workgroup slice is rounded up to an even dword count
so that the 64-bit view stays aligned.
2026-10-18 05:47:30 +03:00
pushkarreddyy 991df771fc feat(libSceAgcDriver): support CMASK fast clears on base mip 0 of mipmapped 2D targets 2026-10-18 08:06:35 +05:30
Yunus Shaikh 8f6f7d7500 Merge main into fix/agc-sample-location-grid-exact 2026-10-17 19:10:21 -07:00
Yunus Shaikh 2848253fe4 Merge main into fix/recompiler-once-per-pixel-sample-inputs 2026-10-17 19:06:51 -07:00
Mouad-Scriptz-0andClaude Fable 5.1 53212b18ac feat(agc): remap a viewport depth range the device cannot express into the vertex shader
Without VK_EXT_depth_range_unrestricted a viewport depth range outside
[0, 1] threw. Minecraft (PPSA17221) draws its world with scale 1 and
offset 0 in negative-one-to-one clip space, so its depth is the raw z/w
clamped by PA_SC_VPORT_ZMIN/ZMAX. On such a device the vertex shader now
scales clip z so z/w is the console's depth, the pipeline clamps depth at
the console's bounds, and two clip distances restore the near and far
planes that depth clamping removes. Mode, scale and offset travel as
pipeline specialization constants from the draw's vertex stage info, in
both the per-draw and the registration-module path; mesh and tessellation
draws with such a range still throw.

The console's depth clamp bounds are clipped to [0, 1]: exact for a
normalized depth target or none, and reported once for a tested or
written float depth target, where a depth below 0 is stored as 0
(Minecraft clamps its float depth target to [-1, 1]). The shader
validator accepts the remap's two extra clip distances next to the one
a program may already export.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-18 14:27:48 +13:00
Romans Pokrovskis ab52b02381 feat(agc): read individual multisample image samples 2026-10-18 04:25:26 +03:00
thuanquangandClaude Opus 5.5 0563713626 fix(agc): read a 32-bit depth-bits T# over guest memory through a float view
A sampled 32_UINT or 32_SINT T# with a depth swizzle that no live depth
surface matches threw, while the 16-bit case already falls back to guest
memory through an R16_UNORM view. The 32-bit case now reads the guest
bytes through an R32_SFLOAT view, which the shader casts back to the
stored dword.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-18 08:25:21 +07:00
Yunus Shaikh 32f480d361 Merge main into fix/agc-heap-mirror-replan-unwatched
Main registers agc_driver_lds_lock_budget where this branch registers
its heap mirror unwatch tests. Keep both.
2026-10-17 17:59:51 -07:00
Yunus Shaikh 8c6765be71 Merge main into perf/shader-direct-cpu-evaluable-images
Main's #7325 adds verifyChainedTableOffset to the image table tests
where this branch adds its selected-record tests. Keep both, with
main's call after this branch's.
2026-10-17 17:32:11 -07:00
Ondra97 c4e9c431b5 chore: merge main into f64 minmax denormal fix 2026-10-18 02:28:30 +02:00
Yunus Shaikh ddf072e6f3 Merge main into fix/recompiler-once-per-pixel-sample-inputs
Main's EmitSetAttribute debt entry now says the generated rect-list and
barycentric tessellation stages forward the vertex shader's clip array.
It sits next to this branch's PERSP_SAMPLE and pixel position entries,
which main left as they were; keep main's entry and this branch's two.
2026-10-17 17:03:27 -07:00
Yunus Shaikh 8f03535c8f Merge main into perf/agc-async-settle
Main's #7269 keeps the synchronous settle's buffer, memory and fence
per device in ImportSettle, so clearing one device's imports releases
only that device's objects. This branch's settle batches move there
too: each device's ImportSettle holds its batch target, memory and
batches with their fences, so switching devices no longer drops a
device's batch handles, and clearing a device waits for and destroys
only its own batches. The per-import settle state is renamed
pendingSettles to stay clear of main's per-device map, and a submitted
settle records the device whose batch it is in.
2026-10-17 16:36:23 -07:00
Yunus Shaikh 79365acde8 Merge branch 'perf/agc-host-import-aligned-blocks' into perf/agc-remember-evicting-refusals
#6457's branch now carries main's per-device import settles. Its
ImportSettle sits where this branch adds EvictingRefusal; keep both.
2026-10-17 16:31:39 -07:00
Dean bd58561708 Merge pull request #7294 from Amoenus/codex/feat-thick-s4kb-x-main64df
feat(agc): support thick 4 KiB standard XOR volumes
2026-10-18 12:26:42 +13:00
Yunus Shaikh 287dd14bf8 Merge branch 'perf/agc-host-import-aligned-blocks' into perf/agc-host-import-blocks
#6457's branch now carries main's per-device import settles, which this
branch's GuestBufferMemory.cpp conflicted with.
2026-10-17 16:23:57 -07:00
Yunus Shaikh 978ce35ef4 Merge main into perf/agc-host-import-aligned-blocks
Main keeps an import settle's objects per device in ImportSettle, next
to where this branch adds ImportRefusal. Keep both. Main's fallback for
a refused host-write alias returns after this branch's failure records.
2026-10-17 16:22:59 -07:00
Yunus Shaikh 4cb0512329 Merge main into perf/shader-direct-cpu-evaluable-images
Main's #7101 reads a key buffer's words in one call where this branch
names the reason a narrowing is skipped. Keep main's bulk read and
count both of its unmapped-page skips as unmapped.
2026-10-17 15:58:42 -07:00
David cb72777843 docs: record the last provoking vertex on the barycentric tessellation route 2026-10-18 02:46:54 +04:00
Romans Pokrovskis b2d9880700 feat(agc): support thick 4 KiB standard XOR volumes 2026-10-18 01:22:36 +03:00
Romans Pokrovskis cace5dcb61 chore(agc): update sampled MSAA geometry onto current main 2026-10-18 01:00:42 +03:00
Gjon Gojcevic 49b0e805f0 feat(agc): implement 11_11_10 float color targets through 32-bit uint attachments
Color format 7 (COLOR_11_11_10, float) keeps its 10-bit component in the
low bits; with the reversed component order (COMP_SWAP 2) that is blue,
with red in the high 11 bits. Vulkan has no such layout, so the target was
refused at decode.

Render it the way 10_11_11 unorm targets are rendered: an R32_UINT
attachment, the reversed export mapping 0xc6, and a new
ColorExportPacking::Float11_11_10 that makes the pixel shader pack each
export with the format-43 image store conversion (toward zero, overflow to
the largest finite value, negatives to zero, NaN kept). Blending, partial
writes, 16-bit integer exports, DCC and the other component orders throw.

AI-assisted: yes
2026-10-17 17:29:21 -04:00
Dean 8690d92f07 Merge pull request #7071 from SleglJan/fix/storage-budget-pressure
fix(agc): let the storage image cache budget follow the heap's use like the sampled one
2026-10-18 10:29:01 +13:00
Dean e815fb4170 Merge pull request #7251 from thuanquang/fix/rect-list-last-provoking-vertex
fix(agc): draw rect lists in last provoking vertex mode
2026-10-18 10:28:06 +13:00
Dean 8f0e276c61 Merge pull request #6402 from Pipodi/feat/image-table-stores
feat(agc): store to images selected through image tables
2026-10-18 10:22:39 +13:00
Dean ce0d58edbc Merge pull request #7131 from JosepBove/fix/agc-depth-plane-fill
fix(agc): clear the host depth image on a fill of a depth or stencil plane
2026-10-18 10:07:50 +13:00
Dean c3c3dcf157 Merge pull request #7213 from thuanquang/feat/color-565-target
feat(agc): render 5_6_5 UNORM color targets
2026-10-18 10:04:00 +13:00
Dean 88395770b8 Merge pull request #6875 from pushkarreddyy/fix/agc-driver-unclamped-normalized-color
fix(libSceAgcDriver): accept unclamped normalized color target formats
2026-10-18 09:55:51 +13:00
Gjon Gojcevic 571fecaddc feat(agc): sample texture format 43 through a lossless B10G11R11 copy
Texture format 43 holds unsigned floats of 10 bits (R, bit 0), 11 bits
(G, bit 10) and 11 bits (B, bit 21). VK_FORMAT_B10G11R11_UFLOAT_PACK32
holds R11 at bit 0, G11 at bit 11 and B10 at bit 22, so storing the
guest R field in the Vulkan B field and the guest B field in the Vulkan R
field moves every texel without changing a bit of any component. A
sampled texture of format 43 is now uploaded that way (a repack pass over
the detiled words, TextureRepack.comp) and viewed with R and B swapped
back (TextureComponentChannel), so the shader samples it natively: point
and bilinear filtering, every mip level and LOD, and cube faces
work as for any other float texture. A texture whose results a storage
image still holds is copied from that image (vkCmdCopyImageToBuffer, the
repack pass, vkCmdCopyBufferToImage) and copied again whenever the
image changed, like the depth and block copies. The recompiler treats a
sampled format-43 image as a float image without conversion; storage
reads and writes keep the packed R32_UINT path, and a 3D texture whose
results are still in a storage image is flushed and uploaded instead.

PPSA01317 samples a mipmapped format-43 texture at a LOD other than 0
and a format-43 cube map during boot.

AI-assisted: yes
2026-10-17 16:53:37 -04:00
thuanquangandClaude Opus 5.5 f2a4236ab6 fix(agc): draw rect lists in last provoking vertex mode
The generated rect-list control stage gave every corner of a rectangle the
flat inputs of its first vertex, so last mode was refused for rect lists.
BuildRectListShaders now also builds a control stage that takes them from
the rectangle's third vertex when the pixel shader has a flat input, and a
draw in last mode uses it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-18 02:38:26 +07:00
hugodearaujo ef622e2f8f feat(agc): import shared ranges whose backing offset is not 64 KiB aligned
A sparse import binds whole 64 KiB blocks, so a range whose memfd offset
is not a multiple of 64 KiB fell back to one UDMABUF_CREATE and, above
udmabuf's size limit, to copies. The sparse buffer now starts at the
block below the range: HostImport::lead holds that distance, the
import's device address points at the range itself, and every offset
into the import's buffer goes through HostImportOffset.
2026-10-17 15:03:33 -03:00
thuanquangandClaude Opus 5.5 20502c0022 feat(agc): render 5_6_5 UNORM color targets
Goosebumps Terror in Little Creek (PPSA27305) aborts in gameplay with
"unsupported color format 16 number type 0 component swap 2": it renders
into a COLOR_5_6_5 UNORM target. The target now renders into
R5G6B5_UNORM_PACK16. AMD keeps X in bits 0-4 and Z in bits 11-15, and
Mesa's ac_translate_colorswap programs SWAP_STD_REV for a surface with
red in bits 11-15, so with SWAP_STD_REV the exports are written as they
are and with SWAP_STD they are written with X and Z exchanged, as for
1_5_5_5. The alternate swaps and other number types keep throwing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 23:59:26 +07:00
SandstromPLandClaude Opus 5.5 3dadf77121 fix(agc): draw a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE as one sample
With #6014 merged, the first draw of METAL GEAR SOLID: Peace Walker's
(PPSA18216) opening movie stops on "the depth target's sample count
differs from the rasterizer's" (mrfelek on #6196). The state he reported
is a 4x PA_SC_AA_CONFIG, MSAA_ENABLE clear, a one-sample 1440x810 depth
target and no color target; on main alone it throws earlier, on "a depth
target". Like the one-sample color targets of bb877791a, such
a depth target, with or without one-sample color targets, is now drawn
as a one-sample draw at the pixel center, before the multisampled-target
check and instead of the sample-0 path, which needs MSAA_ENABLE.

Points, lines, alpha-to-coverage, a sample-mask export and DB_EQAA Z
interpolation or overrasterization throw on this path, and so do
PS_ITER_SAMPLE and ANCILLARY or SAMPLE_COVERAGE pixel inputs when the
pixel program runs. A skipped pixel program is replaced by the null
program, which uses neither.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 22:18:56 +05:30
XairRrR ac840ec7dd fix(agc): take a later slice's HTILE clear when every word has ZMask 0
A bind of slice 1 or later of a depth array read the slice's HTILE but took
its clear only when all its words were equal, because the HTILE word layout
of those slices is not modelled. Neither step needs the layout: the clear
is taken when every word of the range has ZMask 0 (a check over the set of
words), and the store-back rewrites each word in place from its own bits.
The value the surface is cleared to is DB_DEPTH_CLEAR, which the DB's depth
test reads for every cleared tile whatever its Min/Max Z (HTILE_Z_CLEAR_REG
in Mesa's src/amd/common/ac_descriptors.h), the same rule slice 0 already
follows.

PPSA05684 resets the four slices of its 2048x2048 D16 sun cascade array
every frame by writing ZMask 0 words with Min/Max Z 0 or 1 into their HTILE.
Slices 1 to 3 kept the previous frame's depth, and the main menu lost its
volumetric sun shafts and sunlit foliage.

agc_driver_depth_fast_clear_submit: slice 1 with words alternating 0x0 and
0xfffffff0 takes the clear, stores them back expanded and leaves slice 0's
HTILE alone. The refusal case keeps a word left expanded and is renamed.

AI-assisted: yes
2026-10-17 17:40:57 +02:00
fma-rc 8f37cddff0 feat(agc): link calls through the AGC FS table 2026-10-17 16:47:09 +02:00
AlxcBTW c05b2567be perf(agc): replace the plane copies around a depth plane's UAV clear by a depth clear
A compute kernel that stores one colour to every texel of a storage image over a depth plane (a shadow atlas clear) copied
the whole plane depth image -> staging buffer -> mirror before the dispatch and mirror -> staging buffer -> depth image
after it, although the kernel reads nothing and writes every texel.

A dispatch of the 15-word 8x8x1 image clear kernel (direct, no partial last group) whose T# lies on a depth surface now
reads its colour from guest memory under the GPU mutex, the place the kernel reads it. When the dispatch covers the whole
plane, the plane is one layer of level 0, the colour is a value the plane's format holds exactly (0 or 1 for a 16-bit
unorm view, 0 or 0xffff for a 16-bit uint view, 0 or a normal float in (0, 1] for a 32-bit view) and nothing is waiting to
write the colour, the dispatch still writes the mirror but the copy-in is left out, and the copy-out becomes a clear of the
depth image to that value. The colour is read again when the copy-out is replaced; a changed value keeps the copy-out.
Every other dispatch, stencil planes and declined values keep both copies.

agc_driver_depth_clear_hle_tests runs the clear sequences with the clear taken and with the copies, and compares the depth
image texel by texel through the mirror, the guest memory and the depth tests.
2026-10-17 16:29:18 +02:00
Lberonio 2aa6bfca62 fix(agc): suppress the flip end-of-pipe event on queues that raise release interrupts 2026-10-17 16:14:18 +03:00
JosepBove 3e1b7be111 fix(agc): clear the host depth image on a fill of a depth or stencil plane
A fill that covers a depth surface's whole stencil plane with four equal
bytes, or its whole depth plane with a value in 0.0-1.0, now reaches the
host image through the pending fast clear the next time the surface is
bound, sampled or stored to. An HTILE fill or HTILE clear kernel noted
afterwards replaces the value with DB_DEPTH_CLEAR/DB_STENCIL_CLEAR.
NoteDepthMetadataFill only reacted to fills of DB_HTILE_DATA_BASE, so the
Cohtml UI of Heretic + Hexen (PPSA26525) and DOOM + DOOM II (PPSA21444),
which resets its stencil plane to 1 with a 0x01010101 fill every frame and
then draws with stencil Equal 1 and 2, kept the stencil of earlier frames
and showed black squares and clipped text. agc_driver_depth_plane_fill
pins the rules.
2026-10-17 14:46:27 +02:00
Dean c9e6c45de9 Merge pull request #7016 from Amoenus/codex/fix-native-vertex-after6590-main661
fix(agc): refuse native MSAA vertex buffer reads
2026-10-18 00:57:37 +13:00