renderergl2: reimplement greyscale as backend post after all 2D+3D draws
Fixes #654 - HUD/UI previously bypassed greyscale. r_greyscale now supports partial desaturation [0-1]. Removed unused legacy logic from tr_shade.c
This commit is contained in:
1 parent
7bd2c17f9d
commit
453705553b
9 files changed
+166
-111
No files matched your search
@@ -52,6 +52,8 @@ extern const char *fallbackShader_texturecolor_vp;
|
||||
extern const char *fallbackShader_texturecolor_fp;
|
||||
extern const char *fallbackShader_tonemap_vp;
|
||||
extern const char *fallbackShader_tonemap_fp;
|
||||
extern const char* fallbackShader_greyscale_vp;
|
||||
extern const char* fallbackShader_greyscale_fp;
|
||||
|
||||
typedef struct uniformInfo_s
|
||||
{
|
||||
@@ -156,6 +158,7 @@ static uniformInfo_t uniformsInfo[] =
|
||||
{ "u_AlphaTest", GLSL_INT },
|
||||
|
||||
{ "u_BoneMatrix", GLSL_MAT16_BONEMATRIX },
|
||||
{ "u_Greyscale", GLSL_FLOAT }
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@@ -1451,6 +1454,18 @@ void GLSL_InitGPUShaders(void)
|
||||
}
|
||||
|
||||
|
||||
if (!GLSL_InitGPUShader(&tr.greyscaleShader, "greyscale", attribs, qtrue, extradefines, qtrue,
|
||||
fallbackShader_greyscale_vp, fallbackShader_greyscale_fp))
|
||||
{
|
||||
ri.Error(ERR_FATAL, "Unable to load greyscale shader");
|
||||
}
|
||||
|
||||
GLSL_InitUniforms(&tr.greyscaleShader);
|
||||
GLSL_SetUniformInt(&tr.greyscaleShader, UNIFORM_TEXTUREMAP, TB_DIFFUSEMAP);
|
||||
GLSL_FinishGPUShader(&tr.greyscaleShader);
|
||||
|
||||
numEtcShaders++;
|
||||
|
||||
// GLSL 1.10+ or GL_OES_standard_derivatives extension are required for dFdx() and dFdy() GLSL functions
|
||||
if (glRefConfig.glslMajorVersion > 1 || (glRefConfig.glslMajorVersion == 1 && glRefConfig.glslMinorVersion >= 10)
|
||||
|| glRefConfig.standardDerivatives)
|
||||
|
||||
Reference in new issue
Block a user