softpipe: Correct repeat-mirror evaluation
when mirroring the texture corrdinates the indices must be mirrored as well and the half pixel shift must be applied in reverse. Fixes a number of tests from: dEQP-GLES31.functional.texture.gather.offset.* dEQP-GLES31.functional.texture.gather.offsets.* Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
@@ -333,20 +333,34 @@ wrap_linear_mirror_repeat(float s, unsigned size, int offset,
|
||||
{
|
||||
int flr;
|
||||
float u;
|
||||
bool no_mirror;
|
||||
|
||||
s += (float)offset / size;
|
||||
flr = util_ifloor(s);
|
||||
no_mirror = !(flr & 1);
|
||||
|
||||
u = frac(s);
|
||||
if (flr & 1)
|
||||
if (no_mirror) {
|
||||
u = u * size - 0.5F;
|
||||
} else {
|
||||
u = 1.0F - u;
|
||||
u = u * size - 0.5F;
|
||||
u = u * size + 0.5F;
|
||||
}
|
||||
|
||||
*icoord0 = util_ifloor(u);
|
||||
*icoord1 = *icoord0 + 1;
|
||||
*icoord1 = (no_mirror) ? *icoord0 + 1 : *icoord0 - 1;
|
||||
|
||||
if (*icoord0 < 0)
|
||||
*icoord0 = 0;
|
||||
*icoord0 = 1 + *icoord0;
|
||||
if (*icoord0 >= (int) size)
|
||||
*icoord0 = size - 1;
|
||||
|
||||
if (*icoord1 >= (int) size)
|
||||
*icoord1 = size - 1;
|
||||
*w = frac(u);
|
||||
if (*icoord1 < 0)
|
||||
*icoord1 = 1 + *icoord1;
|
||||
|
||||
*w = (no_mirror) ? frac(u) : frac(1.0f - u);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user