diff options
| author | Stenzek <stenzek@gmail.com> | 2016-11-27 18:13:54 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2017-04-01 12:31:40 +1000 |
| commit | f8059eae430cb8f39a0b49a1c1144de99fdc7947 (patch) | |
| tree | 3e592915db259bc9febadf1e31e2d035bd2796c7 /Source/Core/VideoBackends/OGL/TextureCache.cpp | |
| parent | 22fa199caf7f905007c94e52b0e6d6feb1f41f99 (diff) | |
OGL: Fix render-target texture mipmap allocation
The loop was allocating one-too-many levels, as well as incorrect sizes
for each level. Probably not an issue as mipmapped render targets aren't
used, but the logic should be correct anyway.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/TextureCache.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/TextureCache.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/Core/VideoBackends/OGL/TextureCache.cpp b/Source/Core/VideoBackends/OGL/TextureCache.cpp index 2cf0623939..3226dfdefa 100644 --- a/Source/Core/VideoBackends/OGL/TextureCache.cpp +++ b/Source/Core/VideoBackends/OGL/TextureCache.cpp @@ -121,10 +121,11 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntryConf if (config.rendertarget) { - for (u32 level = 0; level <= config.levels; level++) + for (u32 level = 0; level < config.levels; level++) { - glTexImage3D(GL_TEXTURE_2D_ARRAY, level, GL_RGBA, config.width, config.height, config.layers, - 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); + glTexImage3D(GL_TEXTURE_2D_ARRAY, level, GL_RGBA, std::max(config.width >> level, 1u), + std::max(config.height >> level, 1u), config.layers, 0, GL_RGBA, + GL_UNSIGNED_BYTE, nullptr); } glGenFramebuffers(1, &entry->framebuffer); FramebufferManager::SetFramebuffer(entry->framebuffer); |
