softpipe: evaluate cube the faces on a per sample bases

Now that the LOD is evaluated up front the cube faces can also be
evauate on a per sample basis instead of using the quad.

This fixes a large number of deqp gles 3 and 31 cube texture tests.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
Gert Wollny 2019-04-19 09:26:49 +02:00
parent aacdce2879
commit 7d5c8d3589
1 changed files with 16 additions and 24 deletions

View File

@ -3253,45 +3253,36 @@ convert_cube(const struct sp_sampler_view *sp_sview,
* deriviates to compute the LOD. Doing so (near cube edges
* anyway) gives us pretty much random values.
*/
{
/* use the average of the four pixel's texcoords to choose the face */
const float rx = 0.25F * (s[0] + s[1] + s[2] + s[3]);
const float ry = 0.25F * (t[0] + t[1] + t[2] + t[3]);
const float rz = 0.25F * (p[0] + p[1] + p[2] + p[3]);
for (j = 0; j < TGSI_QUAD_SIZE; j++) {
const float rx = s[j], ry = t[j], rz = p[j];
const float arx = fabsf(rx), ary = fabsf(ry), arz = fabsf(rz);
if (arx >= ary && arx >= arz) {
const float sign = (rx >= 0.0F) ? 1.0F : -1.0F;
const uint face = (rx >= 0.0F) ?
PIPE_TEX_FACE_POS_X : PIPE_TEX_FACE_NEG_X;
for (j = 0; j < TGSI_QUAD_SIZE; j++) {
const float ima = -0.5F / fabsf(s[j]);
ssss[j] = sign * p[j] * ima + 0.5F;
tttt[j] = t[j] * ima + 0.5F;
faces[j] = face;
}
const float ima = -0.5F / fabsf(s[j]);
ssss[j] = sign * p[j] * ima + 0.5F;
tttt[j] = t[j] * ima + 0.5F;
faces[j] = face;
}
else if (ary >= arx && ary >= arz) {
const float sign = (ry >= 0.0F) ? 1.0F : -1.0F;
const uint face = (ry >= 0.0F) ?
PIPE_TEX_FACE_POS_Y : PIPE_TEX_FACE_NEG_Y;
for (j = 0; j < TGSI_QUAD_SIZE; j++) {
const float ima = -0.5F / fabsf(t[j]);
ssss[j] = -s[j] * ima + 0.5F;
tttt[j] = sign * -p[j] * ima + 0.5F;
faces[j] = face;
}
const float ima = -0.5F / fabsf(t[j]);
ssss[j] = -s[j] * ima + 0.5F;
tttt[j] = sign * -p[j] * ima + 0.5F;
faces[j] = face;
}
else {
const float sign = (rz >= 0.0F) ? 1.0F : -1.0F;
const uint face = (rz >= 0.0F) ?
PIPE_TEX_FACE_POS_Z : PIPE_TEX_FACE_NEG_Z;
for (j = 0; j < TGSI_QUAD_SIZE; j++) {
const float ima = -0.5F / fabsf(p[j]);
ssss[j] = sign * -s[j] * ima + 0.5F;
tttt[j] = t[j] * ima + 0.5F;
faces[j] = face;
}
const float ima = -0.5F / fabsf(p[j]);
ssss[j] = sign * -s[j] * ima + 0.5F;
tttt[j] = t[j] * ima + 0.5F;
faces[j] = face;
}
}
}
@ -3571,9 +3562,10 @@ softpipe_get_lambda_func(const struct pipe_sampler_view *view,
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_2D_ARRAY:
case PIPE_TEXTURE_RECT:
return compute_lambda_2d;
case PIPE_TEXTURE_CUBE:
case PIPE_TEXTURE_CUBE_ARRAY:
return compute_lambda_2d;
return compute_lambda_cube;
case PIPE_TEXTURE_3D:
return compute_lambda_3d;
default: