Commit graph

79 commits

Author SHA1 Message Date
Henrik Rydgård
c6084c16c3 Fix GLSL compilation issues on really old Adreno drivers.
They don't seem to accept unsigned integers as switch cases.

Fixes some stuff in #16295 , not sure if all of it.
2022-11-08 22:59:43 +01:00
Henrik Rydgård
87bd7aaccc
Merge pull request #16356 from lvonasek/cleanup_camera_control
OpenXR - Camera adjust using any controller
2022-11-08 12:28:44 +01:00
Henrik Rydgård
4e8f97d64d Output shader descriptions directly in the source code 2022-11-08 00:21:08 +01:00
Lubos
d1dabd40ee OpenXR - Disable range culling properly 2022-11-07 22:10:12 +01:00
Henrik Rydgård
0f37854ef9 Drop some D3D11 screen rotation support (was only used on Windows Phone) 2022-11-05 22:17:06 +01:00
Henrik Rydgård
ad6725b684 VK/D3D11: Move the rarely used "u_rotation" uniform to the frame uniform buffer.
This uniform is used in two cases:

* Non-buffered rendering in Vulkan, software transform
* Non-buffered rendering in D3D11 level 9 on Windows Phone, software transform
  - which I don't think anyone builds for anymore

Nice to not have it in the main uniform buffer, but mainly a
demonstrator/test of moving stuff to the new frame-global buffer, and
setting up the infrastructure.
2022-11-05 22:14:05 +01:00
Henrik Rydgård
96a5c52037 Vulkan: Reserve descriptor set 0 for frame-global data, move everything else to set 1 2022-10-28 09:39:56 +02:00
Henrik Rydgård
6d9008dab5 Fix validation issue with clears, remove redundant code 2022-10-27 11:05:59 +02:00
Henrik Rydgård
15d4495f76 Pass shadergen tests 2022-10-27 11:05:59 +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
d3804ec2e5 Misc multiview hackery 2022-10-27 11:05:58 +02:00
Henrik Rydgård
3af86ec6f7 Make it possible to specify extensions for Vulkan in the ShaderWriter 2022-10-22 17:46:57 +02:00
Henrik Rydgård
a830f18054
Merge pull request #16265 from unknownbrackets/lighting-nonormal
GPU: Respect world matrix and reverse flag w/o normals
2022-10-21 09:16:53 +02:00
Unknown W. Brackets
d23293ee72 GPU: Respect matrix and reverse flag w/o normals.
See frame dump in #14223, which requires world matrix be applied.
2022-10-20 23:15:25 -07:00
Henrik Rydgård
aa51bfd1ef Use GPU "use" flags to replace IsVRBuild in the renderer. It remains elsewhere. 2022-10-17 19:57:11 +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
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ård
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