Commit Graph
442 Commits
Author SHA1 Message Date
Adrià Franch 6a894d4c1c Merge upstream/main into codex/fmask-image-reads 2026-10-19 09:48:51 +02:00
Adrià feb74b65c2 Merge pull request #6551 from yash27git/patch/Tessellation-Lowering
feat(shader): read hull inputs at a control point chosen by a select or phi
2026-10-19 08:31:08 +02:00
Adrià e0b8be9dc5 Merge pull request #6530 from milescoviello/feat/smoothing-mixed-samples
feat(agc): draw radeonsi line and polygon smoothing (SAMPLE_COVERAGE, merged mixed samples)
2026-10-19 06:06:26 +02:00
Dean Galvin 41764f27ac Merge main into pr-4650
# Conflicts:
#	core/shader/recompiler/ShaderDiskCache.cpp
2026-10-19 15:36:07 +13:00
Karan Vora 6d92220829 perf(agc): stage raw buffer elements a dispatch sweeps
Since 2688b7646 a read and written V# element is staged in device memory
up to 16 MiB when the direct dispatch's threads times the V# stride cover
at least half of it. A raw buffer has stride 0, so it never passed and
kept the 2 MiB written window: GL storage buffers compiled by Mesa stay
bound in place in the host import however hard a dispatch sweeps them.

The PS5 OpenGL Showcase's particle update (262,144 threads, each loading
and storing its own 32-byte record of an 8 MiB SSBO) took about 53 ms of
GPU per frame on an RTX 4060 bound in place; staged it takes about 0.1 ms
plus 2.2 ms of bulk copies.

The recompiler already records the furthest byte each buffer resource's
accesses reach past their base (maxByteExtent). The binding plan now
carries it per guest buffer element (DescriptorBinding::bufferExtent,
shader disk cache format 37), and a raw element uses it as its record
size in the sweep test. Strided elements are unchanged.
2026-10-19 03:43:19 +02:00
Adrià 23629c2847 Merge pull request #6454 from EagleBearerYS/perf/shader-image-table-reuse-v3-pr
perf(agc): share one image table per heap and write epoch through capture, compare, resolution and descriptors
2026-10-19 03:39:03 +02:00
Adrià 72b0ab3e8e Merge pull request #6312 from meh7an/perf/agc-cut-draw-allocations
perf(agc): cut per-draw heap allocations
2026-10-19 03:38:58 +02:00
Dean Galvin 4d4ae6e5eb Merge main into pr-4650
# Conflicts:
#	core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
#	core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
#	core/shader/recompiler/tests/RequestSerializerTests.cpp
2026-10-19 14:32:36 +13:00
milescovielloandClaude Opus 5.5 03b0db0520 feat(shader): load the SAMPLE_COVERAGE pixel input from gl_SampleMaskIn
SPI_PS_INPUT_ENA/ADDR bit 14 (SAMPLE_COVERAGE_ENA) gives the pixel shader one
VGPR, after ANCILLARY, holding the samples the primitive covers. The decoder
refused it and the recompiler never loaded the VGPR. It is now loaded from
gl_SampleMaskIn[0] (sharing the input the partial quad sample mask already
declares). On a multisampled draw the hardware word is the whole pixel's
coverage while gl_SampleMaskIn holds only the invocation's samples when the
pixel shader runs per sample, so that case, and sample-rate or ancillary inputs
beside it, are refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 01:25:21 +00:00
Adrià 00666eeb36 Merge pull request #6470 from EagleBearerYS/fix/recompiler-once-per-pixel-sample-inputs
fix(recompiler): run a pixel shader the guest does not iterate once per pixel
2026-10-19 03:21:34 +02:00
Adrià 80b2fc9212 Merge pull request #6417 from UnhealthyKraken/fix/invariant-image-table-phis
fix(shader): plan image tables through invariant descriptor phis
2026-10-19 02:40:40 +02:00
Mehran 9d6279ccfa perf(agc): cut per-draw heap allocations 2026-10-19 02:39:16 +02:00
Yunus Shaikh 106b79e007 Merge main into perf/shader-image-table-reuse-v3-pr
The data-hit verification keeps this branch's pending-span query on its ShaderMemory and takes #5958's CaptureInvocation, which retries a capture with converted samples.
2026-10-18 17:04:23 -07:00
Yunus Shaikh 10b798fb99 Merge main into perf/shader-image-table-reuse-v3-pr
Keeps this branch's tagVariantRuns declaration next to main's dumpRequest suffix parameter in Driver.hpp, and reads #6232's pointer-chain test words from its table's snapshot, where this branch keeps them.
2026-10-18 17:03:39 -07:00
Adrià 0745b29c90 Merge pull request #6332 from SleglJan/pr/fold-loop-phis
fix(shader): repeat phi folding until no phi folds
2026-10-19 01:23:34 +02:00
Adrià 0fd3555ad6 Merge pull request #5958 from ps54all/feat/shader-converted-image-sample
feat(shader): sample converted unorm images in the shader
2026-10-19 00:24:10 +02:00
Dean Galvin cf4d1f4a97 Merge main into pr-4650
# Conflicts:
#	core/shader/recompiler/ShaderDiskCache.cpp
2026-10-19 11:15:57 +13:00
Yunus Shaikh d13a90d015 Merge main into fix/recompiler-once-per-pixel-sample-inputs
Resolves the shader debt file bullet by bullet: main's EmitSetAttribute entry, and this branch's PERSP_SAMPLE/LINEAR_SAMPLE and pixel-position entries.
2026-10-18 15:14:25 -07:00
Adrià 07d5061ada Merge pull request #6306 from MarcZX10/codex/qualify-srt-memory-flags
fix(shader): qualify SRT memory flags template
2026-10-19 00:06:20 +02:00
Adrià b6403ddd6d Merge pull request #6176 from mitul72/perf/shader-integer-folding
perf(shader): fold integer compares by value sets and known bits
2026-10-18 23:26:59 +02:00
Adrià 0d1c299a91 Merge pull request #6277 from hypermoist/fix/window-lane-spills
fix(recompiler): read lane spills back through relative-addressing window registers
2026-10-18 23:14:35 +02:00
Adrià c7e28608b1 Merge pull request #6232 from ANONYMOUSZED-beep/feat/image-table-pointer-chains
feat(shader): follow pointer chains from image-table records to the T#
2026-10-18 22:50:22 +02:00
Dean ca1c4c89cd Merge pull request #6635 from hamb3r/fix/shader-msaa-array-descriptor-shape
fix(shader,agc): support multisampled 2D array descriptor image shape and runtime views
2026-10-19 09:32:18 +13:00
Adrià fb9a1eb8f3 Merge pull request #6178 from MarcZX10/codex/release-undrawn-resource-plans-6139
perf(agc): release unused registered shader resource plans
2026-10-18 22:20:27 +02:00
mitul72 4064ff4c83 perf(shader): fold integer compares by value sets and known bits
IEqual32 and INotEqual32 against a constant fold when the other
operand has a value set of at most 64 values (built through shifts,
bitfield extracts, and/or/xor/mul/umin with a constant, add and
select) that excludes the constant or holds only it, or when a known
bit of the operand contradicts the constant. Known bits come from
constants, shifts and bitfield extracts by constants, and/or/xor, add
(up to the first unknown bit), mul (trailing zeros), umin, select, phi
and lane reads. The value set of x & mask leaves out the known bits of
x. ULessThan32 against a constant folds from the known-bit and
value-set bounds.

A fold pass computes the known bits and value set of each compared
operand once, so a chain of compares against one operand does not
repeat the analysis, and a sum is not enumerated when its two operand
sets hold more than 65 values together, since without wraparound it
then has more than 64 values.

All folds are identities of the operand's possible values; out-of-range
M0 handling of the relative indexing lowerings is unchanged. With
M0 = 4i + k, three of every four entries of an s_movrels/s_movreld
compare chain fold away.
2026-10-18 21:06:52 +02:00
ANONYMOUSZED-beep 486f3069ae feat(shader): follow pointer chains from image-table records to the T# 2026-10-18 20:49:04 +02:00
Yunus Shaikh d0325058f7 Merge main into perf/shader-image-table-reuse-v3-pr
#7527's selected-record limit test reads a record's descriptor words through the
table snapshot's shared words list; this branch keeps a snapshot's words per column,
so the test reads them from its column instead.
2026-10-18 11:33:00 -07:00
Yunus Shaikh dc47a81b02 Merge main into fix/recompiler-once-per-pixel-sample-inputs 2026-10-18 11:30:31 -07:00
Dean 300437f102 Merge pull request #7296 from gjonn/fix/shader-unnormalized-sampler-null-image
fix(shader): bind an unnormalized S# normalized when it samples only null images
2026-10-19 07:24:37 +13:00
Dean e3c46940b3 Merge pull request #7527 from EagleBearerYS/fix/shader-selected-records-image-pair-limits
fix(shader): keep a shader's selected image-table records within the image and pair limits
2026-10-19 07:22:18 +13:00
ps54allandClaude Opus 5.5 8545c23013 feat(shader): sample converted unorm images in the shader
10_11_11_UNORM (format 30) images are read and written through an
R32_UINT view, so the hardware sampler cannot filter them. image_sample
of a 2D or 2D array view now fetches the one or four texels at LOD 0,
decodes them and blends them in the shader, with bilinear weights on
the 8-bit grid, for point or bilinear filtering with wrap or
clamp-to-edge addressing.

A shader gets the converted sample mode only after a converted
descriptor reaches one of its sampled images: that capture throws
ConvertedSampleRequired and the driver prepares the program again
with GuestContext::convertedSamples.

The R10_G11_B11 float format is sampled natively since #7271 and keeps
its refusal on the converted path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-18 17:43:35 +02:00
Gjon Gojcevic a2e79fb3fd fix(shader): bind an unnormalized S# normalized when it samples only null images
An S# that forces unnormalized coordinates was refused when it samples a
T# the shader declares 3D, 2D-array, cube or multisampled, since Vulkan
allows unnormalized coordinates only with a single-level 1D or 2D view.
A null T# reads zeros at any coordinate, and a T# whose channels all
select constants is emitted as those constants without a sample, so when
the S# samples no other T# its coordinates cannot change a result. Such
an S# is now marked in its binding (samplerCoordinatesIgnored) and the
driver creates its sampler without FORCE_UNNORMALIZED. The flag is part
of the binding content key and of the shader disk cache, whose format
version is raised to 38. An S# that also samples a real T# while a null
T# of such a shape shares it is still refused. PPSA01317 pairs an
unnormalized clamped bilinear S# with a null 3D T# and a 3D T# whose
channels all select 0 for image_sample_lz in a compute shader during
boot.

AI-assisted: yes
2026-10-18 09:02:31 -04:00
Dean 385ed71f2c Merge pull request #7368 from CrimsonMac/fix/device-lds-mixed-width-atomics
fix(shader): use 64-bit buffer atomics for device-memory LDS
2026-10-19 01:51:59 +13:00
Yunus Shaikh bab404e7af fix(shader): keep a shader's selected image-table records within the image and pair limits
Since #6243, each read whose record offset the CPU evaluates gets its own
selected table column, so a shader that reads one heap at many such keys
plans one image per key. Past 64 keys that is refused with "image resource
limit exceeded", or with "sampled image/sampler pair limit exceeded" when
each read is sampled twice, where the shader planned within both limits
before.

After planning the table columns, the tracker now estimates the images
and sampled pairs that collecting the program would add, keyed as
AddImage and AddSampledPair key them, from the planned column sources
and the direct handles. If either is over its limit, it plans again with
the columns of one heap unselected, the heap with the most selected
columns first, until both fit or no heap is left. Those reads then share
one keyed column, as before #6243: the union of their key domains and the
largest key. A shader within both limits plans exactly as before, from
one planning pass.

The estimate counts images exactly. A direct sampler is told apart by its
handle's words and whether the sample adjusts, before the canonicalization
collecting it applies, so the pair count can only be too high and errs
toward merging.
2026-10-18 04:33:39 -07:00
Kovalev Vladislav 9b42649a93 fix(agc): reconcile FMASK reads with current main 2026-10-18 16:53:33 +06:00
Yunus Shaikh dad24e3a4f Merge main into perf/shader-image-table-reuse-v3-pr 2026-10-18 02:56:48 -07:00
Crimson cb28abeb89 fix(shader): fault on misaligned 64-bit device-memory LDS atomics 2026-10-18 12:31:11 +03:00
Scramblrrrr fd0d1f172d chore: merge current main into volume table rejection fix
# Conflicts:
#	core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
2026-10-18 05:09:40 -03:00
Dean ed01d79d3c Merge pull request #7271 from gjonn/feat/agc-format43-native-repack
feat(agc): sample texture format 43 through a lossless B10G11R11 copy
2026-10-18 20:51:59 +13:00
Dean Galvin 5db206aba0 fix(agc): read the depth remap scale and offset from push constants at run time
The remap mode stays a specialization constant and cache key input. Scale and
offset are two push words at byte 104, patched per draw, so draws that differ
only in depth range share one pipeline. The recipe, journal and serializer
carry the mode only.
2026-10-18 19:01:14 +13:00
Yunus Shaikh a508aa03c4 Merge main into perf/shader-image-table-reuse-v3-pr 2026-10-17 22:15:10 -07:00
Dean 0e03263013 Merge pull request #6095 from meh7an/perf/shader-srt-tape
Merged while @adriadam10 is away; his requested change is in place.
2026-10-18 17:41:16 +13:00
Yunus Shaikh db622e1c4f Merge main into perf/shader-image-table-reuse-v3-pr 2026-10-17 21:26:16 -07:00
Dean Galvin 6dde6cf658 Merge main into perf/image-table-index-scratch 2026-10-18 16:05:24 +13:00
Yunus Shaikh 6720211da1 Merge main into perf/shader-image-table-reuse-v3-pr 2026-10-17 19:24:20 -07:00
Yunus Shaikh 2848253fe4 Merge main into fix/recompiler-once-per-pixel-sample-inputs 2026-10-17 19:06:51 -07:00
Dean 0e94c5d434 Merge pull request #6243 from EagleBearerYS/perf/shader-direct-cpu-evaluable-images
perf(shader): select the record of a T# whose offset the CPU evaluates
2026-10-18 15:00:57 +13:00
hamb3r ed85bd05ce Merge remote-tracking branch 'origin/main' into fix/shader-msaa-array-descriptor-shape
# Conflicts:
#	core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
#	core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp
2026-10-18 04:53:06 +03: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
Yunus Shaikh 49788713ac Merge #6243's head into perf/shader-image-table-reuse-v3-pr
#6243's new head merges main f1af6c5915, whose #7325 adds
verifyChainedTableOffset next to the selected-record tests this
branch carries from #6243. That test reads the record words from the
snapshot's shared word list; this branch keeps the words with each
table's snapshot, so the merge reads them from the table it checks.
2026-10-17 17:57:47 -07:00