softpipe: Fix cube arrays layer selection

To select the correct layer the z-coordinate must be rounded before it
is multiplied by six.

Fixes a number of tests out of
   dEQP-GLES31.functional.texture.filtering.cube_array.formats.*

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
Gert Wollny 2019-07-18 08:21:39 +02:00
parent 6659d11ff0
commit 45ac0dfad4

View file

@ -1457,10 +1457,9 @@ img_filter_cube_array_nearest(const struct sp_sampler_view *sp_sview,
const struct pipe_resource *texture = sp_sview->base.texture;
const int width = u_minify(texture->width0, args->level);
const int height = u_minify(texture->height0, args->level);
const int layerface =
coord_to_layer(6 * args->p + sp_sview->base.u.tex.first_layer,
sp_sview->base.u.tex.first_layer,
sp_sview->base.u.tex.last_layer - 5) + args->face_id;
const int layerface = CLAMP(6 * util_ifloor(args->p + 0.5f) + sp_sview->base.u.tex.first_layer,
sp_sview->base.u.tex.first_layer,
sp_sview->base.u.tex.last_layer - 5) + args->face_id;
int x, y;
union tex_tile_address addr;
const float *out;
@ -1811,10 +1810,11 @@ img_filter_cube_array_linear(const struct sp_sampler_view *sp_sview,
const struct pipe_resource *texture = sp_sview->base.texture;
const int width = u_minify(texture->width0, args->level);
const int height = u_minify(texture->height0, args->level);
const int layer =
coord_to_layer(6 * args->p + sp_sview->base.u.tex.first_layer,
sp_sview->base.u.tex.first_layer,
sp_sview->base.u.tex.last_layer - 5);
const int layer = CLAMP(6 * util_ifloor(args->p + 0.5f) + sp_sview->base.u.tex.first_layer,
sp_sview->base.u.tex.first_layer,
sp_sview->base.u.tex.last_layer - 5);
int x0, y0, x1, y1;
float xw, yw; /* weights */
union tex_tile_address addr;