- remove some obsolete code from decal rendering.

- avoid rebinding the same texture multiple times, as there's considerable overhead in the texture manager.
- check gl_sort_textures only once per scene, not per draw list.
This commit is contained in:
Christoph Oelckers 2014-08-30 15:34:14 +02:00
commit 12160bd29c
7 changed files with 50 additions and 30 deletions

View file

@ -611,15 +611,27 @@ outl:
//
//===========================================================================
static FMaterial *last;
static int lastclamp;
static int lasttrans;
static bool lastalpha;
void FMaterial::Bind(int clampmode, int translation, int overrideshader, bool alphatexture)
{
int usebright = false;
int shaderindex = overrideshader >= 0? overrideshader : mShaderIndex;
gl_RenderState.SetShader(shaderindex, tex->gl_info.shaderspeed);
// avoid rebinding the same texture multiple times.
if (this == last && lastclamp == clampmode && translation == lasttrans && lastalpha == alphatexture) return;
last = this;
lastclamp = clampmode;
lastalpha = alphatexture;
lasttrans = translation;
int usebright = false;
int maxbound = 0;
bool allowhires = tex->xScale == FRACUNIT && tex->yScale == FRACUNIT && clampmode <= CLAMP_XY && !mExpanded;
gl_RenderState.SetShader(shaderindex, tex->gl_info.shaderspeed);
if (tex->bHasCanvas) clampmode = CLAMP_CAMTEX;
else if (tex->bWarped && clampmode <= CLAMP_XY) clampmode = CLAMP_NONE;