diff --git a/Common/GPU/OpenGL/thin3d_gl.cpp b/Common/GPU/OpenGL/thin3d_gl.cpp index 3088abc22f..e26a666748 100644 --- a/Common/GPU/OpenGL/thin3d_gl.cpp +++ b/Common/GPU/OpenGL/thin3d_gl.cpp @@ -821,11 +821,14 @@ OpenGLTexture::OpenGLTexture(GLRenderManager *render, const TextureDesc &desc) : return; int level = 0; + int width = width_; + int height = height_; + int depth = depth_; for (auto data : desc.initData) { - SetImageData(0, 0, 0, width_, height_, depth_, level, 0, data, desc.initDataCallback); - width_ = (width_ + 1) / 2; - height_ = (height_ + 1) / 2; - depth_ = (depth_ + 1) / 2; + SetImageData(0, 0, 0, width, height, depth, level, 0, data, desc.initDataCallback); + width = (width + 1) / 2; + height = (height + 1) / 2; + depth = (depth + 1) / 2; level++; } mipLevels_ = desc.generateMips ? desc.mipLevels : level;