Skip to content

GS/DX11/GL: Expand the fb optimization hit detection.#14567

Merged
lightningterror merged 2 commits into
masterfrom
gs_aggressive_fb_opt
Jun 12, 2026
Merged

GS/DX11/GL: Expand the fb optimization hit detection.#14567
lightningterror merged 2 commits into
masterfrom
gs_aggressive_fb_opt

Conversation

@lightningterror

@lightningterror lightningterror commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

GS/GL: Expand the fb optimization hit detection.

GL: allows the same texture to be bound as an attachment or shader resource under the condition that only one operations is performed, we either only read from it or only write to it, so we can just check if we are actually writing to it which is enough.

Both DX11/GL: we can actually expand the hit detection even if either color or depth trigger a state change. This allows not the current but subsequent potential state changes to be avoided.
Also clean up the checks on dx11, only keep the texture comparisons themselves as they should be enough.

Rationale behind Changes

Optimizations.

Suggested Testing Steps

Test various games as a lot of games were hit, dump run only done on dx11, need to do gl.
dx11: Most see a single digit reduction, there are a few in double digits.

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

No.

Comment thread pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp Outdated
@lightningterror lightningterror changed the title GS/GL: Expand the fb optimization hit detection. GS/DX11/GL: Expand the fb optimization hit detection. Jun 9, 2026
@lightningterror
lightningterror requested a review from TJnotJT June 9, 2026 09:24
Comment thread pcsx2/GS/Renderers/DX11/GSDevice11.cpp

@TJnotJT TJnotJT 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.

Looks fine as far as correctness

@lightningterror
lightningterror force-pushed the gs_aggressive_fb_opt branch 2 times, most recently from 2438cf2 to 7491cd1 Compare June 10, 2026 10:11

@SternXD SternXD 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.

Tested in NFS MW 2005 and KH1 didn't see any issues

@lightningterror
lightningterror merged commit 16592f3 into master Jun 12, 2026
28 checks passed
@lightningterror
lightningterror deleted the gs_aggressive_fb_opt branch June 12, 2026 20:29
Hancock33 added a commit to Hancock33/batocera.piboy that referenced this pull request Jun 14, 2026
-----------------------------------------------------------------------------------
eden.mk 4edb1ac6c5de888c83d0c838f30a44e929742979 # Version: Commits on Jun 12, 2026
-----------------------------------------------------------------------------------
[common/fs] create XDG_DATA_{HOME,CACHE,CONFIG}_HOME if we are the first application to ever be ran or they dont exist for a reason (#4087)

-------------------------------------------------------------------------------------
hatari.mk c9906f10bc88b2ed57d5b01392a0c0c950a5b86b # Version: Commits on Jun 12, 2026
-------------------------------------------------------------------------------------
Rename JIT file to .cpp (not used in Hatari) (from WinUAE 6.1.0 beta8 2026/06/11),

----------------------------------------------------
pcsx2.mk v2.7.409 # Version: Commits on Jun 12, 2026
----------------------------------------------------
- [GS/DX11/GL: Expand the fb optimization hit detection.](PCSX2/pcsx2#14567)

-------------------------------------------------------------------------------------
ppsspp.mk 5d325290403006fc2b57f2488881f1cfd1463166 # Version: Commits on Jun 12, 2026
-------------------------------------------------------------------------------------
Merge pull request #21820 from fp64/vdot-fix

Fix VFPU dot bug,

-------------------------------------------------------------------------------------
snes9x.mk 2462dc98b288b66082ad57f8429cab2073f4108f # Version: Commits on Jun 12, 2026
-------------------------------------------------------------------------------------
Qt: Poll joysticks more often.,

-------------------------------------------------------------------------------------
vita3k.mk 985ac699c600277d5012ac06caa8212e6f5bf230 # Version: Commits on Jun 12, 2026
-------------------------------------------------------------------------------------
emuenv/app: Remove base_path (#4018),

---------------------------------------------------
nblood.mk r14355 # Version: Commits on Jun 12, 2026
---------------------------------------------------
-

----------------------------------------------------------------------------------------
openjkdf2.mk 02bc22e8d6104d744825fa0e448b340a5a46b62a # Version: Commits on Jun 12, 2026
----------------------------------------------------------------------------------------
Merge pull request #422 from bobberb/nix-flake-pr

Add nix flake for Linux build and dev shell,

----------------------------------------------------------------
wine-mono.mk wine-mono-11.2.0 # Version: Commits on Jun 12, 2026
----------------------------------------------------------------
Release 11.2.0.,

------------------------------------------------------------------------------------------
openbor7530.mk 8a36651101b2051392845fa6b5bcd3a5ccb59702 # Version: Commits on Jun 12, 2026
------------------------------------------------------------------------------------------
Add PAK64 support to borpak

- Add PAK64 archive format with 64-bit offsets and sizes

- Preserve legacy PACK output as the default format

- Add -6 and --pak64 options for large archive creation

- Auto-detect PACK and PAK64 during list/extract operations

- Improve malformed archive checks and path traversal protection

- Add clearer errors when legacy PACK exceeds 32-bit limits

- Remove mandatory Windows pause from normal terminal builds

- Add helper batch files for PACK and PAK64 creation,

---------------------------------------------------------------------------------------
vpinball.mk 8be49665164d9e80479df9349151580370607f48 # Version: Commits on Jun 12, 2026
---------------------------------------------------------------------------------------
ui: let floating ancillary windows be moved by dragging on Wayland (#2772)

On Wayland applications may not position windows themselves, so the

drag support of the display settings UI cannot work and the borderless

windows could not be moved at all. Declare them draggable there so the

window manager moves them when dragged anywhere. Other platforms keep

the settings UI drag (a full surface hit test would swallow the mouse

events it relies on and make the windows movable during play).,

--------------------------------------------------------------------------------------
yquake2.mk 4857b654e57154526e1471381d25bde7fec98899 # Version: Commits on Jun 12, 2026
--------------------------------------------------------------------------------------
game: make monster internal functions static,

---------------------------------------------------------------------------------------------
libretro-fbneo.mk 9723c47c2d782ccb8cf48f96568a89a44631e6ba # Version: Commits on Jun 12, 2026
---------------------------------------------------------------------------------------------
(libretro) update files,

--------------------------------------------------------------------------------------------------
libretro-gearcoleco.mk 09ab31b7b939e5fe32771d29a1a2a170f05b5887 # Version: Commits on Jun 12, 2026
--------------------------------------------------------------------------------------------------
Harden MCP HTTP transport configuration and authentication,

-------------------------------------------------------------------------------------------------
libretro-geargrafx.mk 7c51cfa4b4654e823da7f5a6be7e489979bce17d # Version: Commits on Jun 12, 2026
-------------------------------------------------------------------------------------------------
[debugger] Add option to pause on BRK #n,

--------------------------------------------------------------------------------------------------
libretro-gearsystem.mk ed2949d7e39d6085cfe5de9d3e32f70e354eee94 # Version: Commits on Jun 12, 2026
--------------------------------------------------------------------------------------------------
Harden MCP HTTP transport configuration and authentication,

----------------------------------------------------------------------------------------------------
libretro-parallel-n64.mk 324974795b925fea4b13fea96c446615d34f1868 # Version: Commits on Jun 12, 2026
----------------------------------------------------------------------------------------------------
rdp_emit: scale gSPModifyVertex XYSCREEN writes to the pipeline's form

The G_MWO_POINT_XYSCREEN case stored the command's two raw s10.2

halves into the vertex record's screen x/y, but this pipeline carries

screen coordinates as s10.2 << 14 (the triangle bridge reads them back

with >> 14 for the cross-product cull and quantizes to the quarter-

pixel grid from the same scale). Storing the halves unscaled collapsed

every patched vertex to screen (0, 0), so triangles built from them

were rejected as zero-area degenerates.

The New Tetris is the canonical victim: it draws each tetromino sprite

(the falling piece, the next queue, the hold box, the ghost, and most

HUD elements) as quads of four zero-position vertices whose screen

placement comes entirely from gSPModifyVertex, so all of them were

invisible. With the halves scaled into the record's form, the game's

boot, menus, and marathon gameplay verify pixel-exact against the cxd4

LLE stream, including the previously divergent shade alphas on patched

background geometry.,

----------------------------------------------------------------------------------------------
libretro-ppsspp.mk 5d325290403006fc2b57f2488881f1cfd1463166 # Version: Commits on Jun 12, 2026
----------------------------------------------------------------------------------------------
Merge pull request #21820 from fp64/vdot-fix

Fix VFPU dot bug,

----------------------------------------------------------------------------------------------
libretro-prboom.mk 061f9510746e67e8fc6cc66e6ac5b274bb89c489 # Version: Commits on Jun 12, 2026
----------------------------------------------------------------------------------------------
decorate: recolour custom projectiles via their Translation property

The female imps fire A_CustomMissile(\LowerImpBall\, ...), and LowerImpBall is

a custom projectile whose DECORATE Translation remaps the imp fireball's palette

(and which the engine previously ignored, firing the stock orange ball).  Parse

the Translation property into a 256-byte palette table, capture the projectile

class each A_CustomMissile names, resolve it to its table, and carry that onto

the fired ball so the sprite renderer recolours it.

Mechanically: a mobj gains a translation-table pointer and a vissprite an xlat

pointer; the sprite column path uses an arbitrary remap table when present,

beyond the handful of built-in player-colour translations.  The renderer

validates the pointer against the built-table storage so a stale vissprite slot

can never feed a wild table to the column drawer.  The mobj field is appended at

the end of the struct and zeroed across the savegame load path alongside the

other appended pointers, so a recycled heap block cannot leave it poisoned.

Vanilla behaviour and the demo hash are unchanged.,

----------------------------------------------------------------------------------------------
libretro-stella.mk 98cf11a548e26bcbdf54663243a79442b17bc42c # Version: Commits on Jun 12, 2026
----------------------------------------------------------------------------------------------
Fixes for minor warnings from clang-tidy.,
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.

4 participants