Commit Graph

184 Commits

Author SHA1 Message Date
lightningterror 1a3d77b2c0 GS-hw: Fix d3d11 depth sample shader.
Also adjust some comments to match updated shader names.
2022-02-18 19:21:01 +01:00
lightningterror 06766ddb98 GS-hw: Don't wrap on 16bit destination format for blend mix.
Helps Dog's Life blending, we shouldn't wrap as we do more blend math afterward which will be wrong if we wrapped before.
2022-02-18 19:00:54 +01:00
lightningterror 7151848406 GS-hw: Rename alpha_clamp to blend_mix. 2022-02-18 19:00:54 +01:00
Connor McLaughlin dfe4bc199f GS/HW: Use integers for depth conversion shaders
Fixes z-fighting in reflections in DBZ BT3, maybe others?
2022-02-15 10:41:37 +01:00
refractionpcsx2 d4b1d9abe5 GS-hw: Increase 32->16bit conversion accuracy
Improves Dogs life (no longer goes completely black right away, but has decal problems)
Vastly improves texture quality in Spider-Man 3 when using Framebuffer Conversion to fix the textures
2022-02-14 14:50:21 +00:00
refractionpcsx2 ad415945a6 GS-hw: Apply clamp/wrap when FBMask enabled 2022-02-11 19:33:38 +01:00
Connor McLaughlin 2684fd6b62 GS: Add depth copy convert shader 2022-02-03 15:20:35 +00:00
lightningterror 3ca4272230 GS-hw: Implement hw, hw/sw, sw blending on Ad when alpha write is masked.
Idea is to replace Ad with As when alpha write is masked,
then expand/let blend mix, accumulation blend non recursive blend or hw clr blend to
do the blending with Ad swapped as As.

We are doing this to try to bring some originally higher blending modes to lower levels
where we can do the draws with less texture barriers instead (gl/vk),
as for d3d11 this allows to run blending on the draws since previously the cases weren't handled properly,
it will be slower on d3d11 since we will be reading the frame buffer but it's better than nothing.

D3D11: It is enabled on Medium blending or higher, if draw is fbmask then it will enable
it on basic blending too.

OpenGL/Vulkan:
It is enabled based on the previous blending modes:
accumulation blend -> either minimum or basic level, depending on colclamp.
non recursive blend -> either minimum or basic level, depending on colclamp.
blend mix -> basic and higher level.
hw clr blend -> minimum and higher level.

All:
Prefer full sw blend when primitives don't overlap, sw fbmask or full barrier is used, it is more accurate.
2022-02-03 01:11:08 +01:00
lightningterror ae14afd5f7 GS-hw: Combine BLEND_C_CLR2_AF and BLEND_C_CLR3_AS in one shader bit.
Free a shader bit.
2022-02-03 01:11:08 +01:00
TellowKrinkle 6d0b9b3747 GS:HW: Don't scale rt when converting to texture
Scale texture coordinates instead
2022-02-01 01:24:35 +00:00
Connor McLaughlin f33ee27f56 GS: Get rid of extra binding for channel shuffle
Having this binding was redundant, as there's no "normal" texture
sampled when we're doing a channel shuffle, and it caused issues in
Vulkan when the render target or depth buffer the source.

Also fixes the Urban Chaos HLE shader.

Fixes validation errors in GT4, NFS: Carbon, Urban Chaos, probably
others too.
2022-01-30 14:17:12 +00:00
lightningterror 3b691da8d1 GS-hw: Implement alternative hw blending for Cs*Ad, Cs*Ad + Cd, Cd - Cs*Ad.
Alpha destination value is wrong so let us try to compensate.

Multiply Cs by (255/128) in shader.
Will work best if Cs is 0.5 or less,  if it's higher than 0.5 then the closer to 1 the less accurate it gets.

Ofc it is best to use sw blending but it will help if sw blending is not present/selected for specific draw, will help d3d11 quite more.
2022-01-27 12:09:35 +01:00
lightningterror c9216e5625 GS-hw: Remove useless shader line from CLR As/Af case. 2022-01-24 11:42:54 +01:00
lightningterror 93af9656d0 GS-hw: Fix clr 1 case shader.
Forgot to rename.
2022-01-24 11:11:38 +01:00
lightningterror 4ab9d1a493 GS-hw: Implement alternative hw blending for Cd*As, Cd*F.
Do hw blend for Cd*As, Cd*F, expand the clear color blend method as it is almost the same.

Most helpful for dx11 ofc, for gl/vulkan will help with rendering on lower
levels of blending without needing a barrier.
2022-01-23 20:59:35 +01:00
lightningterror 3c92054a6e GS-hw: Move PABE shader bit to the top of sw blending.
Early return when there is no sw blending, no need to run the blend code.
Optimization.
2022-01-11 13:15:56 +01:00
Connor McLaughlin 0f5b17de0f GS/DX11: Implement automatic/manual LOD in pixel shader 2022-01-11 12:30:11 +01:00
Connor McLaughlin 68f18245a7 GS/DX11: Implement merge feedback write 2022-01-09 16:35:34 +01:00
Connor McLaughlin 1a8a5a5e8e GS: Add Vulkan renderer 2022-01-08 05:19:45 +00:00
Connor McLaughlin 0c36647506 GS: Rewrite presentation interface and OSD 2022-01-02 15:06:39 +00:00
Connor McLaughlin 2330d3a056 GS: Use hardware point/line expansion where supported in GL 2022-01-02 15:06:39 +00:00
Connor McLaughlin bce54a64ff GS: Use flat/nointerpolation for IIP=0 instead of GS 2022-01-02 15:06:39 +00:00
lightningterror 6a431daffc GS-hw: Extend Blend mix to work when alpha is higher than 1.
Clamp the alpha(As/Af) to 1 in the shader, it is already clamped to 1 in hw blend unit.
It should allow to better render the effects, still not fully accurate but it's closer to what we want.
Hopefully it helps D3D11 more.
2021-12-27 20:22:41 +01:00
Connor McLaughlin a2ae4ba441 GS/OpenGL: Get rid of interface blocks for convert shaders 2021-12-26 13:21:51 +00:00
Connor McLaughlin 4e1b2792c9 GS/OpenGL: Move some uniform buffers to program uniforms 2021-12-26 13:21:51 +00:00
Connor McLaughlin 6e064da536 GS/OpenGL: Use programs instead of separate pipelines 2021-12-26 13:21:51 +00:00
Sergeanur 21bc56a8ba GS: Simulate scan mask 2021-12-26 11:51:25 +00:00
Connor McLaughlin efed92b15c GS/OpenGL: Move scaling factor to shader constant 2021-12-22 11:41:57 +01:00
Connor McLaughlin 08c00eed1e GS: Unify constant buffers between renderers 2021-12-22 11:41:57 +01:00
lightningterror 9368e29d62 GS-d3d11:fx: Flip x and y dithering positions. 2021-12-19 22:24:30 +01:00
TellowKrinkle ae8751e9ca GS:DX11: Use GSHWDrawConfig selector structs 2021-12-19 22:21:10 +01:00
TellowKrinkle a11b8c4750 GS:OGL: Use GSHWDrawConfig selector structs 2021-12-19 22:21:10 +01:00
TellowKrinkle 962db4bfc4 Resources: Move fxaa.fx to out of dx11 directory
It was used by both DX and OGL
2021-12-12 06:10:47 -06:00
TellowKrinkle da651cabe4 Resources: Move shaders to shared shader/ directory 2021-12-12 06:10:47 -06:00