The values read back when saving a context or getting matrix data are set
differently than the actual values used for rendering.
This implements the wrapping and bleeding between matrices within softgpu,
but leaves hardware rendering to only use the rendering registers for
speed.
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
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.
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...
And respect the other flags that I can reproduce working in a test.
I can't seem to get the fog to work at all, or the shading mode, or the
secondary color. Maybe depends on other flags or bits in other regs...
This allows for lines, points, textures, and similar things. Also
corrects offset handling. Still some flags on VAP that seemingly don't
work, and this doesn't consider the texture flag on it.
I think there were some games where this would step in the middle of a
frame, but not seeing it commonly now. So make it the default, but allow
both methods in the menu.
Fixes#15893.