Commit Graph

80 Commits

Author SHA1 Message Date
b1d9e13d75 VideoCommon: prepare graphics mods for custom shader material data 2023-12-12 17:56:26 -06:00
5b112dbf2c VideoCommon: Fix GLSL uint handling in UberShaderPixel 2023-08-28 21:17:01 +02:00
931a8aa413 VideoCommon: add milliseconds elapsed time value to pixel shaders as a uniform to be able to support animation effects in custom shaders 2023-08-20 18:53:27 -05:00
4283d76718 VideoCommon: uber pixel shader gen changes needed to support custom pixel shaders in graphics mods 2023-08-20 18:53:27 -05:00
b969282b72 Remove out-dated hack of AMD driver issue WRT dual-source blending output index. 2023-08-15 23:58:29 -04:00
f25a0b43b6 VideoCommon: Fix stereoscopic 3D on OpenGL < 4.3 (macOS) 2023-02-14 18:25:33 +01:00
600ad5f498 VideoCommon: Better logic op invert approximation 2023-01-30 14:04:37 -06:00
9aece1810c Merge pull request #10836 from iwubcode/d3d_uint_fix
VideoCommon: fix uint shader compiler error when using d3d
2022-10-18 12:12:08 -04:00
546f9952a2 UberShaderPixel: Fix typo 2022-08-29 11:10:05 -07:00
5ef8a7973e BPMemory: Make TevKSel more clear
It stores both the konst selection value for alpha and color channels (for two tev stages per ksel), and half of a swap table row (there are 4 total swap tables, which can be used for swizzling the rasterized color and the texture color, and indices selecting which tables to use are stored per tev stage in the alpha combiner).  Since these are indexed very differently, the old code was hard to follow.
2022-08-29 11:10:05 -07:00
f21798b9b6 BPMemory: Use even/odd in TwoTevStageOrders instead of 0/1 2022-08-29 11:10:05 -07:00
637dca680c VideoCommon: update ubershader pixel to not enforce d3d when writing color output that has been defined as uints 2022-08-06 16:08:58 -05:00
716c0980d7 VideoBackends: Add Metal renderer 2022-07-21 20:44:19 -05:00
70b0b03c3c Merge pull request #10747 from tellowkrinkle/LateUIDFixup
Add a post-cache shader UID fixup pass
2022-07-17 00:43:16 -04:00
991024173e VideoCommon: Always use fbfetch in ubershaders if available
Reduce the number of different pipelines needed.  Also works around drivers that break when you combine fbfetch with dual source blending
2022-07-15 15:31:47 -05:00
6ab24e6c17 VideoCommon: Better driver bug handling
Adds a pass to process driver deficiencies between UID caching and use, allowing a full view of the whole pipeline, since some bugs/workarounds involve interactions between blend modes and the pixel shader
2022-07-13 21:51:24 -05:00
6bd0fc86ba VideoCommon: Properly mask fbfetch logic op emulation 2022-07-13 02:27:45 -05:00
cce6133ef6 Merge pull request #10749 from tellowkrinkle/IntelUbershaders
VideoCommon: Fix ubershaders on MoltenVK Intel
2022-07-10 19:35:55 -04:00
fac66897af Merge pull request #10819 from Dentomologist/fix_shader_compilation_warnings
VideoCommon: Fix D3D shader compilation warnings
2022-07-08 18:46:29 -04:00
71541c1324 VideoCommon: Fix D3D shader warning X4000 (uninitialized variables)
Initialize alpha_A and alpha_B. They were previously only initialized in
cases where they were used, but D3D isn't able to figure that out.
2022-07-08 00:25:14 -07:00
cad1d6ce90 VideoCommon: fix support of stereoscopic rendering after moving d3d to SPIRV generation 2022-06-24 18:09:53 -05:00
993fa3bf94 VideoCommon: update UberShaderPixel to properly support logic ops, matching the specialized shader 2022-06-24 18:09:53 -05:00
5dd2704416 D3D / VideoCommon: generate HLSL from SPIRV 2022-06-24 18:09:53 -05:00
c7892d7371 VideoCommon: Name ubershaders 2022-06-16 02:08:45 -05:00
25929789c1 VideoCommon: Don't pass State by inout
Spirv-cross's MSL codegen makes the amazing choice of compiling calls to inout functions as `State temp = s; call_function(temp); s = temp`.  Not all Metal backends handle this mess well.  In particular, it causes register spills on Intel, losing about 5% in performance.
2022-06-14 00:48:47 -05:00
259a5fc7c0 DriverDetails: Add broken discard with early-Z bug on Apple Silicon GPUs 2022-04-20 14:56:34 -04:00
80dfefb32e UberShaderPixel: Add support for non-dual source shader blending 2022-04-19 10:55:26 -04:00
abffa93a72 MoltenVK: Fix pixel shader typo 2022-04-10 20:51:20 +02:00
bbb64ff993 Shadergen: Use real_ocol0 workaround for shader logic ops
Previously we were using this workaround when using framebuffer fetch
to emulate dual source blending, but it seems like we also need to use
it when using framebuffer fetch to emulate logic ops, otherwise some
Adreno devices get a crash when compiling OpenGL ES ubershaders.

Using the workaround in specialized shaders doesn't seem to be
necessary, but I've made the same change there for consistency.

This gets us closer to fixing https://bugs.dolphin-emu.org/issues/12791
but doesn't actually fix it.
2022-02-28 18:32:19 +01:00
444f6fd0cb Treat alpha as 0 if alpha is 1 for blending
This removes the white box in fortune street again, without causing Mario Kart Wii to regress.
2022-02-08 15:15:15 -08:00
0327e6acb4 Use the same logic for lerp bias for color and alpha
It doesn't make sense for alpha to add the bias ONLY when dividing by 2, while color doesn't apply the bias for divide by 2 only; hardware testing indicates that alpha should have the bias.

This fixes the menus in Mario Kart Wii (https://bugs.dolphin-emu.org/issues/11909) but reintroduces the white rectangle in Fortune Street.

This reverts commit 5aaa5141ed (and several other matching changes elsewhere).
2022-02-08 15:15:15 -08:00
cc9ed4815d UberShaderPixel: Fix typo in fog calculation 2022-01-26 20:23:35 -08:00
b1f79d9ecf Merge pull request #10215 from OatmealDome/shader-logic-ops
VideoCommon: Support shader logic ops on Metal (Apple GPUs) and OpenGL ES
2021-12-22 16:39:54 -05:00
f53dc6564f UberShaderPixel: Convert to EnumMap 2021-12-18 12:51:55 -08:00
74a979db09 UberShaderPixel: Add shader logic ops support on OpenGL ES 2021-12-06 22:36:40 -05:00
a77ae14d94 UberShaderPixel: Add shader logic ops support on Metal 2021-12-06 22:36:40 -05:00
ddf2691395 VideoCommon: Manually handle texture wrapping and sampling 2021-11-17 20:04:34 -08:00
9ef228503a VideoCommon: Provide raw texdims to shaders 2021-11-17 20:04:34 -08:00
555a93057c VideoCommon: Allow BitfieldExtract in specialized shaders 2021-11-17 20:04:33 -08:00
a372a5947b VideoCommon: Fix color channel logic when per-pixel lighting is in use
This was broken in #10012 (specifically by 06579e4d53 and c3dec34391).
2021-10-13 20:43:32 -07:00
3b752c4d5d UberShaderPixel: Rename ApiType to api_type 2021-08-01 15:09:20 -07:00
2feced2e33 Fix indirect textures when format is not ITF_8 2021-07-08 15:48:14 -07:00
e149ad4f0a treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
2f1726e3f3 UberShaderPixel: always set tevcoord, even if the stage has no texture
This fixes NES game graphics when UberShaders are in use.
2021-06-21 13:01:25 -07:00
5928182a4c Skip indirect operation for out of bounds indirect stages
This fixes rendering issues in Viewtiful Joe (https://bugs.dolphin-emu.org/issues/12525), but it is not entirely hardware accurate, as hardware testing showed other, more complex behavior in this case.  However, it should be good enough for our purposes.
2021-05-27 22:13:42 -07:00
e1d45e9ba6 UberShaderPixel: always run indirect stage logic
Hardware testing has confirmed that fb_addprev and wrapping both run even when the indirect stage is disabled.
2021-05-07 16:37:47 -07:00
5e3360c2cc UberShaderPixel: Fix OOB tex coord indices
Previously we set the texture coordinate to zero, now we set
the texture coordinate *index* to zero. This fixes the ripple
effect of the Mario painting in Luigi's Mansion.
2021-05-07 16:37:47 -07:00
ed02034967 UberShaderPixel: Return fixed-point values from selectTexCoord
This change should have no behavioral differences itself, but allows for changing the behavior of out of bounds tex coord indices more easily in the next commit.  Without this change, returning tex0 for out of bounds cases and then applying the fixed-point logic would use the wrong tex dimension info (tex0 with I_TEXDIMS[1] or such), which is inaccurate.
2021-05-07 16:37:10 -07:00
002ff4e4dd PixelShaderGen: Remove unused num_texgens argument
It became unused in f039149198.
2021-05-07 16:28:08 -07:00
c3668e179c Split TevStageIndirect::mid into matrix_index and matrix_id 2021-05-07 16:27:52 -07:00