Commit Graph

90 Commits

Author SHA1 Message Date
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
Henrik Rydgård
8c56abd3dc Remove setting "Disable slower framebuffer effects" 2022-09-03 11:06:43 +02:00
Henrik Rydgård
fd6ab4c495 Avoid recomputing the shaderblend setup in ComputeFragmentShaderID. 2022-09-02 23:06:41 +02:00
Henrik Rydgård
de712b7804 More renaming 2022-09-02 22:20:11 +02:00
Henrik Rydgård
b84cda2876 Plumb the computed pipeline state into ComputeFragmentShaderID. 2022-09-02 22:16:57 +02:00
Henrik Rydgård
b529d26f3a Fix smoothed depal on GLES. Don't enable filtering if not using. 2022-08-24 13:43:41 +02:00
Henrik Rydgård
6558bde0f6 Remove SmoothedDepal compat setting, instead detect the ramp directly. 2022-08-22 15:24:41 +02:00
Henrik Rydgård
886679c7ec Remove the color-to-depth mode 2022-08-20 08:29:33 +02:00
Henrik Rydgård
131098c4d4 Some enum renaming, move RasterChannel to GPU.h. 2022-08-09 19:58:48 +02:00
Henrik Rydgård
90a44579bf Implement color-to-depth for Vulkan, start implementing for D3D11 2022-08-01 11:30:36 +02:00
Henrik Rydgård
f061eadc04 Initial implementation of 3D texturing through equal-size mips (see #6357)
Vulkan-only currently, though all the other backends except ES 2.0
without GL_OES_texture_3d can support it with some work.
2022-07-31 10:43:47 +02:00
Henrik Rydgård
c5a10a5501 Tweak the Mali stencil-test workaround to work for Surf's Up. See #15016 2022-07-11 16:57:52 +02:00
Henrik Rydgård
8922be2015 Out of performance paranoia, limit the Mali workaround to known affected games 2022-06-19 01:48:37 +02:00
Henrik Rydgård
d0ea3b3284 Work around the Mali stencil discard bug the same way as the Adreno one. 2022-06-18 14:23:09 +02:00
Henrik Rydgård
62808b89ef Fix discrepancy in how the LMODE flag is calculated between VS and FS 2022-05-03 00:06:42 +02:00
Henrik Rydgård
6b2dec91b5 Finish BlueToAlpha functionality 2022-04-30 18:17:17 +02:00
Henrik Rydgård
462972f7ea Add option to redirect blue to alpha if 565 mode is rendered and mask is 0x0FFFFF.
This is used by several games to render to the alpha channel of RGBA4444
images, which cannot normally be done directly on the PSP.

Can be used as a far more efficient replacement for
ReinterpretFramebuffers/ShaderColorBitmask
2022-04-30 18:17:16 +02:00
Henrik Rydgård
7be86264d0 Move framebufFormat to gstate_c, so we can override it 2022-04-30 18:16:09 +02:00
Henrik Rydgård
32df78a2cc Make the existing ReinterpretFramebuffers/ShaderColorBitmask path work for Split/Second
It took writing and debugging #15500 for me to understand what the issue with the old path was..

Much simpler alternative to #15500, or we could merge both but disable Split/Second
for this one. Needs some benchmarks I guess...
2022-04-25 00:11:09 +02:00
Unknown W. Brackets
2797e035df softgpu: Precompute lighting parameters.
In many cases, games use lighting just for diffuse or something, this
helps skip what's not needed too.  Good improvement in a scene from a
Naruto game.
2022-01-16 11:27:53 -08:00
Unknown W. Brackets
0b6e7c421f softgpu: Make decal tex func more accurate.
Tested for all values of A * B + 0 * (255 - B), as well as A * 127 + B *
(255 - 127), and matches accurately.  Spot checked other values, but not
exhaustively.
2021-12-05 13:34:19 -08:00
Unknown W. Brackets
24c77dc937 GPU: Fix matrix uvgen in software transform.
Fixes #15015.
2021-10-16 23:41:24 -07:00
Henrik Rydgård
5dab9994b6 Bezier/Spline: Fix logical error (must flush buffered data before we modify submitType).
Should fix #14774
2021-09-07 23:52:06 +02:00
Unknown W. Brackets
579482320d GPU: Revert stencil discard workaround change.
This reverts commit 0640ebb22d.

Apparently caused more problems than it solved.
2021-02-23 19:39:01 -08:00
Unknown W. Brackets
0640ebb22d GPU: Use stencil discard workaround w/o depth test. 2021-02-22 21:40:01 -08:00
Unknown W. Brackets
a73c15babc GPU: Correct shader gen with weights as floats.
For now, this supports the option.  We should probably just move to
everything being floats, but we already prefer software skinning.

Fixes #13903.
2021-01-10 08:52:28 -08:00
Henrik Rydgård
f3ebd6553d Turn off vertex range culling in bezier/spline calls.
When we do lower res tess than the real PSP, we cant trust the game to not cause range culling to kick in.

Fixes #11692
2020-12-13 16:04:16 +01:00
Henrik Rydgård
e14437cb3f OpenGL: Assorted shader-depal bugfixes and regression fixes.
Fixes #13517
2020-11-11 23:09:48 +01:00
Henrik Rydgård
6310af25fa Get shader color write masking going on all backends. 2020-11-08 23:45:47 +01:00
Henrik Rydgård
793e89d2e3 Fix some comments, rename a function. 2020-11-08 14:34:04 +01:00
Henrik Rydgård
3d289594f9 ShaderBlend and FramebufferRead are separate concepts. Reflect that in naming.
The former has forms that don't need to read the framebuffer.

This exposes that some logic is wrong...
2020-11-08 12:54:05 +01:00
Henrik Rydgård
0938d495d9 Remove a redundant bit from vertex shader IDs.
(complicates automated testing of shader generation)

Should have no noticeable effects.
2020-11-01 11:48:55 +01:00
Henrik Rydgård
0e3a84b4a8 Move most GPU things to Common.
It works after the move, on Windows and Android at least.

Deletes the D3DX9 shader compiler loader, which was not used.
2020-10-04 23:39:02 +02:00
Henrik Rydgård
c5e0b799d9 Remove category from _assert_msg_ functions. We don't filter these by category anyway.
Fixes the inconsistency where we _assert_ didn't take a category but
_assert_msg_ did.
2020-07-19 20:33:25 +02:00
Unknown W. Brackets
ac60e2ecd4 GPU: Track HW tess at start of frame too.
This also makes it so we don't force the setting off when you change
backends, and just ignore it if unsupported.
2020-04-04 11:52:32 -07:00
Unknown W. Brackets
cba6a63058 GPU: Generate normals for curves with lighting.
Improves #12354.  This needs to happen even if the vertex has no normals.
2019-09-28 15:08:37 -07:00
Unknown W. Brackets
af58577aff GPU: Better typesafety for shader bits.
See 128c0ad.
2019-02-16 06:54:56 -08:00