summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_rasterizer_cache.h
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2018-10-25 18:24:10 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2018-10-29 00:00:03 +0100
commitf4432b5d0cb0cb89ff4af8172720f7457514d981 (patch)
tree7f78dd3c548c4165e2dd094bd0cc594d0bbcc456 /src/video_core/renderer_opengl/gl_rasterizer_cache.h
parentImplement Mip Filter (diff)
downloadyuzu-f4432b5d0cb0cb89ff4af8172720f7457514d981.tar
yuzu-f4432b5d0cb0cb89ff4af8172720f7457514d981.tar.gz
yuzu-f4432b5d0cb0cb89ff4af8172720f7457514d981.tar.bz2
yuzu-f4432b5d0cb0cb89ff4af8172720f7457514d981.tar.lz
yuzu-f4432b5d0cb0cb89ff4af8172720f7457514d981.tar.xz
yuzu-f4432b5d0cb0cb89ff4af8172720f7457514d981.tar.zst
yuzu-f4432b5d0cb0cb89ff4af8172720f7457514d981.zip
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer_cache.h')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 68479d55a..951e03ba6 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -915,21 +915,28 @@ struct SurfaceParams {
return std::max(1U, depth >> mip_level);
}
- u32 MipBlockHeight(u32 mip_level) const {
- u32 height = MipHeight(mip_level);
- u32 bh = block_height;
- // Magical block resizing algorithm, needs more testing.
- while (bh > 1 && (height + bh - 1) / bh <= 16) {
- bh = bh >> 1;
+ // 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 {
+ 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) {
+ bh >>= 1;
}
return bh;
}
u32 MipBlockDepth(u32 mip_level) const {
+ if (mip_level == 0)
+ return block_depth;
u32 depth = MipDepth(mip_level);
- u32 bd = block_depth;
+ u32 bd = 32;
// Magical block resizing algorithm, needs more testing.
- while (bd > 1 && depth / bd <= 16) {
+ while (bd > 1 && depth / depth <= bd) {
bd = bd >> 1;
}
return bd;