Commit Graph
171 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 7563b43818 Keep 5551 stencil marks when an EQUAL 0 test fails
ConvertStencilFunc5551 rewrites INCR to INVERT when the test is EQUAL 0,
which is only right where the test passed and the value is known to be 0.
It rewrote sFail too, so a pixel that failed against a set stencil got it
cleared again. Warriors Orochi 2 draws its sky in layers that each test
EQUAL 0 and INCR on pass and fail, so every other layer drew again over
the previous one and covered the mountains (#20867): 28650 -> 10285
pixels off the PSP on Vulkan and OpenGL. NOTEQUAL 0's INVERT to ZERO had
the same problem on sFail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:05:20 +02:00
Henrik RydgårdandClaude Opus 5.5 74991f96d3 Read the framebuffer for DOUBLESRCALPHA + DOUBLESRCALPHA blends in through mode
With alpha above 0.5 the dst factor goes past 1, which 2x alpha in the shader
clamps: Super Stardust composites its bloom at alpha 0xFF, doubling the dst,
and came out at 1x without the bloom brightening. Same through mode reasoning
as for DSTCOLOR + DOUBLESRCALPHA. Also fixes Ford Bold Moves Street Racing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 09:09:36 +02:00
Henrik RydgårdandClaude Opus 5.5 e05a3b29fb Read the framebuffer for DSTCOLOR + DOUBLESRCALPHA blends in through mode
The result is dst * (src + 2a), up to 3x the dst, which fixed function
blending can't reach: doubling alpha in the shader clamps it to 2x. MotorStorm
Arctic Edge and Tomb Raider Anniversary brighten their whole frame this way
and came out much too dark. Through mode draws are mostly full screen passes
that don't overlap themselves, so the framebuffer copy is safe there; 3D draws
keep the approximation (copies there caused overlap problems in Silent Hill).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 09:09:36 +02:00
Henrik RydgårdandClaude Opus 5.5 d0baab5614 Compute FIXA/FIXB blends like the GE
The GE's blend terms are floor((2c+1)(2f+1)/1024), which truncates, while the
hardware multiplies by f/255 and rounds, so every pass of a fixed color blend
chain came out up to a level brighter. God Eater Burst's bloom is many such
passes and ended up far too bright.

For additive FIXA/FIXB blends that aren't just 0 and 0xFFFFFF, the shader
now computes the src term exactly and lowers it by 0.5 - (2B+1)/1024, and the
blend constant is the GE's dst factor (2B+1)/512, so the hardware's rounding
of the sum lands on the GE's floor (except where the src term would go below
zero). Blend constants are passed as floats to make that possible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 09:09:36 +02:00
Henrik RydgårdandClaude Opus 5.5 d0e6174389 Apply the pixel masks to clears in the hardware backends
On the PSP the color and alpha/stencil write masks apply to clears like to
drawing (gpu/stencil/writemask, ppsspp-re geprobe exp254). Clear-mode draws
now take the same per-channel heuristic as other draws, and a clear with RGB
masked is drawn rather than done as a hardware clear.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 11:42:27 +02:00
Henrik RydgårdandClaude Opus 5.5 feaa41fadb Always emulate partial color write masks in the shader, drop ShaderColorBitmask
Partial red, green and blue write masks now always go through the shader with
a framebuffer read. Across the frame dump set this only improves games outside
the old list (Split/Second, Ultimate Ghosts 'n Goblins, older DiRT 2 and OutRun
dumps without a game ID). Partial alpha masks keep the old heuristic: alpha is
the stencil, with its own write mask, and taking the shader path for them made
Pro Yakyu Spirits and Gangs of London worse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 11:18:05 +02:00
Henrik Rydgård c320639016 Simplify the math. 2026-07-13 11:50:47 +02:00
Henrik Rydgård a2fb013cf6 ConvertViewportAndScissor: Have a nice clean path for the common case. 2026-07-13 11:48:00 +02:00
Henrik Rydgård 35010391a7 Correct framebuffer offset, after the refactor.
Fixes #21915
2026-07-13 11:43:30 +02:00
Henrik Rydgård 90c48671d7 D3D11: Remove support for BGRA textures and preferred framebuffer formats 2026-07-03 16:20:22 +02:00
Henrik Rydgård 5676e90896 Rename some stencil enums 2026-06-14 13:33:13 +02:00
Henrik Rydgård 5c340ccd09 Remove the concept of scaled/offset depth buffers. 2026-06-10 10:41:30 +02:00
Henrik Rydgård 7ced074154 Rearrange the texture status flags, rename Full alpha to Solid alpha for textures 2026-06-09 11:25:50 +02:00
Henrik Rydgård 116d91fcaa Viewport-scissor dirty state cleanup 2026-05-30 19:07:59 +02:00
Henrik Rydgård d849db6be5 Buildfix, remove redundant variable 2026-05-30 19:07:59 +02:00
Henrik Rydgård ae98055cec Delete a lot of legacy depth and viewport code, fix OpenGL 2026-05-30 19:07:58 +02:00
Henrik Rydgård 69c7c75124 Replace u_proj_through with a simple scale/offset
First reasonable output appears.
2026-05-30 19:07:58 +02:00
Henrik Rydgård 2233fd9f13 Minor simplification 2026-05-30 19:07:58 +02:00
Henrik Rydgård 732288c03a Brave Story: Hack to make the bloom effect run much more efficiently.
Fixes #19820

Not ready for merge, it needs more checks and maybe a compat flag.
2026-01-23 23:13:04 +01:00
Henrik Rydgård 67010ff2af Split the display layout config between landscape and portrait orientations 2025-11-05 12:49:51 +01:00
Henrik Rydgård f4beb585fd compat.ini: Add Crazy Taxi to list of games requiring buffered rendering. 2025-04-29 16:46:14 +02:00
Henrik Rydgård 8accc57df7 Avoid using shader blending (with framebuffer copy) if skip-buffer-effects is enabled
Fixes #20267
2025-04-17 19:18:59 +02:00
Henrik Rydgård bddd3c2a30 Minor stuff 2025-04-17 18:45:55 +02:00
Henrik Rydgård 70303ac212 Start reorganizing the Developer Tools screen code 2025-04-09 18:38:38 +02:00
Henrik Rydgård 50410d0de3 Comment on L.A. Rush blending problem 2025-04-09 11:58:31 +02:00
Henrik Rydgård c91169e702 Restore removed <algorithm> includes.
Turns out these were needed after all. For some reason, on Windows and
Mac, <algorithm> gets auto-included by something else so I don't notice
when it's missing, and MSVC's include dependency tracker doesn't see it
either.
2024-12-19 09:53:07 +01:00
Henrik Rydgård df6ed8cfc9 Do some cleanup of #includes in GPU 2024-12-18 13:57:26 +01:00
Henrik Rydgård 1221a6e928 Minor code cleanups 2024-10-28 17:50:34 +01:00
Henrik Rydgård 1b769b61b1 Fragment shader: Don't error on bad blend eqs, instead use default eq (add) 2024-10-25 21:54:57 +02:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Unknown W. Brackets b610e2f314 GPU: Handle invalid blendeq more accurately. 2023-09-23 13:08:25 -07:00
Henrik Rydgård d223d3c316 Rename CenterDisplayOutputRect to CalculateDisplayOutputRect 2023-04-02 22:29:08 +02:00
Henrik Rydgård 241f8e75bc Replace some uses of DepthSliceFactor 2023-02-11 14:37:48 +01:00
Henrik Rydgård 5bdbe6984c Simplify GetDepthScaleFactors 2023-02-11 13:34:08 +01:00
Henrik Rydgård d40aa17198 Remove ToScaledDepthFromIntegerScale 2023-02-11 13:27:44 +01:00
Henrik Rydgård 805591e493 Replace all uses of ToScaledDepthFromIntegerScale. 2023-02-11 13:27:44 +01:00
Henrik Rydgård 116b3ba8cc Increase precision of GetDepthScaleFactors to match ToScaledDepthFromIntegerScale 2023-02-11 13:27:44 +01:00
Henrik Rydgård 639ca31814 Address feedback 2023-02-11 11:23:00 +01:00
Henrik Rydgård 28a7912ae6 Add comments, re-enable remaining tests (they do work, just forgot to add expected values) 2023-02-11 01:11:02 +01:00
Henrik Rydgård 8d40684833 Make the test pass, add some commented-out failing ones 2023-02-10 14:57:48 +01:00
Henrik Rydgård d65dae7185 Depth scale functions: Clean up the naming, add a failing test 2023-02-10 14:57:45 +01:00
Unknown W. Brackets 08ac34bae0 GPU: Allow depth above 65535.
Hopefully it rounds down for any == or <= tests.
2023-01-31 18:41:06 -08:00
Unknown W. Brackets 98758573e3 GPU: Convert alphamask to FF/00 for 5551.
When masking via uniform, we don't care about the lower bits of alpha.
Games often use 7F / 80 to control writes of FF/00.
2022-11-12 17:41:48 -08:00
Unknown W. Brackets 745d9ad320 GPU: Avoid enabling depth test pointlessly.
See #16015.  Attempting to avoid a driver bug.
2022-11-08 20:06:08 -08:00
Henrik Rydgård 69941c0d72 Android fix 2022-11-06 20:01:22 +01:00
Henrik Rydgård 30aa07b156 Two more renames to make things read better 2022-10-17 08:47:05 +02:00
Henrik Rydgård 9b8a5d1db3 Rename GPU_SUPPORTS_ to GPU_USE_ 2022-10-17 08:47:03 +02:00
Henrik Rydgård daca0b2109 Rename gstate_c.Supports to gstate_c.Use 2022-10-17 08:46:37 +02:00
Unknown W. Brackets 162b27e136 GPU: Replace logic ops with blend for simple cases.
So that alpha/stencil are handled correctly.
2022-10-16 22:24:43 -07:00
Henrik Rydgård 85d1f28997 Throw in assorted warning fixes 2022-09-20 18:04:08 +02:00