yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

gl_texture_cache: Use local variables to simplify DownloadTexture

This commit is contained in:
ReinUsesLisp 2020-01-14 17:39:48 -03:00
parent cdb00546f0
commit 66a1c777c9
1 changed files with 4 additions and 6 deletions

View File

@ -253,14 +253,12 @@ void CachedSurface::DownloadTexture(std::vector<u8>& staging_buffer) {
glPixelStorei(GL_PACK_ALIGNMENT, std::min(8U, params.GetRowAlignment(level))); glPixelStorei(GL_PACK_ALIGNMENT, std::min(8U, params.GetRowAlignment(level)));
glPixelStorei(GL_PACK_ROW_LENGTH, static_cast<GLint>(params.GetMipWidth(level))); glPixelStorei(GL_PACK_ROW_LENGTH, static_cast<GLint>(params.GetMipWidth(level)));
const std::size_t mip_offset = params.GetHostMipmapLevelOffset(level); const std::size_t mip_offset = params.GetHostMipmapLevelOffset(level);
u8* const mip_data = staging_buffer.data() + mip_offset;
const GLsizei size = static_cast<GLsizei>(params.GetHostMipmapSize(level));
if (is_compressed) { if (is_compressed) {
glGetCompressedTextureImage(texture.handle, level, glGetCompressedTextureImage(texture.handle, level, size, mip_data);
static_cast<GLsizei>(params.GetHostMipmapSize(level)),
staging_buffer.data() + mip_offset);
} else { } else {
glGetTextureImage(texture.handle, level, format, type, glGetTextureImage(texture.handle, level, format, type, size, mip_data);
static_cast<GLsizei>(params.GetHostMipmapSize(level)),
staging_buffer.data() + mip_offset);
} }
} }
} }