- fixed: FMaterial::ValidateTexture must determine whether to expand sprites before actually constructing the FMaterial object.

This commit is contained in:
Christoph Oelckers 2015-01-08 18:44:55 +01:00
parent df93d1a9f1
commit d4d041d5fc
1 changed files with 4 additions and 4 deletions

View File

@ -413,19 +413,16 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
if (tx->bWarped) if (tx->bWarped)
{ {
mShaderIndex = tx->bWarped; mShaderIndex = tx->bWarped;
expanded = false;
tx->gl_info.shaderspeed = static_cast<FWarpTexture*>(tx)->GetSpeed(); tx->gl_info.shaderspeed = static_cast<FWarpTexture*>(tx)->GetSpeed();
} }
else if (tx->bHasCanvas) else if (tx->bHasCanvas)
{ {
expanded = false;
} }
else else
{ {
if (tx->gl_info.shaderindex >= FIRST_USER_SHADER) if (tx->gl_info.shaderindex >= FIRST_USER_SHADER)
{ {
mShaderIndex = tx->gl_info.shaderindex; mShaderIndex = tx->gl_info.shaderindex;
expanded = false;
} }
else else
{ {
@ -439,7 +436,6 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
} }
} }
} }
assert(tx->gl_info.Material[expanded] == NULL);
mBaseLayer = ValidateSysTexture(tx, true); mBaseLayer = ValidateSysTexture(tx, true);
@ -765,6 +761,10 @@ FMaterial * FMaterial::ValidateTexture(FTexture * tex, bool expand)
FMaterial *gltex = tex->gl_info.Material[expand]; FMaterial *gltex = tex->gl_info.Material[expand];
if (gltex == NULL) if (gltex == NULL)
{ {
if (tex->bWarped || tex->bHasCanvas || tex->gl_info.shaderindex >= FIRST_USER_SHADER)
{
expand = false;
}
gltex = new FMaterial(tex, expand); gltex = new FMaterial(tex, expand);
} }
return gltex; return gltex;