Commit Graph
113 Commits
Author SHA1 Message Date
Henrik Rydgård daca0b2109 Rename gstate_c.Supports to gstate_c.Use 2022-10-17 08:46:37 +02:00
Unknown W. Brackets 3aa863ec41 GPU: Clip against neg Z even w/o cull support.
This should fix rendering issues on Apple devices.
2022-10-06 00:34:02 -07:00
Unknown W. Brackets bc3d3cf9fb GPU: Optimize clip distances needed.
We only need to write one clip distance to clip clamped depth, since we
don't clamp when it needs clipping on both sides.
2022-10-05 21:17:17 -07:00
Unknown W. Brackets 8025def8d2 Vulkan: Clip to neg z in the geometry shader.
This is only used when clip distance is unsupported, such as on Mali.
2022-10-04 22:10:24 -07:00
Henrik RydgårdandUnknown W. Brackets ac248338be Vulkan: Cull in geoshader, hack to on for now. 2022-10-02 07:42:17 -07:00
Unknown W. Brackets 59a489f883 Draw: Add COLOR1 semantic. 2022-10-01 12:14:46 -07:00
Unknown W. Brackets 34a8056017 GPU: Correct normalized zero normal proj map.
Unlike lighting, this does not use 0, 0, 1.
2022-09-26 15:11:11 -07: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 196f8e3461 Prepare for dynamic mat update 2022-09-26 11:21:40 +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 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. BracketsandGitHub 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