Fix negative texel wrapping in softgpu.

No longer crashes in Jeanne d'Arc, still looks awful.
Also faster on x64 at least.
This commit is contained in:
Unknown W. Brackets committed 2013-09-02 21:29:19 -07:00
1 parent faa5d62e4e
commit 2006bdc6a3
1 file changed
+4 -4
+4 -4
View File
@@ -104,15 +104,15 @@ static inline void GetTexelCoordinates(int level, float s, float t, unsigned int
if (s > 1.0) s = 1.0;
if (s < 0) s = 0;
} else {
// TODO: Does this work for negative coords?
s = fmod(s, 1.0f);
// Subtracting floor works for negative and positive to discard the non-fractional part.
s -= floor(s);
}
if (gstate.isTexCoordClampedT()) {
if (t > 1.0) t = 1.0;
if (t < 0.0) t = 0.0;
} else {
// TODO: Does this work for negative coords?
t = fmod(t, 1.0f);
// Subtracting floor works for negative and positive to discard the non-fractional part.
t -= floor(t);
}
int width = 1 << (gstate.texsize[level] & 0xf);