diff options
author | FernandoS27 <fsahmkow27@gmail.com> | 2018-10-27 01:18:03 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2018-10-29 00:00:05 +0100 |
commit | f0e902a7d6df72531fbd01d27756f9875dc3c65d (patch) | |
tree | f56941ce6cdddf4815ff2d5c6ae7588d513690d1 /src/video_core/renderer_opengl/gl_rasterizer_cache.h | |
parent | Fixed Invalid Image size and Mipmap calculation (diff) | |
download | yuzu-f0e902a7d6df72531fbd01d27756f9875dc3c65d.tar yuzu-f0e902a7d6df72531fbd01d27756f9875dc3c65d.tar.gz yuzu-f0e902a7d6df72531fbd01d27756f9875dc3c65d.tar.bz2 yuzu-f0e902a7d6df72531fbd01d27756f9875dc3c65d.tar.lz yuzu-f0e902a7d6df72531fbd01d27756f9875dc3c65d.tar.xz yuzu-f0e902a7d6df72531fbd01d27756f9875dc3c65d.tar.zst yuzu-f0e902a7d6df72531fbd01d27756f9875dc3c65d.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer_cache.h')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 951e03ba6..15ac4a1b1 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -917,14 +917,14 @@ struct SurfaceParams { // Auto block resizing algorithm from: // https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/nouveau/nv50/nv50_miptree.c - u32 MipBlockHeight(u32 mip_level, u32 alt_height = 0) const { + u32 MipBlockHeight(u32 mip_level) const { if (mip_level == 0) return block_height; - if (alt_height == 0) - alt_height = MipHeight(mip_level); - u32 blocks_in_y = (alt_height + 7) / 8; - u32 bh = 32; - while (bh > 1 && blocks_in_y <= bh * 2) { + u32 alt_height = MipHeight(mip_level); + u32 h = GetDefaultBlockHeight(pixel_format); + u32 blocks_in_y = (alt_height + h - 1) / h; + u32 bh = 16; + while (bh > 1 && blocks_in_y <= bh * 4) { bh >>= 1; } return bh; @@ -933,11 +933,17 @@ struct SurfaceParams { u32 MipBlockDepth(u32 mip_level) const { if (mip_level == 0) return block_depth; + if (is_layered) + return 1; u32 depth = MipDepth(mip_level); u32 bd = 32; - // Magical block resizing algorithm, needs more testing. - while (bd > 1 && depth / depth <= bd) { - bd = bd >> 1; + while (bd > 1 && depth * 2 <= bd) { + bd >>= 1; + } + if (bd == 32) { + u32 bh = MipBlockHeight(mip_level); + if (bh >= 4) + return 16; } return bd; } |