From 05d98d9bbffde2f43ff9558a8b1676dfca0bd0f3 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 29 Jul 2021 18:08:06 -0400 Subject: gl_texture_cache: Fix multi layered texture Scale --- .../renderer_opengl/gl_texture_cache.cpp | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/video_core/renderer_opengl') diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 5d14bfc97..8b86136e0 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -939,17 +939,21 @@ bool Image::Scale(bool scale_src, bool scale_dst) { const auto& draw_fbo = runtime->rescale_draw_fbo; glBindFramebuffer(GL_DRAW_FRAMEBUFFER, draw_fbo.handle); glBindFramebuffer(GL_READ_FRAMEBUFFER, read_fbo.handle); - for (s32 level = 0; level < info.resources.levels; ++level) { - const u32 src_level_width = std::max(1u, src_width >> level); - const u32 src_level_height = std::max(1u, src_height >> level); - const u32 dst_level_width = std::max(1u, dst_width >> level); - const u32 dst_level_height = std::max(1u, dst_height >> level); - - glNamedFramebufferTexture(read_fbo.handle, attachment, texture.handle, level); - glNamedFramebufferTexture(draw_fbo.handle, attachment, dst_texture.handle, level); - glBlitNamedFramebuffer(read_fbo.handle, draw_fbo.handle, 0, 0, src_level_width, - src_level_height, 0, 0, dst_level_width, dst_level_height, mask, - filter); + for (s32 layer = 0; layer < info.resources.layers; ++layer) { + for (s32 level = 0; level < info.resources.levels; ++level) { + const u32 src_level_width = std::max(1u, src_width >> level); + const u32 src_level_height = std::max(1u, src_height >> level); + const u32 dst_level_width = std::max(1u, dst_width >> level); + const u32 dst_level_height = std::max(1u, dst_height >> level); + + glNamedFramebufferTextureLayer(read_fbo.handle, attachment, texture.handle, level, + layer); + glNamedFramebufferTextureLayer(draw_fbo.handle, attachment, dst_texture.handle, level, + layer); + glBlitNamedFramebuffer(read_fbo.handle, draw_fbo.handle, 0, 0, src_level_width, + src_level_height, 0, 0, dst_level_width, dst_level_height, mask, + filter); + } } texture = std::move(dst_texture); -- cgit v1.2.3