Fix crash in LocoRoco with D3D11 when hitting a spiky (a broken texture gets created with too many mipmaps for its size)

This commit is contained in:
Henrik Rydgard committed 2017-04-01 20:36:44 +02:00
1 parent 94cb35f65b
commit 2ebba56758
1 file changed
+8 -2
+8 -2
View File
@@ -474,9 +474,15 @@ void TextureCacheD3D11::BuildTexture(TexCacheEntry *const entry, bool replaceIma
break;
}
// If size reaches 1, stop, and override maxlevel.
int tw = gstate.getTextureWidth(i);
int th = gstate.getTextureHeight(i);
if (tw == 1 || th == 1) {
maxLevel = i;
break;
}
if (i > 0 && gstate_c.Supports(GPU_SUPPORTS_TEXTURE_LOD_CONTROL)) {
int tw = gstate.getTextureWidth(i);
int th = gstate.getTextureHeight(i);
if (tw != 1 && tw != (gstate.getTextureWidth(i - 1) >> 1))
badMipSizes = true;
else if (th != 1 && th != (gstate.getTextureHeight(i - 1) >> 1))