Commit graph

54 commits

Author SHA1 Message Date
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
f30252f8d5 Oops! Also, testfix 2022-09-25 23:35:08 +02:00
Henrik Rydgård
96f054f098 Fix light ubershader for D3D11 and OpenGL, GLES unsigned/signed stuff 2022-09-25 23:35:08 +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
Unknown W. Brackets
1e78f3aa57 GPU: Correct neg normal for hwtess texgen. 2022-09-21 22:06:32 -07:00
Unknown W. Brackets
a681d149db GPU: Use hardware tess params for texgen.
Fixes field in Test Drive Unlimited with hardware tessellation.
2022-09-21 21:15:58 -07:00
Unknown W. Brackets
f8d29fdc1a GPU: Simplify depth clamped clip planes.
There's no need to think about the scaled Z if we're using w anyway, just
use the existing Z clipping.
2022-09-20 16:23:19 -07:00
Unknown W. Brackets
2fc7f72d72 GPU: Clip clamped depth accounting for perspective. 2022-09-20 15:55:39 -07:00
Unknown W. Brackets
a2a7e8258b GPU: Clip depth properly when also clamping.
Helps situations like #11216, where only one side should be clamped.
Keeps depth clamp (i.e. #7932) working.  See #11399.
2022-09-18 13:18:02 -07:00
Henrik Rydgård
e56e5947d5 Vulkan: Declare gl_Position as invariant. See #11583
The code that computes shader outputs declared as invariant gets certain
optimizations disabled that could change the value - it makes it more
likely that different ways to do the same calculations end up with the same value.

This can help some types of Z fighting problems and similar.

Generally not a big deal for performance, plus, we're rarely vshader-bottlenecked...
2022-09-10 00:26:23 +02:00
Lubos
5b47d22afc OpenXR - Mismatch in stereo and normal uniform fixed 2022-09-04 21:27:48 +02:00
Lubos
81de46c978 OpenXR - Do not include lens projection in nonVR builds 2022-09-04 21:20:35 +02:00
Lubos
4ce0579f70 OpenXR - Split projection matrix for color and depth buffer 2022-09-04 21:12:18 +02:00
Lubos
4bd5a28604 OpenXR - Flag to easily disable multiview shaders added 2022-08-28 14:49:27 +02:00
Lubos
c2c0561be2 OpenXR - OPENXR ifdef removal 2022-08-27 17:33:37 +02:00
Lubos
4026d49104 OpenXR - Multiview uniforms working 2022-08-17 19:14:36 +02:00
Lubos
22e7f87e33 OpenXR - Disable multiview for now 2022-08-16 21:32:11 +02:00
Lubos
71df50a354 OpenXR - GL and OXR logging added 2022-08-16 17:39:54 +02:00
Lubos
ab6c91c203 OpenXR - Integrate multiview into system 2022-08-14 18:51:45 +02:00
Lubos
4814bed7df OpenXR - HUD support added 2022-08-02 20:58:16 +02:00
Henrik Rydgård
1fd80646cb Mali driver bug workaround for driver 32+.
See #15661

Hope this small bias won't break things.
2022-07-17 22:53:10 +02:00
Unknown W. Brackets
a181c9f7c4 unittest: Correct failing unit test.
Was just an invalid flag combination.
2022-01-29 12:22:11 -08:00
Unknown W. Brackets
142db5d61e GLES: Explicitly enable ARB_cull_distance. 2021-11-06 11:33:41 -07:00
Unknown W. Brackets
b3a8e013f6 GPU: Expand points into triangles for higher res. 2021-10-31 13:06:06 -07:00
Henrik Rydgård
3245f54dc1 Optimize the rotation a bit (limit to VK/D3D11, mat2 instead of mat4) 2021-10-31 13:44:54 +01:00
Unknown W. Brackets
b5a2afef76 D3D11: Fix fog in software transform. 2021-10-30 18:24:01 -07:00
Unknown W. Brackets
e688bb2cdf GPU: Correct software transform projection.
Now reading the new fog value.
2021-10-30 18:23:58 -07:00
Unknown W. Brackets
b87451de92 GPU: Restore rotation handling in sw transform. 2021-10-30 18:22:53 -07:00
Unknown W. Brackets
4e5ce403b5 GPU: Process proj matrix in sw transform.
Will need this to properly handle culling and clipping in software
transform.

Temporarily breaks display rotation handling (Vulkan/UWP.)
2021-10-30 18:22:53 -07:00
Unknown W. Brackets
030bfb1fb6
GPU: Fix missing newline in shader. 2021-10-26 06:54:03 -07:00
Henrik Rydgård
906a04f1fd Make sure to not leave cull distance uninitialized in other paths, if we do write to it in some path. 2021-10-26 09:56:38 +02:00
Unknown W. Brackets
275baccc5b GLES: Support GL_APPLE_clip_distance too.
Seems modern Apple mobile chips only support clip.
2021-10-12 20:34:44 -07:00
Unknown W. Brackets
33598f2e75 GPU: Support clip and cull distances separately.
Older GL devices, and it seems Apple devices, may not support cull.
2021-10-12 20:34:44 -07:00
Unknown W. Brackets
7b00c4a572 GPU: Move Z/W equal hack to bugs from supports.
It's really a bug (might even ideally cap the version?), and we already
have other bugs handled the same way.
2021-10-12 20:34:44 -07:00
Unknown W. Brackets
c6a52909f9 D3D11: Support vertex clip/cull planes. 2021-10-12 20:34:43 -07:00
Unknown W. Brackets
1a603fedf5 Vulkan: Cull verts fully outside depth.
Following PSP rules of -1 to 1 pre-viewport Z.  This also enables it for
GLES/OpenGL.
2021-10-12 20:34:43 -07:00
Unknown W. Brackets
7d00b6ca90 GLES: Enable/disable clip distance 0. 2021-10-12 20:34:42 -07:00
Unknown W. Brackets
2271b41d07 Vulkan: Use clip distance only if supported. 2021-10-12 20:34:42 -07:00
Unknown W. Brackets
273b9a3dc1 Vulkan: Add negative Z clipping. 2021-10-12 20:34:42 -07:00
Unknown W. Brackets
24011c3754 GPU: Correct depth handling for guardband.
This culls based on pre-viewport Z and avoids culling based on the clip
range at negative Z.
2021-10-12 20:34:41 -07:00
Henrik Rydgård
71707b5102 Fix bug in vertex shader generator. See #14260. 2021-03-05 12:32:06 +01:00
Unknown W. Brackets
64484a59e6 GPU: Normalize zero consistently in hw transform. 2021-02-28 00:05:10 -08:00
Henrik Rydgård
294f530cd0 Have the flat shading workaround obey the driver workarounds checkbox 2021-01-31 15:50:19 +01: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
7de7680416 Apple driver bug workaround. See issue #13451 2020-12-16 14:39:08 +01:00
Henrik Rydgård
7061993c8f VK: Restore the ARM Mali Z hack that got lost in the refactor somehow.
Warning fixes.
2020-12-14 19:54:39 +01: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
34efa1281b More consistent use of GLSL precision modifiers, now use them in Vulkan too.
Might help #13464 ?
2020-11-10 22:42:41 +01:00
Henrik Rydgård
733a152c54 Move ShaderWriter to Common/GPU, along with some stuff from ShaderCommon.h. 2020-11-04 09:18:35 +01:00
Henrik Rydgård
ce4ee010ac Apparently only MSVC can handle the ambiguity. 2020-11-02 11:45:47 +01:00