Skip to content

GS/HW: Tweak AF shader#14465

Merged
lightningterror merged 1 commit into
PCSX2:masterfrom
TheLastRar:AF-Small-Opt
Jun 28, 2026
Merged

GS/HW: Tweak AF shader#14465
lightningterror merged 1 commit into
PCSX2:masterfrom
TheLastRar:AF-Small-Opt

Conversation

@TheLastRar

@TheLastRar TheLastRar commented May 17, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

Applies various optimisations to shader based anisotropic filtering, such as;
Early fall back to isotropic filtering if the sample covers less than a pixel.
Use more intrinsics.
Simplify some calculations by using equations from the GL spec.

Rationale behind Changes

The shader based approach is noticeably slower then HW (depending on the GPU this difference can be significant).

Suggested Testing Steps

Test performance.

Did you use AI to help find, test, or implement this issue or feature?

Google Gemini regarding refreshing my memory on vector operations.
Copilot for optimising the calculations of new_dx,new_dy by splitting it apart.
Copilot also caught a few mistakes.

@lextra2

lextra2 commented May 17, 2026

Copy link
Copy Markdown

Unfortunately this does not improve anything for me #14459

VIDEO

Tested with PCSX2-windows-Qt-x64-avx2-clang-pr[14465]-sha[2d846ae]-title[GSHW Tweak AF shader] and DirectX 11

@JordanTheToaster

Copy link
Copy Markdown
Member

Unfortunately this does not improve anything for me #14459

VIDEO

Tested with PCSX2-windows-Qt-x64-avx2-clang-pr[14465]-sha[2d846ae]-title[GSHW Tweak AF shader] and DirectX 11

I've said before this won't do anything for shader stutter.

@lextra2

lextra2 commented May 17, 2026

Copy link
Copy Markdown

I've said before this won't do anything for shader stutter.

You replied with a rather cryptic it's being worked on and now I find a new PR that has some changes for the AF shader.

@JordanTheToaster

Copy link
Copy Markdown
Member

You replied with a rather cryptic it's being worked on and now I find a new PR that has some changes for the AF shader.

Because there is nothing concrete right now that I can tell you other than yes it is being worked on.

@lextra2

lextra2 commented May 17, 2026

Copy link
Copy Markdown

Because there is nothing concrete right now that I can tell you other than yes it is being worked on.

And how am I supposed to know that this wasn't the PR you were talking about?

@JordanTheToaster

Copy link
Copy Markdown
Member

And how am I supposed to know that this wasn't the PR you were talking about?

Because if it was what's being worked on it would be very obvious it was about reducing shader stutter :P

@lextra2

lextra2 commented May 17, 2026

Copy link
Copy Markdown

Because if it was what's being worked on it would be very obvious it was about reducing shader stutter :P

Well the PR doesn't say anything about shader stutters, but it is only logical to test it anyway, because this shader is what regressed the performance in the first place.

@TheLastRar TheLastRar force-pushed the AF-Small-Opt branch 5 times, most recently from fa1a3df to 4b42bb8 Compare May 23, 2026 17:01
@TheLastRar TheLastRar force-pushed the AF-Small-Opt branch 5 times, most recently from 0eb834b to 3347360 Compare June 3, 2026 19:32
@TheLastRar TheLastRar force-pushed the AF-Small-Opt branch 3 times, most recently from ab6a0b2 to 7ff8b00 Compare June 6, 2026 20:06
@TheLastRar TheLastRar marked this pull request as ready for review June 6, 2026 22:04

@lightningterror lightningterror left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rebase due to shader cache conflict.

@TheLastRar

Copy link
Copy Markdown
Contributor Author

Rebased

@lightningterror lightningterror left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smoke tested and aniso still works. Jordan reported around 7-12% fps increase.

@lightningterror lightningterror merged commit 9650c4b into PCSX2:master Jun 28, 2026
16 checks passed
@TheLastRar TheLastRar deleted the AF-Small-Opt branch June 28, 2026 20:53
jpolo1224 added a commit to ARMSX2/ARMSX2 that referenced this pull request Jun 29, 2026
…oggles, AF + 8x upscale

- GS: port PCSX2 PCSX2#14555 ROV revisions + PCSX2#14465 anisotropic-filter shader
  optimization (early isotropic fallback, cheaper math); bump ShaderCacheVersion
- Renderer: add Vulkan framebuffer-fetch (ROAA) accurate-blending fast path on
  Adreno via EnableAdrenoFramebufferFetch (default off, experimental) - the
  mobile-native equivalent of ROV, restart to apply, no effect on Mali/OpenGL
- Renderer: add ROV, Accurate Alpha Test, and HW AA1 toggles; raise internal
  upscale range to 8x
- GameDB: surface an on-screen notice when a game recommends Accurate Alpha
  Test or AA1
- TextureCache: port upstream Move correctness fix for destination-target match
- Controllers: fall back to the device's own vibration motor when the gamepad
  exposes no usable rumble actuator (#241; e.g. Odin 3)
- Skins: read newer per-side analog filenames (analog_stick_left/right);
  older single analog_stick + analog_base packs still import
- Settings: rename "Game Fixes" to "GameDB Fixes" for clarity
J1coding added a commit to J1coding/ARMSX2 that referenced this pull request Jul 2, 2026
Add the PCSX2 PR PCSX2#14465 sample_c_af anisotropic-filter function to the
Vulkan tfx.glsl and wire it into sample_c, gated on
PS_ANISOTROPIC_FILTERING > 1.

This fixes a silent no-op on the Vulkan backend: GSRendererHW already
sets PS_ANISOTROPIC_FILTERING from GSConfig.MaxAnisotropy for triangles
and hardware sampler anisotropy is disabled, so the shader path is the
active AF implementation — but the iOS Vulkan shader had no handler for
the macro, so anisotropic filtering did nothing. With sample_c_af in
place the setting takes effect, using the optimized early-isotropic-
fallback / cheaper-math form from PR PCSX2#14465.

Bumps SHADER_CACHE_VERSION 103 -> 104 so the Vulkan disk cache
invalidates and the new shader compiles. Metal is unaffected (it loads
a build-time metallib with no disk shader cache); the Metal AF path
remains a future item since upstream never produced a validated MSL
transcription of this shader.
jpolo1224 pushed a commit to ARMSX2/ARMSX2 that referenced this pull request Jul 3, 2026
Port a batch of graphics, DEV9, and GameDB correctness and stability
fixes from the shared core.

Texture replacement packs no longer crash when a pack declares an
off-by-one mip count (the DDS loader now clamps the level count to the
actual texture size). Vulkan pipeline-cache writes are atomic
(temp file plus rename), so a mid-write crash cannot leave a
half-written cache that some drivers then render garbage from. The
OpenGL program selector now compares shader keys instead of a
padding-inclusive memcmp, so identical selectors no longer recompile
every frame. TextureCache::Move refreshes the destination target's
buffer width when the incoming data exceeds it, fixing texture
corruption in titles that do move-based framebuffer expansion.

Add the software anisotropic filter to the Vulkan shader (PCSX2 PR
PCSX2#14465). The Max Anisotropy setting previously had no effect on Vulkan
because the shader had no handler for it; anisotropic filtering now
actually applies. The shader cache version is bumped (103 -> 104), so
the Vulkan disk cache is rebuilt on first launch after updating.

Add a DEV9 DNS fallback for iOS. The app sandbox has no
/etc/resolv.conf, so hostname lookup returned an empty list and every
DEV9 hostname failed; it now falls back to public resolvers and is
still overrideable via Network settings, so online and HDD games that
resolve hostnames can connect.

Cap the on-screen overlay scale at 2x so high-resolution screens do
not balloon the OSD, and show (ROV) / (Debug & ROV) in the GPU status
line when rasterizer-ordered rendering is active. Re-initialize the
focused window's navigation rect on resize so ImGui controller and
keyboard navigation keep working after a surface resize or orientation
change.

Sync GameIndex.yaml with the upstream refresh-experimental database
and add targeted title fixes: Jackie Chan Adventures EE/VU clamp
modes (stops Jackie falling through the floor after door transitions),
Ace Combat 5 / Zero partial texture preloading (avoids FMV hash-cache
stalls), Gran Turismo lens-flare / autoFlush / VU-clamp tuning, and
Burnout 3 memory-card cross-save filters. Add recommended AAT and AA1
GameDB hint fields. This is an upstream sync plus targeted title fixes,
not a large set of newly supported games.

Expose the global graphics and CPU round/clamp mode pickers in settings
to match the per-game options.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants