diff --git a/GPU/Common/FragmentShaderGenerator.cpp b/GPU/Common/FragmentShaderGenerator.cpp index 15f4067b8b..7722e769fd 100644 --- a/GPU/Common/FragmentShaderGenerator.cpp +++ b/GPU/Common/FragmentShaderGenerator.cpp @@ -260,7 +260,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu if (texFunc == GE_TEXFUNC_BLEND) { WRITE(p, "float3 u_texenv : register(c%i);\n", CONST_PS_TEXENV); } - WRITE(p, "bool u_texAlpha : register(c%i);\n", CONST_PS_TEXALPHA); + WRITE(p, "bool u_texAlpha : register(b%i);\n", CONST_PS_TEXALPHA); // NOTE! "b" register, not "c"! } WRITE(p, "float3 u_fogcolor : register(c%i);\n", CONST_PS_FOGCOLOR); if (texture3D) { diff --git a/GPU/Common/FragmentShaderGenerator.h b/GPU/Common/FragmentShaderGenerator.h index d69583452c..c2842f7ae4 100644 --- a/GPU/Common/FragmentShaderGenerator.h +++ b/GPU/Common/FragmentShaderGenerator.h @@ -23,7 +23,7 @@ struct FShaderID; -// D3D9 constants +// D3D9 float constants #define CONST_PS_TEXENV 0 #define CONST_PS_ALPHACOLORREF 1 @@ -36,10 +36,13 @@ struct FShaderID; #define CONST_PS_TEXCLAMP 8 #define CONST_PS_TEXCLAMPOFF 9 #define CONST_PS_MIPBIAS 10 -#define CONST_PS_TEXALPHA 11 // For stencil upload -#define CONST_PS_STENCILVALUE 12 +#define BCONST_PS_STENCILVALUE 11 + +// D3D9 bool constants, they have their own register space. +#define CONST_PS_TEXALPHA 0 + // Can technically be deduced from the fragment shader ID, but this is safer. enum class FragmentShaderFlags : u32 { diff --git a/GPU/Common/ShaderId.h b/GPU/Common/ShaderId.h index beab743309..62adaaf38a 100644 --- a/GPU/Common/ShaderId.h +++ b/GPU/Common/ShaderId.h @@ -6,9 +6,8 @@ #include "Common/CommonFuncs.h" -// TODO: There will be additional bits, indicating that groups of these will be -// sent to the shader and processed there. This will cut down the number of shaders ("ubershader approach") -// This is probably only really worth doing for lighting and bones. +// VS_BIT_LIGHT_UBERSHADER indicates that some groups of these will be +// sent to the shader and processed there. This cuts down the number of shaders ("ubershader approach"). enum VShaderBit : uint8_t { VS_BIT_LMODE = 0, VS_BIT_IS_THROUGH = 1,