summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2019-07-18 08:21:39 +0200
committerGert Wollny <[email protected]>2019-07-29 15:47:34 +0200
commit45ac0dfad4f614dda4c9e42ac5c3479096a16f9b (patch)
treeeac60d888e2abcf3bb19b04fb4a01bc9ab58ccb7 /src/gallium
parent6659d11ff0c639c49823fdaa0cf23c7fef7f2582 (diff)
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 <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index c8aec271a69..b11ab21a04b 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -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;