mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Software: Adjust diagonal LOD implementation
This produces behavior matching the behavior on hardware (see Wario's Gold Mine in Mario Kart Wii).
This commit is contained in:
parent
51e3334526
commit
b9288212a0
@ -171,22 +171,25 @@ static inline void CalculateLOD(s32* lodp, bool* linear, u32 texmap, u32 texcoor
|
|||||||
const TexMode1& tm1 = texUnit.texMode1;
|
const TexMode1& tm1 = texUnit.texMode1;
|
||||||
|
|
||||||
float sDelta, tDelta;
|
float sDelta, tDelta;
|
||||||
|
|
||||||
|
float* uv00 = rasterBlock.Pixel[0][0].Uv[texcoord];
|
||||||
|
float* uv10 = rasterBlock.Pixel[1][0].Uv[texcoord];
|
||||||
|
float* uv01 = rasterBlock.Pixel[0][1].Uv[texcoord];
|
||||||
|
|
||||||
|
float dudx = fabsf(uv00[0] - uv10[0]);
|
||||||
|
float dvdx = fabsf(uv00[1] - uv10[1]);
|
||||||
|
float dudy = fabsf(uv00[0] - uv01[0]);
|
||||||
|
float dvdy = fabsf(uv00[1] - uv01[1]);
|
||||||
|
|
||||||
if (tm0.diag_lod == LODType::Diagonal)
|
if (tm0.diag_lod == LODType::Diagonal)
|
||||||
{
|
{
|
||||||
float* uv0 = rasterBlock.Pixel[0][0].Uv[texcoord];
|
sDelta = dudx + dudy;
|
||||||
float* uv1 = rasterBlock.Pixel[1][1].Uv[texcoord];
|
tDelta = dvdx + dvdy;
|
||||||
|
|
||||||
sDelta = fabsf(uv0[0] - uv1[0]);
|
|
||||||
tDelta = fabsf(uv0[1] - uv1[1]);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float* uv0 = rasterBlock.Pixel[0][0].Uv[texcoord];
|
sDelta = std::max(dudx, dudy);
|
||||||
float* uv1 = rasterBlock.Pixel[1][0].Uv[texcoord];
|
tDelta = std::max(dvdx, dvdy);
|
||||||
float* uv2 = rasterBlock.Pixel[0][1].Uv[texcoord];
|
|
||||||
|
|
||||||
sDelta = std::max(fabsf(uv0[0] - uv1[0]), fabsf(uv0[0] - uv2[0]));
|
|
||||||
tDelta = std::max(fabsf(uv0[1] - uv1[1]), fabsf(uv0[1] - uv2[1]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get LOD in s28.4
|
// get LOD in s28.4
|
||||||
|
Loading…
Reference in New Issue
Block a user