Commit Graph

126 Commits

Author SHA1 Message Date
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
b4eecf3d5c Mali: Turn off any depth writes if depth test is set to NEVER. 2024-02-02 11:11:31 +01:00
Henrik Rydgård
6ce4933db8 Split the discard-stencil-bug flag into separate flags for Adreno and Mali 2024-02-02 11:11:31 +01:00
Herman Semenov
ca94de8d4b [GPU/Common/DX9/GLES/Software] Object out of scope optimization for better codegeneration (lower level scope) 2023-12-20 12:34:34 +03:00
Unknown W. Brackets
b610e2f314 GPU: Handle invalid blendeq more accurately. 2023-09-23 13:08:25 -07:00
Henrik Rydgård
f4b0cddda3 ShaderId: Safer way to check for backend. 2023-09-18 16:25:00 +02:00
Henrik Rydgård
946d4b6251 Avoid causing shader gen failures due to bad blend eq values 2023-09-18 16:12:27 +02:00
Henrik Rydgård
80e47b7bd3 Only dirty the uniform UVSCALEOFFSET when really needed
Broken out from #17479

With OpenGL, greatly reduces the amount of glUniform4fv calls in many games (and
similar in the other backends).
2023-05-25 15:00:57 +02:00
Henrik Rydgård
7178c0cd42 Restore fragmentshader ID flags double and texalpha. Add a ubershader mode that uses dynamic state. 2023-05-25 10:19:01 +02:00
Henrik Rydgård
b42670cf59 Manually revert the rest of the lmode optimization 2023-05-09 18:44:24 +02:00
Henrik Rydgård
0babac5c5f Manually revert "Remove LM flag from vshader too" (#16718)
Reverts #16718

Though maybe we can keep this one? Let's see.
2023-05-09 18:44:18 +02:00
Henrik Rydgård
f42c682d34 Revert "Merge pull request #16628 from hrydgard/remove-fog-fshader-flag"
This reverts commit 10dee90c83, reversing
changes made to 34c11c8acf.
2023-05-08 22:01:38 +02:00
Henrik Rydgård
3d376b0ab7 Remove the rather redundant DoTexture flag from vshaders.
Slightly reduces the number of unique vertex shaders but doesn't do much
for the pipeline count, as the fragment shader has a tex flag. Still
worth doing for the simplification.
2023-01-11 14:16:46 +01:00
Henrik Rydgård
088d0c39dc Remove the FS_TEXTURE_AT_OFFSET fragment shader flag 2023-01-10 12:37:21 +01:00
Henrik Rydgård
c7c48abb37 Switch the 2x flag to a uniform 2023-01-10 12:36:28 +01:00
Henrik Rydgård
d4ce134292 Shader generator: Move FS_TEX_ALPHA to a uniform bool.
Part of #16567
2023-01-10 09:42:54 +01:00
Henrik Rydgård
a58bf45540 Removes LM flag from vshader in the common case, if ubershader is enabled. 2023-01-05 13:09:49 +01:00
Henrik Rydgård
389c7bf44c FragmentShaderDesc improvement (debugging) 2023-01-05 11:49:03 +01:00
Henrik Rydgård
18d00b0718 Remove lmode flag bit from fragment and geometry shaders 2023-01-04 11:04:23 +01:00
Henrik Rydgård
10dee90c83
Merge pull request #16628 from hrydgard/remove-fog-fshader-flag
Make fog-enable driven by uniform instead of fragment shader flag bit
2023-01-04 11:01:19 +01:00
Henrik Rydgård
26c748f959 Make fog-enable driven by uniform instead of fragment shader flag bit 2023-01-04 10:14:11 +01:00
Henrik Rydgård
f069de2dd2 Pass the vertex decoder into the vertex shader IDs generator
Instead of just the vertex type.

This will allow things like the vertex decoder supplying defaults, in
order to reduce the number of unique vertex shaders at the cost of
slightly larger vertex data.

This doesn't actually do that yet though, it's just a refactor that can
be done separately.

Part of #16567
2022-12-30 22:57:05 +01:00
Henrik Rydgård
61eaa4ea2d Just a very minor optimization 2022-12-27 17:15:31 +01:00
Unknown W. Brackets
106d730a20 GPU: Optimize out common case texture proj.
NFS Most Wanted 5-1-0 uses this when it could use uv scale/offset.
2022-12-01 23:20:25 -08:00
Henrik Rydgård
d72ad3b3f4 Fragment shader generator: Move the framebuffer fetch bit to the shader ID.
Will resolve a future issue in the multisampling PR, where the
GPU_USE_FRAMEBUFFER_FETCH flag changes at runtime if you switch between no AA and MSAA.

Just figured I'd get it in separately for safety.
2022-11-30 00:26:15 +01:00
Henrik Rydgård
7eee7f2573 Fix shader debug description issue. 2022-11-23 15:41:20 +01:00
Unknown W. Brackets
6c36f03a0d GPU: Purify vertTypeIsSkinningEnabled(). 2022-11-06 08:40:54 -08:00
Henrik Rydgård
e058f8aee6 Shadergen fix for OpenGL 2022-10-27 11:05:59 +02:00
Henrik Rydgård
cd203291ba Fix rendering in non-stereo mode 2022-10-27 11:05:59 +02:00
Henrik Rydgård
0de12f5ca9 Some refactoring of framebuffer views, layer issues, more work. 2022-10-27 11:05:58 +02:00
Henrik Rydgård
2e87f0bc0b More work. Things are starting to work now. 2022-10-27 11:05:58 +02:00
Henrik Rydgård
fb250c4b29 More multiview work 2022-10-27 11:05:58 +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
Henrik Rydgård
a605366254 Add ShaderId utility function to be used for some sanity checking. 2022-10-13 22:39:47 +02:00
Unknown W. Brackets
3e5c09d432 Vulkan: Clip clamped depth in geometry shader.
This corrects deformed geometry on Mali devices which don't support
user-space clipping but do support depth clamp.
2022-10-05 19:41:59 -07:00
Herman Semenov
29b87e0c0b
Merge branch 'master' into master 2022-10-03 07:49:13 +00:00
Unknown W. Brackets
d16caa71af Vulkan: Add geometry shader ID tracking.
We're still not generating them, yet.  But this tracks the objects and
IDs through the pipeline.
2022-10-02 07:42:16 -07:00
lainon
c953bf7fc7 Fixed bug and memleaks 2022-09-30 12:32:49 +03:00
Henrik Rydgård
07ca9e4656 Fold the "materialUpdate" flag into the light ubershader part.
This reduces the number of vertex shaders and thus pipelines by quite a
bit more in a few games, like Tekken and GoW, continuing the fight
against shader compile stutter.

The perf impact should be minimal if not positive due to less pipeline
changes.

GLES fixes

Make the vertex input declarations match (always declare fog input).  Fixes D3D11 validation

Tess fix
2022-09-26 12:06:16 +02:00
Henrik Rydgård
ad1021ea4b Add some recent flags to FragmentShaderDesc 2022-09-26 12:06:16 +02:00
Henrik Rydgård
9d1355e137 Always do the vertex shader part of the fog computation.
In #16104, we drastically reduced the number of shader variants for
games that use flexible lighting setups. I looked at a few games and it
seems that a lot of games have the same shaders with fog on/off, while
fog is super cheap to compute. So let's just always do it, reducing
vertex shader variants further (though the amount of pipelines will probably
remain the same, since we still specialize the fragment shader).

Might also be worth adding a dynamic bool for the fragment shader, but
if so, doing it separately.
2022-09-26 09:30:54 +02:00
Henrik Rydgård
7adba20fac Experiment: Generate "Ubershaders" that can handle all lighting configurations
This drastically reduces the shader compile stutter that happens when a lot of new
light setups are created, like on the first punch in Tekken 6.

There's more stuff that might benefit from being made dynamic like this.
These branches are very cheap on modern GPUs since they're branching on
a uniform variable, so no divergence.

Only tested on Vulkan. I think we'll need to keep the old path too for
gpus like Mali-450...
2022-09-25 23:35:01 +02:00
Henrik Rydgård
4045de8d56 Consider the Adreno and Mali stencil-discard bugs the same. Use the better check from the Mali bug.
Should fix #11980
2022-09-18 10:34:43 +02:00
Henrik Rydgård
8d00df12a4 Detect the CLUT8/8888 situation
Implement CLUT8 depal from 8888 textures. Hard to tell if working
2022-09-14 22:18:34 +02:00
Henrik Rydgård
694dbe1271 Add ShaderDepalMode enum, use in shader ID. Replaces smoothed bit. 2022-09-11 14:40:01 +02:00
Henrik Rydgård
8194bb73a1 Turn on logic ops in shader when shader bitmasking is used. 2022-09-04 11:43:36 +02:00
Henrik Rydgård
2474eb6a72 Shader bit setup and code generation for logic-ops-in-shader 2022-09-04 11:14:47 +02:00
Henrik Rydgård
d35749bfc8 Move the computation of simulate-logic shader type earlier 2022-09-04 00:10:55 +02:00
Henrik Rydgård
87b14fe1c2 Some more renaming and refactoring, extracted from a future PR 2022-09-04 00:10:55 +02:00