Commit Graph

77 Commits

Author SHA1 Message Date
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
Unknown W. Brackets
9fcc1509e4 GPU: Correct depth clip/cull for zero scale. 2023-03-05 08:51:45 -08:00
Henrik Rydgård
8b431b39ba
Wrap the display globals in a struct (#16998)
* Wrap the display globals in a struct

Makes it easier to search/replace these, for future refactorings.

* Some renaming

* Qt buildfix, also fix the Qt build on Mac (got broken with battery changes)

* Attempt at buildfixing ios

* UWP buildfix
2023-02-25 13:09:44 +01:00
Henrik Rydgård
99e6fd62f7 Remove a baffling depth offset I don't quite get 2023-02-11 14:41:25 +01:00
Henrik Rydgård
a2c9491a06 Remove a division by 0 that I hadn't noticed before. 2023-02-11 13:27:44 +01:00
Henrik Rydgård
d65dae7185 Depth scale functions: Clean up the naming, add a failing test 2023-02-10 14:57:45 +01:00
Henrik Rydgård
c11f7e3a5f Fix texture alpha when texturing from full-alpha textures.
Fixes #16875
2023-02-02 16:13:38 +01:00
Henrik Rydgård
1c8e456c97 Also apply this to OpenGL and D3D9 2023-01-11 19:29:02 +01:00
Henrik Rydgård
4c2a41cc83 Break out the attenuation term, too 2023-01-11 19:29:02 +01:00
Henrik Rydgård
a508f7e345 Shave a few instructions from lighting shaders by prenormalizing the light dir used for spotlights 2023-01-11 19:29:02 +01:00
Henrik Rydgård
c7c48abb37 Switch the 2x flag to a uniform 2023-01-10 12:36:28 +01:00
Henrik Rydgård
00c44ea799 Get rid of the bool, not worth it. 2023-01-10 10:23:29 +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
5cae5615ea Use more unusual values as "fog-disabled". 2023-01-04 10:14:12 +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
26884150d7 Remove the 0th descriptor set, move everything else back to 0 2022-12-16 13:05:40 +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
aec22491fe Don't expand alphaColorRef to 128 bytes on backends where we don't need to. 2022-10-10 18:02:01 +02:00
Henrik Rydgård
bf25f4b283 Shader uniforms (VK/D3D11): Fix issue where we could overwrite the fourth component padding. 2022-10-06 10:52:58 +02:00
Henrik Rydgård
f4b71e2dc7 Fragment shader uniforms: Pack color mask in 32 bits instead of expand to 128 bits.
Allows us to save 16 bytes from the main uniform buffer, since there's
free 32-bit spaces here and there to use.
2022-09-26 13:04:56 +02: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
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
Henrik Rydgård
d99e4b6714 Quicker way to update the through projection matrix with the split framebuffer offset 2022-08-31 08:44:15 +02:00
Henrik Rydgård
7186fc2c17 Offset the draws properly. Now just some texel clamping left to fix 2022-08-31 01:40:53 +02:00
Henrik Rydgård
c158414858 Give the mip bias its own uniform flag. 2022-07-31 10:43:48 +02:00
Henrik Rydgård
d7aa3ee486 Fix the mip bias to take the texture depth and sampling offset into account. 2022-07-31 10:43:48 +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
3bf6b140c7 Don't forget to check for bufferedRendering before enabling screen rotation in the shader. 2021-10-31 13:35:13 +01:00
Unknown W. Brackets
b87451de92 GPU: Restore rotation handling in sw transform. 2021-10-30 18:22:53 -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
Unknown W. Brackets
f32f89dd90 Global: Remove some unused variables. 2021-02-15 11:59:45 -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
6310af25fa Get shader color write masking going on all backends. 2020-11-08 23:45:47 +01:00
Henrik Rydgård
b7edf75437 Move Display.cpp/h to Common. 2020-10-04 11:42:16 +02:00
Henrik Rydgård
9e41fafd0d Move math and some file and data conversion files out from native to Common.
Buildfixing

Move some file util files

Buildfix

Move KeyMap.cpp/h to Core where they belong better.

libretro buildfix attempt

Move ini_file

More buildfixes
2020-10-04 09:12:46 +02:00
Henrik Rydgård
ff248ff94f Fix #13251 for D3D11. The remaining issue in #7124 should be fixed. 2020-08-06 09:35:26 +02:00
Henrik Rydgård
eadd3c5785 Remove the LARGE_VIEWPORTS separate path. The fewer paths the better, all need to work anyway.
Required fixing a bug in ShaderUniforms.cpp (used by D3D11 and Vulkan,
the two backends that previously exposed LARGE_VIEWPORTS).
2020-08-05 19:03:08 +02:00
Henrik Rydgård
d57edfbdac Rename FramebufferCommon.cpp/h to FramebufferManagerCommon.cpp/h for consistency 2020-08-03 23:17:22 +02:00
Unknown W. Brackets
c42fb72419 GPU: Update uniforms w/ consistent render mode too. 2020-04-04 11:03:07 -07:00
Henrik Rydgård
767b1e45b2 Fix the build - there's a Vec3 name collision, fixed it using a namespace. 2019-10-22 22:58:10 +02:00
Henrik Rydgård
70ec327b40 Vulkan: Slim down and rename the Mali hack. 2019-09-09 00:43:31 +02:00
Henrik Rydgård
f76adfd760 Vulkan ARM mali Z hack: Modify the matrix instead of the shader. 2019-09-09 00:09:57 +02:00
Henrik Rydgård
f316a65905 Revert "Temporary commit to get CalcCullRange logging into a buildbot build"
This reverts commit 786914690d.
2019-03-13 11:39:08 +01:00
Henrik Rydgård
786914690d Temporary commit to get CalcCullRange logging into a buildbot build 2019-03-13 11:37:52 +01:00
Unknown W. Brackets
d7f2167898 GLES: Correct cull range offset in unbuffered. 2019-03-02 10:58:28 -08:00
Unknown W. Brackets
357e0316a0 GPU: Handle cull range properly drawing at offset.
Did the transformation backwards.
2019-03-02 10:48:01 -08:00
Unknown W. Brackets
b955ec70c9 GPU: Correct depth clamp range in range cull.
It was just wrong before, causing wrong culling when using a non-standard
viewport scale/center for depth.

Fixes #11701, fixes #11781.
2019-02-10 09:58:01 -08:00