1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Decrease level of mip-map texture if texture with given size and level can't be created by OpenGL.

Fixed shadows of empire: black triangles (regression!) #1612
This commit is contained in:
Sergey Lipskiy 2017-10-02 16:58:55 +07:00
parent e4f29a1eb8
commit deaf61299f

View File

@ -3,6 +3,7 @@
#include <algorithm>
#include <thread> // std::this_thread::sleep_for
#include <chrono> // std::chrono::seconds
#include "Platform.h"
#include "Textures.h"
#include "GBI.h"
#include "RSP.h"
@ -1147,8 +1148,16 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
s32 mipLevel = 0;
_pTexture->max_level = 0;
if (config.generalEmulation.enableLOD != 0 && gSP.texture.level > 1)
_pTexture->max_level = static_cast<u8>(_tile == 0 ? 0 : gSP.texture.level - 1);
if (config.generalEmulation.enableLOD != 0 && gSP.texture.level > 1) {
if (_tile == 0) {
_pTexture->max_level = 0;
} else {
_pTexture->max_level = static_cast<u8>(gSP.texture.level - 1);
const u16 dim = std::max(_pTexture->width, _pTexture->height);
while (dim < static_cast<u16>(1 << _pTexture->max_level))
--_pTexture->max_level;
}
}
ObjectHandle name;
CachedTexture tmptex(name);