remove special texture creation for fullscreen colormaps.

On GL 3.x+ this isn't needed at all and on older hardware it causes performance issues, in particular with hires textures due to impossibility of precaching.
In addition it forces some really awkward handling of lighting for things that have their own color, like stenciled sprites or particles.

With this special case gone it will be possible to handle this case in a saner manner than it is right now.

As compensation for older hardware a fullscreen blend will be drawn over the entire screen. This won't be 100% accurate but it's preferable to keeping the current method.
This commit is contained in:
Christoph Oelckers 2014-05-11 14:46:37 +02:00
commit f3a9cb0cfa
3 changed files with 153 additions and 88 deletions

View file

@ -92,33 +92,35 @@ void FRenderState::Reset()
int FRenderState::SetupShader(bool cameratexture, int &shaderindex, int &cm, float warptime)
{
bool usecmshader;
int softwarewarp = 0;
if (shaderindex == 3)
{
// Brightmap should not be used.
if (!mBrightmapEnabled || cm >= CM_FIRSTSPECIALCOLORMAP)
{
shaderindex = 0;
}
}
if (gl.hasGLSL())
{
usecmshader = cm > CM_DEFAULT && cm < CM_MAXCOLORMAP && mTextureMode != TM_MASK;
if (shaderindex == 3)
{
// Brightmap should not be used.
if (!mBrightmapEnabled || cm >= CM_FIRSTSPECIALCOLORMAP)
{
shaderindex = 0;
}
}
mColormapState = cm;
if (cm > CM_DEFAULT && cm < CM_MAXCOLORMAP && mTextureMode != TM_MASK)
{
cm = CM_DEFAULT;
}
mEffectState = shaderindex;
mWarpTime = warptime;
}
else
{
usecmshader = false;
if (cm != CM_SHADE) cm = CM_DEFAULT;
softwarewarp = shaderindex > 0 && shaderindex < 3? shaderindex : 0;
shaderindex = 0;
}
mEffectState = shaderindex;
mColormapState = usecmshader? cm : CM_DEFAULT;
if (usecmshader) cm = CM_DEFAULT;
mWarpTime = warptime;
return softwarewarp;
}
@ -141,18 +143,18 @@ bool FRenderState::ApplyShader()
else if (gl.hasGLSL())
{
useshaders = (!m2D || mEffectState != 0 || mColormapState); // all 3D rendering and 2D with texture effects.
}
if (useshaders)
{
FShaderContainer *shd = GLRenderer->mShaderManager->Get(mTextureEnabled? mEffectState : 4);
if (shd != NULL)
if (useshaders)
{
activeShader = shd->Bind(mColormapState, mGlowEnabled, mWarpTime, mLightEnabled);
FShaderContainer *shd = GLRenderer->mShaderManager->Get(mTextureEnabled ? mEffectState : 4);
if (shd != NULL)
{
activeShader = shd->Bind(mColormapState, mGlowEnabled, mWarpTime, mLightEnabled);
}
}
}
if (activeShader)
{
int fogset = 0;