diff options
| author | JMC47 <JMC4789@gmail.com> | 2021-11-18 13:08:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-18 13:08:23 -0500 |
| commit | 6f4bbac528682389e34a1a4985820ee5137619c7 (patch) | |
| tree | 9f07e21fa1da14c7485fddac611a2618888afcf0 /Source/Core/VideoBackends/Software/Rasterizer.cpp | |
| parent | 8b57aad8edd82ccc414775d22e96d896bcac6176 (diff) | |
| parent | 95b99410443e7ae47df1f3e9436e275c80dd3678 (diff) | |
Merge pull request #9956 from Pokechu22/non-power-of-2-wrap-2
VideoCommon: Manually handle texture wrapping and sampling
Diffstat (limited to 'Source/Core/VideoBackends/Software/Rasterizer.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Software/Rasterizer.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Source/Core/VideoBackends/Software/Rasterizer.cpp b/Source/Core/VideoBackends/Software/Rasterizer.cpp index df04ab5a31..f886858124 100644 --- a/Source/Core/VideoBackends/Software/Rasterizer.cpp +++ b/Source/Core/VideoBackends/Software/Rasterizer.cpp @@ -171,22 +171,25 @@ static inline void CalculateLOD(s32* lodp, bool* linear, u32 texmap, u32 texcoor const TexMode1& tm1 = texUnit.texMode1; 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) { - float* uv0 = rasterBlock.Pixel[0][0].Uv[texcoord]; - float* uv1 = rasterBlock.Pixel[1][1].Uv[texcoord]; - - sDelta = fabsf(uv0[0] - uv1[0]); - tDelta = fabsf(uv0[1] - uv1[1]); + sDelta = dudx + dudy; + tDelta = dvdx + dvdy; } else { - float* uv0 = rasterBlock.Pixel[0][0].Uv[texcoord]; - float* uv1 = rasterBlock.Pixel[1][0].Uv[texcoord]; - 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])); + sDelta = std::max(dudx, dudy); + tDelta = std::max(dvdx, dvdy); } // get LOD in s28.4 |
