Commit Graph

118 Commits

Author SHA1 Message Date
refractionpcsx2 256babd337 GS/HW: Allow forcing Dither to 32bit for 16bit draws 2024-05-25 02:13:33 +01:00
Stenzek aa48256010 GS/HW: Round alpha values for indexed sample of RTA 2024-04-28 17:40:20 +02:00
lightningterror d824ae6e0c GS/HW: Extend blend second pass to more blend formulas.
`Cs + Cd*Ad, Cs - Cd*Ad, Cd*(1 - Ad), Cs*(1 + Ad), Cs*(1 - Ad).`
2024-04-23 02:00:02 +02:00
lightningterror 7dd7345e08 GS/HW: Minor shader optimization.
Use saturate instead of min max, saturate is faster than min max.
2024-04-21 15:10:53 +02:00
refractionpcsx2 30f4e77b31 GS/HW: Rearrange color on shuffle if SW Blend or TFX 2024-04-08 12:09:30 +01:00
lightningterror b1f4f67130 GS/HW: Add support for blend second pass.
Allows us to blend Cd with full alpha range of 0-2 bypassing hw blend limitations.
Not all Cd cases are covered, but it's a good start.

Also allows us to do Ad cases where we can double the blend to get the
proper blend result since Ad range is 0-1 instead of 0-2.
2024-04-07 20:04:50 +02:00
refractionpcsx2 effdfd5a22 GS/HW: Fix up some RTA behaviour and reduce copies 2024-04-02 21:48:32 +01:00
Stenzek a317e9c038 GS/HW: Improve accuracy of RGB_ONLY AFAIL
Instead of breaking the draw into two passes, which breaks when
fragments overlap each other and blending is enabled, use blending to
leave the value of Ad intact when a pixel fails the alpha test.

In the case of DATE being enabled, prefer PrimID over stencil, as since
we are changing Ad on a per-fragment basis, with some fragments not
being modified, stencil DATE will become desynchronized with the value
of Ad.
2024-03-28 11:46:20 +10:00
Stenzek 0917d49a01 GS: Remove separate alpha pass fallback
This is just wrong when overlap and depth writes are involved.
2024-03-28 11:46:20 +10:00
refractionpcsx2 059ec49389 GS/HW: RTA improvements and enhancements 2024-03-25 17:58:12 +00:00
refractionpcsx2 4ba43b8496 GS/HW: Improve channel + texture shuffle detection and processing 2024-03-24 11:38:33 +00:00
refractionpcsx2 bfef8397d6 GS/HW: Allow source is rt to use corrected alpha in most cases. 2024-03-17 17:24:39 +01:00
lightningterror 3a2888a5d5 GS/HW: Adjust RTA shader precision. 2024-03-17 17:24:39 +01:00
lightningterror 0900c2fd8b GS/HW: RTA Correction, implement on DATE.
Less copies, and makes it work with DATE.
2024-03-17 17:24:39 +01:00
lightningterror 58628b8dd3 GS/HW: Make sure we don't multiply Cs if Ad is corrected.
Another potential to avoid copies.
2024-03-17 17:24:39 +01:00
lightningterror 71376ff4e6 GS/HW: Decorrect Ad on sw blend in tfx shader.
Otherwise if we do decorrection in covert shader we add more copies.

Also make sure to decorrect for fbmask, tex is fb.
2024-03-17 17:24:39 +01:00
lightningterror 6c9f132093 GS/HW: Add support for Ad (RTA) correction.
The idea is to adjust the alpha destination for more
accurate hw blending which will work on all renderers.

Old behavior has Ad in range within 0-1 whereas for blending 0-2 is needed.

copy rt -> adjust the alpha -> copy back the adjusted alpha-> restore old alpha after blending is done
2024-03-17 17:24:39 +01:00
lightningterror a7c5eebf99 GS/HW: Adjust blend mix for impossible blend.
Since we can't do Cd*(Alpha + 1) - Cs*Alpha in hw blend what we can do is adjust the Cs value that will be subtracted,
this way we can get a better result in hw blend. Result is still wrong but less wrong than before.
2024-03-14 16:16:11 +01:00
lightningterror c0e47767b7 GS/HW: Adjust dither on Blend Mix when Cs-Cd * Af blend. 2024-03-10 23:41:18 +00:00
refractionpcsx2 65649b3cbb GS/HW: Adjust dither on Blend Mix when Cs-Cd * As blend. 2024-03-10 23:41:18 +00:00
refractionpcsx2 4b88256df2 GS/HW: Allow palette lookups from depth and deswizzle manual deswizzles 2024-02-01 00:13:39 +00:00
refractionpcsx2 badede2e2d GS/HW: ignore lower 3 bits of 16bit color for AEM check 2024-01-15 14:45:00 +00:00
refractionpcsx2 01842a3c6b GS/HW: Allow blending on normal shuffles 2024-01-09 13:17:52 +00:00
Stenzek d9abe10308 Misc: Remove explicit PCH include, switch to SPDX 2023-12-24 14:03:14 +10:00
lightningterror 96831b0970 GS/D3D: Fix X3206 CAS shader warning.
Warning X3206: implicit truncation of vector type warning fix.
2023-12-15 15:40:31 +01:00
lightningterror f96e7a9156 GS/HW: Rename dfmt to dst_fmt.
It was confusing whenever the d meant depth or destination, this should make the code easier to read.
2023-10-19 19:25:13 +02:00
refractionpcsx2 5dc27ed275 GS/HW: Convert depth16->rgba16 shader to integer 2023-10-01 21:08:39 +01:00
lightningterror 7fadb6ed05 GS/HW: Cleanup texture shuffle shaders. 2023-08-11 15:23:50 +01:00
lightningterror 713bd132dc GS/D3D: Add initial support for complex shuffles. 2023-08-11 13:14:19 +01:00
Stenzek ff9ca059c7 GS/DX11: Require feature level 11.0
Feature level 11.0 GPUs were first released in 2009, almost 14 years ago
now. Older GPUs have not had drivers released in a long time, and are
known to be buggy.

None of us have hardware this old, so it's impossible for us to support
it.
2023-07-29 22:28:49 +10:00
Stenzek 784118e9c1 GS/HW: Don't drop fractional colour before modulating
Fixes banding in Xenosaga, Tales of the Abyss, Beyond Good and Evil.
2023-07-28 16:31:35 +01:00
lightningterror 3dce969a5e GS-shaders: Add missing copyright headers. 2023-07-21 10:24:15 +02:00
lightningterror 65a3a97ab2 GS-d3d: Fix initialization shader warnings. 2023-07-16 12:45:42 +02:00
KrossX 32aa24f6fd GS: Add fancy downsampling shaders. 2023-07-09 14:04:06 +01:00
Stenzek 02f3279dec GS/HW: Get rid of padding in present UBO
It was adding additional padding, which blew the block size out.
2023-06-11 13:02:36 +10:00
Stenzek 7f7dd60587 GS/HW: VS expand instead of GS for DX/GL/Vulkan 2023-04-13 11:12:11 +01:00
Stenzek f569ad0970 GS/HW: Allow translating targets for depth sources
Fixes broken half screen in Miami Vice and 10 Pin - Champions Alley.
2023-04-09 17:56:49 +01:00
Stenzek 398cf43782 GS: Combine HostDisplay with GSDevice
GS/DX11: Don't throw bad_alloc on surface creation fail

GS: Link device and host display construction/destruction

FullscreenUI: Replace HostDisplayTexture with GSTexture

GS: Purge HostDisplayTexture

GS: Move everything in HostDisplay to GSDevice

GS: Move ImGui rendering to GSDevice

GS: Get rid of reset/store API state
2023-04-06 08:48:07 +01:00
Stenzek faecc6913b GS/HW: Texture cache improvements
GS/HW: Only use temporary source for recursive draw

.. and don't insert it into the page map.

GS/HW: Lookup page list for depth sources

GS/HW: Avoid target copies by using shader sampling

GS/HW: Make texture cache a global pointer

GS/HW: Remove GetID() from GSTexture

It only made sense for OpenGL, was always zero in Vulkan.

GS/HW: Rewrite texture sampling hazard detection

Also avoid redundant channel shuffle setup.

GS/HW: Turn Haunting Ground CRC into an OI fix
2023-03-30 21:55:50 +01:00
Stenzek 6ad222117d GS: Reduce MAD buffering draw size
It's silly to draw to the whole double-sized render target, but discard
half the pixels.

Also centralizes the constant setup, get rid of the duplication.
2023-03-19 23:31:37 +00:00
Stenzek b26acad721 GS: Sample LOD 0 explicitly in interlace shaders
Can't use normal sampling because the derivates are undefined in
non-uniform control flow (in MAD).
2023-03-19 23:31:37 +00:00
Stenzek 435e73d838 GS/HW: Texture cache improvements
Change texture scale from vector to scalar

 - Independent X and Y scaling is long gone.
 - Also separate size and scale in TC lookup

Move clear value for texture to base class

Align heights to page size

 - Since FRAME and Z are in page units, we can't have two targets
 - overlapping within the same page.
 - Stops some small resizes too.
 - Test cases: Genji and Spider-Man 2 shadows.

Don't modify target TEX0 on shuffle/clear

Move upscale multiplier to uniform

Make P8 conversion page-aware

Fix incorrect depth preload shader

Improve HLE of texture shuffles

When a texture shuffle is split into two half-screen draws, we skip the
first, and draw the whole thing in the second, taking care of when both
the texture and framebuffer are offset.
2023-03-13 20:29:05 +00:00
lightningterror 06aed8491c GS-hw: Separate the Alpha masked Ad case from blend hw bit.
Allows for cleaner code.
2023-03-11 20:44:11 +01:00
lightningterror 62497b9300 GS-hw: Rename PS_CLR_HW to PS_BLEND_HW shader macro. 2023-03-11 20:44:11 +01:00
lightningterror 59aba9f757 GS-hw: Support Ad masked alpha on blend mix 1 and 2 clr cases. 2023-03-09 21:08:52 +01:00
lightningterror 911d35e800 GS-hw: Fix invert rounding for accumulation blend on gl.
Also make the checks consistent for all renderers.
2023-03-06 23:36:54 +01:00
lightningterror e8cf4822b1 GS-d3d: Automatically adjust color compensation based on rgb value for hw blend clr3 case.
Auto adjust when any color is higher than 128 ( 1.0f) to get more accurate color results.
2023-03-06 19:49:27 +01:00
lightningterror f478b3959c GS-d3d: Add clr3 case for blend mix 2.
When Cs*(Alpha + 1) overflows compensate with adjusting Alpha output for Cd*Alpha.
2023-03-03 16:35:10 +01:00
TellowKrinkle 7781907f0e GS: Blend truncation and dither goes the other way when subtracting
Truncation happens after subtraction, so it's the equivalent of rounding the value to subtract *up* instead of down
2023-02-26 07:22:32 +01:00
lightningterror 7f7950cd6b GS-d3d: Check each channel individually if it overflows and do corrections. 2023-02-24 02:06:00 +01:00