summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Matthew Daniels <108370479+gm-matthew@users.noreply.github.com>2026-02-19 14:19:31 +0000
committer GitHub <noreply@github.com>2026-02-20 01:19:31 +1100
commitb8cea6c26a019d65856f5ab0d6a9c1c020e3ddee (patch)
treeb194cfb6e92a775015ca3f59b0adb78862de905b
parentec94d5d3b9fc4ba754d31d78ffd61b1582cbea95 (diff)
sega/model2rd.ipp: Use full precision reciprocal for perspective correction. (#14992)
-rw-r--r--src/mame/sega/model2rd.ipp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mame/sega/model2rd.ipp b/src/mame/sega/model2rd.ipp
index 9916b90dba7..5063bee6eba 100644
--- a/src/mame/sega/model2rd.ipp
+++ b/src/mame/sega/model2rd.ipp
@@ -294,28 +294,28 @@ void model2_renderer::draw_scanline_tex(int32_t scanline, const extent_t &extent
if (fill[x] > 0)
continue;
- float z = recip_approx(ooz);
+ float const z = 1.0F / ooz;
- s32 mml = -object.texlod + fast_log2(z); // equivalent to log2(z^2)
- s32 level = std::clamp(mml >> 7, 0, max_level);
+ s32 const mml = -object.texlod + fast_log2(z); // equivalent to log2(z^2)
+ s32 const level = std::clamp(mml >> 7, 0, max_level);
// we give texture coordinates 8 fractional bits
- s32 u = s32(uoz * z * 256.0F);
- s32 v = s32(voz * z * 256.0F);
+ s32 const u = s32(uoz * z * 256.0F);
+ s32 const v = s32(voz * z * 256.0F);
u32 t = fetch_bilinear_texel<Translucent>(object, level, u, v);
if (mml > 0 && level < max_level)
{
- u32 t2 = fetch_bilinear_texel<Translucent>(object, level + 1, u, v);
- s32 frac = (mml & 127) << 1;
+ u32 const t2 = fetch_bilinear_texel<Translucent>(object, level + 1, u, v);
+ s32 const frac = (mml & 127) << 1;
t = LERP(t, t2, frac);
}
else if (object.utex && mml < 0)
{
// microtexture; blend up to almost 50%
- u32 t2 = fetch_bilinear_texel<Translucent>(object, -1, u, v);
- s32 frac = std::min(-mml >> object.utexminlod, 127);
+ u32 const t2 = fetch_bilinear_texel<Translucent>(object, -1, u, v);
+ s32 const frac = std::min(-mml >> object.utexminlod, 127);
t = LERP(t, t2, frac);
}