From 04d82d81278c564080cc116655e7ad415f90f637 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 26 Sep 2016 19:42:07 +0200 Subject: [PATCH] gsdx: size doesn't count but 0.625 might change your life :p --- plugins/GSdx/GSRendererHW.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index 750dc55815..7b89558c36 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -489,7 +489,7 @@ void GSRendererHW::Draw() // Code from the SW renderer if (IsMipMapActive()) { - //gd.sel.mmin = (context->TEX1.MMIN & 1) + 1; // 1: round, 2: tri + int interpolation = (context->TEX1.MMIN & 1) + 1; // 1: round, 2: tri int mxl = std::min((int)m_context->TEX1.MXL, 6); int k = (m_context->TEX1.K + 8) >> 4; @@ -508,12 +508,20 @@ void GSRendererHW::Draw() } if (lcm == 1) { - lod = std::max(std::min(k, mxl), 0); + lod = std::max(k, 0); } else { // Not constant but who care ! - lod = std::max((int)round(m_vt.m_lod.x), 0); + if (interpolation == 2) { + // Mipmap Linear. Both layers are sampled, only take the big one + lod = std::max((int)floor(m_vt.m_lod.x), 0); + } else { + // On GS lod is an int with 4 decimal digit. + lod = std::max((int)round(m_vt.m_lod.x + 0.0625), 0); + } } + lod = std::min(lod, mxl); + TEX0 = GetTex0Layer(lod); // FIXME: previous round lod is likely wrong. Following code is a workaround until it is done properly