Skip to content

Commit 4a173b0

Browse files
committed
Extra floating point safety...
1 parent c2f859f commit 4a173b0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/backend/mode_gpu.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,11 @@
362362
' vec3 xyz = vec3(floor(x + 0.5), floor(y + 0.5), floor(z + 0.5));',
363363
(opt.wraparound ? ' xyz = mod(xyz, texDim);' : ''),
364364
' float index = (xyz.z * texDim.x * texDim.y) + (xyz.y * texDim.x) + xyz.x;',
365-
' float t = (floor(index / texSize.x) + 0.5);',
365+
' float t = floor(index / texSize.x);',
366366
' float s = mod(index, texSize.x);',
367367
(opt.safeTextureReadHack ? 's += 1.0; t += 1.0;' : ''),
368368
' s = (s < 0.5) ? 0.0 : s + 0.5;',
369+
' t = (t < 0.5) ? 0.0 : t + 0.5;',
369370
(opt.safeTextureReadHack ? 'return decode32(texture2D(tex, vec2(s / (texSize.x + 2.0), t / (texSize.y + 2.0))));' : ''),
370371
' return decode32(texture2D(tex, vec2(s / texSize.x, t / texSize.y)));',
371372
'}',

0 commit comments

Comments
 (0)