Multithreadded Shadergen: First Pass over vertex/lighting Shadergens

The only code which touches xfmem is code which writes directly into
uid_data.

All the rest now read their parameters out of uid_data.

I also simplified the lighting code so it always generated seperate
codepaths for alpha and color channels instead of trying to combine
them on the off-chance that the same equation works for all 4 channels.

As modern (post 2008) GPUs generally don't calcualte all 4 channels
in a single vector, this optimisation is pointless. The shader compiler
will undo it during the GLSL/HLSL to IR step.

Bug Fix: The about optimisation was also broken, applying the color light
         equation to the alpha light channel instead of the alpha light
	 euqation. But doesn't look like anything trigged this bug.
This commit is contained in:
Scott Mansell
2016-01-14 18:51:37 +13:00
parent 3a26167148
commit 53c402dbc5
3 changed files with 90 additions and 126 deletions

View File

@ -319,7 +319,7 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
// can be made and
// doesn't define what will happen if we discard the fragment. But the way modern graphics
// hardware is implemented
// means it is not unreasonable to expect the the same behaviour as early_fragment_tests.
// means it is not unreasonable to expect the same behaviour as early_fragment_tests.
// We can also assume that if a driver has gone out of its way to support conservative depth and
// not image_load_store
// as required by OpenGL 4.2 that it will be doing the optimisation.
@ -579,7 +579,7 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
out.Write("\tfloat2 screenpos = rawpos.xy * " I_EFBSCALE ".xy;\n");
// Opengl has reversed vertical screenspace coordiantes
// Opengl has reversed vertical screenspace coordinates
if (ApiType == API_OPENGL)
out.Write("\tscreenpos.y = %i.0 - screenpos.y;\n", EFB_HEIGHT);