D3D9 bool constants have a separate register space, oops.

This commit is contained in:
Henrik Rydgård 2023-01-09 12:21:33 +01:00
parent d4ce134292
commit 5022ddc4fc
3 changed files with 9 additions and 7 deletions

View file

@ -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) {

View file

@ -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 {

View file

@ -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,