Commit Graph
1617 Commits
Author SHA1 Message Date
Adrià 572130c764 Merge pull request #6767 from DavidSamir/fix/shader-interpolation-without-float64
fix(shader): interpolate 16-bit values with 64-bit integers on devices without Float64
2026-10-19 12:54:25 +02:00
Adrià 118266aec2 Merge pull request #6760 from Ondra97/codex/fix-f64-minmax-denormals
fix(shader): honor f64 min and max input denormal mode
2026-10-19 12:27:39 +02:00
Adrià aaaff21edf Merge pull request #6733 from meh7an/perf/shader-result-memo-sets
perf(shader): keep memoized results in a set-associative table
2026-10-19 12:20:45 +02:00
Adrià d65a58e63f Merge pull request #6706 from milescoviello/perf/runtime-bda-byte-writes
perf(shader): emit runtime V# byte writes through the looping helper
2026-10-19 11:46:58 +02:00
Dean 64e2a810a9 Merge pull request #7571 from milescoviello/fix/bda-lookup-single-exit
fix(shader): leave the BDA lookup functions through one return
2026-10-19 22:26:10 +13:00
Adrià 13cf6954a3 Merge pull request #6674 from veosett/codex/fmask-image-reads
fix(agc): read uncompressed FMASK images from guest memory
2026-10-19 11:05:57 +02:00
Adrià 52f8222af1 Merge pull request #6670 from MarcZX10/codex/lds-lock-init-race-6666
fix(shader): initialize LDS lock from one invocation
2026-10-19 10:45:39 +02:00
Adrià 5a3c515753 Merge pull request #6644 from mariuszkreft/fix/shader-ballot-once-per-block
fix(shader): ballot each predicate once per block
2026-10-19 10:14:07 +02:00
David a3cfc8c461 fix(shader): interpolate 16-bit values with 64-bit integers on devices without Float64
v_interp_p1ll_f16, v_interp_p1lv_f16 and v_interp_p2_f16 round the exact
P10 * I + P0 once to f32 and P20 * J + S2 once to f16 (#697), and
v_fma_mixlo_f16 and v_fma_mixhi_f16 reuse the f16 step in every f16
rounding mode. The exact sum was computed in f64, so on a device without
Float64 every shader using them failed to compile:

  64-bit float instructions need the Float64 capability, which the
  device lacks

Apple GPUs have no f64; with MoltenVK 1.4.2 on Apple M2 this stops
ProsperoStore (PPSA99000), PokeMMO Prospero (PPSA98001), Regie5
(PPSA99520) and PS5 OpenGL Showcase (PPSA99005) at their first such
pixel shader.

Without Float64 these operations are now computed in 64-bit integers,
which the shader device profile already requires. The inputs are
flushed as before and decoded to integer significands. The 24 by 24 bit
product is exact in 64 bits. Both terms are normalized to bit 62, the
smaller one is shifted down with the bits it loses kept as a sticky bit,
and the exact sum is rounded once to f32 to nearest even, or to f16 in
the f16 rounding mode, with f32 and f16 subnormal steps. Overflow,
signed zeros, the round-down zero sign, NaN quieting and the order in
which NaN operands win follow the f64 path, without its f64 arithmetic.
The module then declares Int64 instead of Float64. Devices with Float64
keep the f64 path.
2026-10-19 10:10:13 +02:00
David ebe42cf3fa refactor(shader): record 16-bit interpolation apart from other f64 requirements
FPInterpolateF32 and FPInterpolateF16, which v_interp_p1ll_f16,
v_interp_p1lv_f16, v_interp_p2_f16, v_fma_mixlo_f16 and v_fma_mixhi_f16
translate to, set the same float64 requirement as the f64 instructions,
since their exact sums are computed in f64. They now set
float64Interpolation instead, and the module still declares Float64,
and still throws without it, for either requirement. Nothing changes in
the emitted SPIR-V; the next commit gives these two operations a path
for devices without Float64.
2026-10-19 10:10:07 +02:00
Adrià Franch 6a894d4c1c Merge upstream/main into codex/fmask-image-reads 2026-10-19 09:48:51 +02:00
Adrià 9bfbedc562 Merge pull request #6613 from milescoviello/fix/vertex-barrier-before-memory
fix(shader): emit nothing for a vertex s_barrier that precedes every memory access
2026-10-19 09:38:07 +02:00
m2 (AI Agent)andClaude Opus 5.5 d83f541c54 fix(shader): ballot each predicate once per block
Every OpGroupNonUniformBallot now goes through SpirvModule::AddSubgroupBallot.
A repeated ballot of the same predicate in the same block becomes an
OpCopyObject of the first ballot. Within one block the active invocations do
not change, so the result is identical. The cache is cleared at every label,
function boundary, function call and demote, and helper functions keep their
own cache.

When SPIRV-Tools is enabled, block merging and specialization can still put
two ballots of one predicate into the same block after emission, so
ValidateAndOptimizeSpirv collapses repeated block ballots the same way on
every module it returns, optimized or not.

NVIDIA 580's SPIR-V compiler segfaulted (libnvidia-gpucomp+0xe3facc) on GTA V
compute shaders that ballot one predicate many times in a block. One such
shader had 163 repeated ballots across three blocks. With them collapsed, both
crashing captures (compute-fe506552cec99bfc and compute-c02e5e3f35010fa5)
compile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 09:30:26 +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
Dean 2dcc94109e Merge pull request #7733 from MarcZX10/codex/fix-spirv-validator-exit-unwind-7732
fix(cmake): link MinGW spirv validator exit test runtime
2026-10-19 18:52:02 +13:00
Dean 323ece2445 Merge pull request #7445 from elliot1377/fix/agc-dispatch-split-base
fix(agc): split oversized dispatches with workgroup offset specialization
2026-10-19 18:51:58 +13:00
Dean 819ced2e1d Merge pull request #7674 from thuanquang/fix/mesh-layer-block
fix(shader): write a mesh shader's layer through a per-primitive block
2026-10-19 18:51:54 +13:00
Adrià 9f5d4bd929 Merge pull request #6503 from ThatsLeo/perf/shader-hw-f32-flush
perf(shader): flush f32 denormals in hardware when a startup probe matches the emulation
2026-10-19 07:40:27 +02:00
Dean 4ffb0cd12b Merge pull request #7377 from EagleBearerYS/fix/shader-pixel-bda-single-exit
fix(shader): end a pixel shader's failed BDA reads through one exit
2026-10-19 18:22:07 +13:00
Adrià Franch 3c95095c21 test(shader): read a version 35 request without the f32 flush flag 2026-10-19 07:00:21 +02:00
ThatsLeo ac14d6317d perf(shader): flush f32 denormals in hardware when a startup probe matches the emulation
Devices with DenormFlushToZero for f32 run the mixed denormal-flush programs with and
without the hardware mode at startup; when every result matches, add, sub, mul, fma,
floor and ceil in the default rounding mode drop their software flush.
2026-10-19 07:00:13 +02:00
Dean 574762f121 Merge pull request #6659 from JJenkx/perf/spirv-single-input-validation
perf(shader): validate optimizer input once
2026-10-19 17:52:07 +13:00
Dean 859017b4ce Merge pull request #7698 from tibzejoker/perf/f16-single-convert
perf(shader): convert one f16 value instead of an (x, 0.0) pair
2026-10-19 17:52:01 +13:00
MarcZX10 f7cef86629 fix(cmake): link MinGW spirv validator exit test runtime 2026-10-19 04:33:56 +00: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
elliot 40d4cc03f5 fix(agc): move workgroup offset specialization IDs to 8241-8243
8237 and 8238 are taken by MeshLayerBase and MeshLayerCount in #6959 and 8240 by DepthRemapBase in another open PR, so buildSpecializedModule would read a mesh module's IDs as workgroup offsets once both land.
2026-10-18 22:54:44 -05:00
elliot 11a7b61d72 fix(agc): split oversized dispatches with workgroup offset specialization
A dispatch over maxComputeWorkGroupCount was split into vkCmdDispatchBase
chunks whose base reached the limit, which VUID-vkCmdDispatchBase-baseGroupX-00421
forbids, and NVIDIA refused the split outright.

Compute modules now declare WorkgroupOffset specialization constants (default 0)
that the recompiler adds to WorkgroupId and GlobalInvocationId and keeps
unmaterialized. Each chunk is recorded with vkCmdDispatch from group 0, bound to
a pipeline variant specialized with the chunk's base. The NVIDIA throw is gone;
device-memory LDS splits still throw.

Fixes #7375
2026-10-18 22:54:33 -05:00
Dean 3ddbc4accc Merge pull request #4650 from Mouad-Scriptz-0/feat/agc-depth-range-remap
feat(agc): remap a viewport depth range the device cannot express into the vertex shader
2026-10-19 16:52:31 +13:00
Adrià 9f8252af15 Merge pull request #6450 from fdfawef324/codex/shader-cache-runtime-sources-1015
fix(recompiler): keep standalone tests out of shader cache versions
2026-10-19 05:00:11 +02:00
Dean Galvin 41764f27ac Merge main into pr-4650
# Conflicts:
#	core/shader/recompiler/ShaderDiskCache.cpp
2026-10-19 15:36:07 +13:00
fdfawef324andCodex f3f453ec9d fix(recompiler): key shader caches on compiled sources
Co-Authored-By: Codex <noreply@openai.com>
2026-10-19 04:27:37 +02: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
Adrià c22eb87563 Merge pull request #6476 from JJenkx/fix/bundled-validator-teardown
fix(build): preserve bundled validator type tables through exit
2026-10-19 03:27:03 +02: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 <noreply@anthropic.com>
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
milescovielloandClaude Opus 5.5 7092dde6ee fix(shader): emit nothing for a vertex s_barrier that precedes every memory access
A vertex-path program with LDS, GDS or memory writes refused any s_barrier. NGG passthrough
programs start with the s_barrier that orders GS_ALLOC_REQ, before any memory access, and some
write buffers later. A barrier that runs before every load, store, atomic, image or LDS access of
the program has nothing to order, so it emits no instruction, like the barrier of a program
without memory access. Barriers after a memory access still throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 01:07:58 +00:00
thibautandClaude Opus 5.5 96bacb7eb8 perf(shader): convert one f16 value instead of an (x, 0.0) pair
ConvertF16F32 built an (x, 0.0) f32 pair and packed it, and unary f16 results
(v_rcp_f16, v_sqrt_f16, ...) were packed with a 0.0 high half: the constant half
went through the whole f32-to-f16 conversion each time, which without native
f16 is a bit-level rounding sequence. Both now convert the one value; the high
half of the bits is zero as before, so the results are the same.

Test: agc_f16_single_convert recompiles four v_rcp_f16 with and without native
f16 and requires no (x, 0.0) f32 pair; on main each case emits four.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XBXM4pgkMHYEtqN1EQni2P
2026-10-19 03:07:05 +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
Adrià 55a3ac6440 Merge pull request #6405 from fdfawef324/claude/shader-structurizer-branching-returns
fix(shader): give a selection a merge when one arm returns through nested branches
2026-10-19 02:07:54 +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à 384840af1b Merge pull request #6130 from ivica00/fix/rect-list-tess-coord-rounding
fix(shader): round tessellation coordinates to nearest integer in rect-list evaluation
2026-10-19 00:43:06 +02:00
Adrià 18bd700806 Merge pull request #6291 from santhoshkumar-dev/codex/fix-pixel-exec-helper-lanes
fix(shader): preserve pixel helper lanes in EXEC copies
2026-10-19 00:37:47 +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