gl_texture_cache: Fix multi layered texture Scale

This commit is contained in:
ameerj 2021-07-29 18:08:06 -04:00 committed by Fernando Sahmkow
parent b6060873ce
commit 05d98d9bbf
1 changed files with 14 additions and 10 deletions

View File

@ -939,17 +939,21 @@ bool Image::Scale(bool scale_src, bool scale_dst) {
const auto& draw_fbo = runtime->rescale_draw_fbo; const auto& draw_fbo = runtime->rescale_draw_fbo;
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, draw_fbo.handle); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, draw_fbo.handle);
glBindFramebuffer(GL_READ_FRAMEBUFFER, read_fbo.handle); glBindFramebuffer(GL_READ_FRAMEBUFFER, read_fbo.handle);
for (s32 level = 0; level < info.resources.levels; ++level) { for (s32 layer = 0; layer < info.resources.layers; ++layer) {
const u32 src_level_width = std::max(1u, src_width >> level); for (s32 level = 0; level < info.resources.levels; ++level) {
const u32 src_level_height = std::max(1u, src_height >> level); const u32 src_level_width = std::max(1u, src_width >> level);
const u32 dst_level_width = std::max(1u, dst_width >> level); const u32 src_level_height = std::max(1u, src_height >> level);
const u32 dst_level_height = std::max(1u, dst_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); glNamedFramebufferTextureLayer(read_fbo.handle, attachment, texture.handle, level,
glNamedFramebufferTexture(draw_fbo.handle, attachment, dst_texture.handle, level); layer);
glBlitNamedFramebuffer(read_fbo.handle, draw_fbo.handle, 0, 0, src_level_width, glNamedFramebufferTextureLayer(draw_fbo.handle, attachment, dst_texture.handle, level,
src_level_height, 0, 0, dst_level_width, dst_level_height, mask, layer);
filter); 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); texture = std::move(dst_texture);