Commit Graph
515 Commits
Author SHA1 Message Date
Dean 81605d59ec Merge pull request #12132 from mrfelek/fix/descriptor-web-lane-index
fix(shader): fold descriptor web paths that hold the lane index or texels
2026-11-03 21:10:04 +13:00
Dean 66387a10ee Merge pull request #10000 from EagleBearerYS/feat/shader-sampler-limits
feat(shader): raise the sampler and sampled-pair limits past the 32-bit sampler masks
2026-11-03 21:09:43 +13:00
Dean 99bf42af86 Merge pull request #9671 from ntamas94/up/gcn-cmpx-writes-destination
fix(shader): write a GCN v_cmpx result to its VCC or SDST as well as EXEC
2026-11-03 21:09:21 +13:00
Dean 20f515312c Merge pull request #10556 from mixyt/fix/unset-format-null-textures
fix(shader): decode a T# with an unset format field as null
2026-11-03 21:08:38 +13:00
Dean a9e723b83b Merge pull request #14909 from kallmek3nny/feat/shader-alpha-to-coverage-sample-mask
feat(shader): combine alpha-to-coverage with a sample-mask export
2026-11-03 18:12:13 +13:00
Dean b8b15a36ca Merge pull request #14888 from kallmek3nny/feat/shader-sdwa-f16-byte-clamp
feat(shader): support SDWA clamp with byte selectors on f16 VOP2
2026-11-03 18:11:43 +13:00
felek b5f1d6b44d docs(debt): say which image results a descriptor web fold takes
The descriptor web entry and APS5_STRICT_DESCRIPTOR_WEBS said "texels";
the fold takes image loads and samples only. A path through an image
gather or an image atomic's returned value still throws.

AI-assisted.
2026-11-02 23:58:12 +01:00
Dean a5c53e975c Merge pull request #12980 from Gonic0/fix/agc-min-lod-pinned-level
fix(agc): bind a T# minimum LOD through an S# that holds the LOD at 0
2026-11-03 11:35:28 +13:00
Dean 1f272537eb Merge pull request #12764 from Pipodi/perf/flat-private-aperture-1028
perf(recompiler): back compute scratch with a device buffer slot pool
2026-11-03 11:35:12 +13:00
Dean 9090972b7e Merge pull request #15172 from brumskysb/docs/div-scale-f64-rdna2
docs(shader): record `v_div_scale_f64` denormal modes on RDNA2
2026-11-03 09:24:32 +13:00
Dean 096c45570f Merge pull request #15161 from brumskysb/docs/fma-f64-tininess
docs(shader): record `v_fma_f64` and `v_div_fmas_f64` on RDNA2
2026-11-03 08:55:54 +13:00
Dean f7d225d8e3 Merge pull request #15118 from shahulmubeen-a/docs/shader-hull-quad-lane-masks
docs(shader): record why hull programs that read a whole-quad lane mask throw
2026-11-03 08:53:37 +13:00
brumskysb 3d7ba8c931 docs(shader): record v_div_scale_f64 denormal modes on RDNA2 2026-11-02 12:53:14 -07:00
Dean aeae1aebe7 Merge pull request #15117 from shahulmubeen-a/docs/shader-integer-linear-point
docs(shader): record that RDNA2 point-samples integer T#s under a bilinear S#
2026-11-03 08:53:01 +13:00
Dean 886ddf2050 Merge pull request #15116 from shahulmubeen-a/docs/shader-format-131-layout
docs(shader): record the measured layout of T# FORMAT 131
2026-11-03 08:52:28 +13:00
brumskysb fa87e7a722 docs(shader): record v_fma_f64 and v_div_fmas_f64 on RDNA2 2026-11-02 12:31:12 -07:00
brumskysb 2f101ee4a0 docs(shader): record negative texture coordinates on RDNA2 2026-11-02 10:23:56 -07:00
mixyt 0dd1814129 fix(shader): decode a T# with an unset format field as null 2026-11-02 15:28:18 +00:00
Nicolas GonzalezandClaude Opus 5.5 4e2a028e43 fix(agc): bind a T# minimum LOD through an S# that holds the LOD at 0
Without VK_EXT_image_view_min_lod, a T# clamp paired with an S# that
holds the LOD at 0 (no mip filter or MAX_LOD 0) threw, since the shader's
MinLod would sit above the sampler's maximum. The view clamp then reads
the clamp's level with the magnification filter, so such an S# is now
bound with MIN_LOD = MAX_LOD = the clamp, its mip filter kept (none
becomes point) and its magnification filter for both.

The builder still throws when that S# has different magnification and
minification filters (the view clamp leaves the LOD at 0 and the variant
raises it to the clamp, and AMD RDNA 4 and NVIDIA disagree on the view
clamp's choice), filters anisotropically in only one direction, or also
samples a table image or a mipmapped image with another clamp.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 11:58:37 -03:00
Nicolas GonzalezandClaude Opus 5.5 fe18496c95 feat(agc): apply a T#'s MIN_LOD clamp in the shader without VK_EXT_image_view_min_lod
MoltenVK has no VK_EXT_image_view_min_lod, so since #130 the first T#
with a MIN_LOD clamp above its base level threw. ASTRO BOT (PPSA21564
01.007.000) hits it on the title screen, about four minutes after boot.
MoltenVK does offer shaderResourceMinLod, which maps the SPIR-V MinLod
operand to Metal's min_lod_clamp.

On a device with shaderResourceMinLod, without the extension and
without graphics pipeline libraries, the new target flag
shaderImageMinLod moves the clamp into the shader:

- DescriptorBindingBuilder writes each direct image's clamp, relative
  to the view's base level and bounded by its last level and MAX_MIP,
  as a float specialization constant at MinLodBase + image.
- Samples of direct images take it as the MinLod operand, or as an FMax
  on an explicit LOD when the clamp is above 0, combined with an
  instruction's _cl clamp.
- The image view no longer chains the clamp there; image table entries
  with a clamp are still rejected, and devices with the extension are
  unaffected. APS5_NO_IMAGE_VIEW_MIN_LOD forces the shader lane.
- It throws when the clamp sits above a paired S#'s MAX_LOD or has no
  mip filter, follows an explicit LOD or gradient with a nonzero S# LOD
  bias, pairs with a run-time S# or different min and mag filters, or
  meets image_get_lod, gathers at a clamp of a level or more, or the
  emulated depth-compare or 11:11:10 sample.
- ValidateShaders accepts CapabilityMinLod when the device enables
  shaderResourceMinLod.
- The flag is written after hostInterpolationFirst as request
  serialization version 53; older versions read it as false.

The gaps, including llvmpipe applying the S# bias after the clamp, are
recorded in docs/dev/debt/shader.md.

Tested on an M-series Mac (MoltenVK 1.4.2, x86_64 under Rosetta):
image_sample_lod_clamp samples a T# with fractional and level clamps
over BASE_LEVEL 0 and 1 in both lanes, and fails without the shader
clamp or with an absolute one; graphics, shader disk cache, shader
memory and request serializer tests pass. PPSA21564 renders the title
and reaches the warp sequence after it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 11:58:37 -03:00
Dean Galvin e9d8998d58 Merge main 3c3b3cda73 into #12764 (fee187ee67)
SpirvEmitter.cpp: main now calls Finalize() before filling info and checks
spanned-wave barriers on the words; keep that and run this branch's
VerifyScratchPoolReturns(state, words) on the same words before returning.
2026-11-02 23:39:24 +13:00
Dean d2ce337078 Merge pull request #11580 from QRMOE/fix/shader-converted-image-d16
fix(shader): load and store 16-bit data of converted packed images
2026-11-02 23:29:11 +13:00
Dean fe06bfea1d Merge pull request #11510 from morten-holm/feat/shader-buffer-or64-split
feat(shader): split unused-result 64-bit bitwise buffer atomics without shaderBufferInt64Atomics
2026-11-02 23:28:53 +13:00
Dean 1900d3963a Merge pull request #10941 from TechLevelZero/fix/div-fmas-f32-single-rounding
fix(shader): round v_div_fmas_f32 once and keep its denormal inputs
2026-11-02 23:25:23 +13:00
Dean f2bb268d70 Merge pull request #10858 from maximilianfv/fix/agc-moltenvk-wave-lds-memory-barriers
fix(agc): order wave LDS accesses with memory barriers on MoltenVK
2026-11-02 23:24:42 +13:00
Dean 18bb046f69 Merge pull request #7922 from ThatsLeo/feat/shader-spanned-uniformity
perf(shader): span single-wave wave64 compute by default after a uniformity check
2026-11-02 23:22:27 +13:00
Yunus Shaikh 760a550294 Merge main into feat/shader-sampler-limits
# Conflicts:
#	core/shader/recompiler/ShaderDiskCache.hpp
2026-11-02 00:48:24 -08:00
Dean Galvin fee187ee67 Merge commit '88e804b0a7df1f1ac373a9e2f72fb378d925fdd4' into HEAD
# Conflicts:
#	core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
#	docs/dev/debt/libSceAgcDriver.md
#	docs/dev/debt/shader.md
2026-11-02 21:17:34 +13:00
Dean 0c0b1b22b9 Merge pull request #6959 from JJenkx/fix/mesh-layer-windows-main2fab
fix(agc): render layered mesh targets within device limits
2026-11-02 20:55:52 +13:00
Shahul Mubeen AandClaude Opus 5.5 d4c4fd2bda docs(shader): record why hull programs that read a whole-quad lane mask throw
A Vulkan hull invocation runs one output control point of one patch, so a
lane mask that mixes lanes of other patches cannot be read. Ghost of Yotei
has eight merged hull programs that apply s_wqm_b64 to a ballot; with 3
output control points a console lane quad spans two patches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 11:07:05 +05:30
Shahul Mubeen AandClaude Opus 5.5 80a2062e0d docs(shader): record that RDNA2 point-samples integer T#s under a bilinear S#
image_sample_lz with a bilinear S# returned the same nearest texel as a
point S# for 8-, 16- and 32-bit UINT and SINT formats on RDNA2 (gfx1036)
through the hardware oracle, which the point-filtered S# copy for integer
image table entries matches. The debt entry said this was assumed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 11:07:05 +05:30
Shahul Mubeen AandClaude Opus 5.5 9f6ed85a25 docs(shader): record the measured layout of T# FORMAT 131
R, G and B are 10-bit unsigned floats with a 4-bit exponent (bias 7) and
a 6-bit mantissa, A is a 2-bit UNORM, as image_load returns them on
RDNA2 (gfx1036) through the hardware oracle. The format stays refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 11:07:04 +05:30
Alex ColliniandClaude Opus 5.5 28a30ed35d perf(shader): read a scratch pool slot lock before trying to take it
A workgroup looking for a scratch pool slot now loads the lock and tries the compare-exchange only when it reads free, so waiting workgroups stop issuing atomics on locks their holders use. In the scratch dispatch bench on an RTX 4090 with about 9 slots for 32768 workgroups (APS5_SCRATCH_POOL_MIB=1) the dispatch goes from 1377 ms to 1308 ms; with the default 64 MiB pool it is unchanged (389 to 395 ms). The debt notes the measured runtime cost of the pool against Function arrays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 04:35:35 +01:00
Alex ColliniandClaude Opus 5.5 a46f050af8 perf(recompiler): back compute scratch with a device buffer slot pool
NVIDIA's front end spends tens of seconds per large compute program on the
dynamically indexed Function arrays that held the per-lane scratch. A compute
program that uses scratch (scratch_* or a FLAT access that the aperture split
routes to the private aperture) now keeps it in a storage buffer instead, so
no Function array is declared or indexed. FLAT routing is unchanged.

The driver allocates one buffer per compute pipeline on its first dispatch,
capped by APS5_SCRATCH_POOL_MIB (default 64), holding a lock word and an
invocation counter per slot followed by the slots, and binds it in descriptor
set 2 (the layout of the device-memory LDS buffer). The shader takes the slot
count from the array length. Invocation 0 of each workgroup claims a slot with
a compare-exchange scan that starts at its linear workgroup id and spins until
it wins one; a barrier publishes the slot. Every invocation decrements the
slot's counter on every compute exit and the last one frees the lock, so
divergent exits and concurrent dispatches of one pipeline share the buffer
safely. The emitter fails the compile if a compute return lacks the release.
Programs without scratch keep their SPIR-V and pipeline layout.

The buffer is decorated Coherent: without it NVIDIA lost earlier byte stores
of a sequence of byte read-modify-writes to one dword. Lane-private
read-modify-writes no longer use atomics.

Tests: a new execution test covers the private aperture reached through a
table load, a literal and a computed address (store, atomic, and both ways
through scratch_*), a callee reached through s_swappc_b64, isolation of 64
workgroups over one or two slots, divergent wave exits with a second dispatch
reusing the slots, and the module shape (no Function array, no binding in a
program without scratch). The guarded memory load fixture skips the slot
acquisition.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 04:35:35 +01:00
kenny solo 0004d35125 feat(shader): combine alpha-to-coverage with a sample-mask export
With alpha-to-coverage and DB_SHADER_CONTROL.MASK_EXPORT_ENABLE the pixel shader now writes SampleMask as the AND of its MRT0 alpha coverage and its MRTZ mask export instead of throwing, as Vulkan multisample coverage ANDs the shader sample mask with the alpha-to-coverage mask. Adds eight- and two-sample GPU tests and a shader debt entry for the rule, which is not measured on hardware.
2026-11-01 18:54:23 -05:00
Dean 6796927e47 Merge pull request #14824 from kallmek3nny/docs/shader-image-formats-131-135
docs(shader): add a debt entry for image format 131
2026-11-02 11:52:54 +13:00
kenny soloandClaude Opus 5.5 254d0da5e2 feat(shader): support SDWA clamp with byte selectors on f16 VOP2
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-11-01 17:22:22 -05:00
kenny soloandClaude Opus 5.5 d750442be2 docs(shader): narrow the LLVM dot8 clamp wording
LLVM has explicit int_amdgcn_sdot8 and int_amdgcn_sudot8 patterns with a clamp operand, so the integer dot clamp entry now says only that there is no generic saturating-add dot8 pattern like the dot2 and dot4 ones.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-11-01 14:29:09 -05:00
kenny soloandClaude Opus 5.5 6c51160dc7 docs(shader): add a debt entry for image format 131
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-11-01 13:30:49 -05:00
kenny soloandClaude Opus 5.5 9bd8aa502f docs(shader): record the integer dot clamp gap
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-11-01 12:39:56 -05:00
JJenkx 076ea5e060 test(agc): separate layered mesh execution from compilation 2026-11-01 06:07:39 -05:00
TechLevelZero a7ce3fadaa Merge branch 'main' into fix/div-fmas-f32-single-rounding 2026-11-01 10:01:21 +00:00
Dean Galvin a68458936e Merge main into feat/shader-spanned-uniformity
# Conflicts:
#	docs/dev/ENVIRONMENT.md
#	docs/dev/debt/shader.md
2026-11-01 20:59:37 +13:00
Dean b5f72708e5 Merge pull request #13149 from Prophet069/pr/shader-scalarized-image-tables
fix(shader): recognize scalarized constant-stride image tables
2026-11-01 19:30:01 +13:00
Adrià 2882fd548a Merge pull request #13846 from Deftera186/fix/shader-div-scale-f64-denormals
fix(shader): flush v_div_scale_f64 denormals by the f64 denormal field
2026-11-01 05:50:23 +01:00
Adrià bffd50620b Merge pull request #13845 from Deftera186/fix/shader-fma-f64-denormals
fix(shader): flush v_fma_f64 and v_div_fmas_f64 denormals by the f64 denormal field
2026-11-01 05:34:38 +01:00
Liav Mordouch 6810bf98cc fix(shader): flush v_div_scale_f64 denormals by the f64 denormal field 2026-11-01 04:35:55 +01:00
AdriàandClaude Opus 5.5 644863fde5 test(shader): skip only results a device flush can produce
The device-dependent skip accepted any wrong result on a device without
f64 DenormPreserve, and a run that excused rows still reported a pass.
Require the result to match a flushed mode's row, pin that with a negative
control and return the skip code. Record what the saved gfx1035 rows show
about the rule in the debt entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 04:25:22 +01:00
Liav Mordouch 9ae19f9711 fix(shader): flush v_fma_f64 and v_div_fmas_f64 denormals by the f64 denormal field 2026-11-01 04:25:00 +01:00
Liav Mordouch 1ff51425e8 fix(shader): flush v_ldexp_f64 denormals by the f64 denormal field 2026-11-01 03:21:07 +01:00