summaryrefslogtreecommitdiffstats
path: root/src/hgl
diff options
context:
space:
mode:
authorJeff Muizelaar <[email protected]>2014-02-15 02:34:39 +0100
committerRoland Scheidegger <[email protected]>2014-03-14 19:41:18 +0100
commit88637e5764d475aa7ad140e20bdd12bcbe61cf18 (patch)
tree2675a2f6f2bcf42508089b8503e3ec55b31ede3b /src/hgl
parent6757ec3f8edd7ac509a1ec30d3d8c49462ade545 (diff)
gallivm: use correct rounding for linear wrap mode (in the aos int path)
The previous method for converting coords to ints was sligthly inaccurate (effectively losing 1bit from the 8bit lerp weight). This is probably especially noticeable when trying to draw a pixel-aligned texture. As an example, for a 100x100 texture after dernormalization the texture coords in this case would turn up as 0.5, 1.5, 2.5, 3.5, 4.5, ... After the mul by 256, conversion to int and 128 subtraction, they end up as 0, 256, 512, 768, 1024, ... which gets us the correct coords/weights of 0/0, 1/0, 2/0, 3/0, 4/0, ... But even LSB errors (which are unavoidable) in the input coords may cause these coords/weights to be wrong, e.g. for a coord of 3.49999 we'd get a coord/weight of 2/255 instead. Fix this by using round-to-nearest int instead of FPToSi (trunc). Should be equally fast on x86 sse though other archs probably suffer a little.
Diffstat (limited to 'src/hgl')
0 files changed, 0 insertions, 0 deletions