summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-12-19 10:34:20 +0000
committerDave Airlie <[email protected]>2011-12-19 20:44:47 +0000
commit97b778efe7949977b4e857413807d1efcad346aa (patch)
tree61fa94e3114b68fbcf931d76d9f4fbbbb67bee2a /src/gallium/drivers
parentf4ab1783b390cd8ff7f4b1e7ba9fc15893e2d69c (diff)
softpipe: fix shadow 2d texture array sampling
The 4th texcoord is used in this case for the comparison. This fixes piglit glsl-fs-shadow2DArray* on softpipe. Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 43f201f7784..8123d7bfb1a 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -2113,15 +2113,22 @@ sample_compare(struct tgsi_sampler *tgsi_sampler,
/**
* Compare texcoord 'p' (aka R) against texture value 'rgba[0]'
+ * for 2D Array texture we need to use the 'c0' (aka Q).
* When we sampled the depth texture, the depth value was put into all
* RGBA channels. We look at the red channel here.
*/
- pc0 = CLAMP(p[0], 0.0F, 1.0F);
- pc1 = CLAMP(p[1], 0.0F, 1.0F);
- pc2 = CLAMP(p[2], 0.0F, 1.0F);
- pc3 = CLAMP(p[3], 0.0F, 1.0F);
-
+ if (samp->view->texture->target == PIPE_TEXTURE_2D_ARRAY) {
+ pc0 = CLAMP(c0[0], 0.0F, 1.0F);
+ pc1 = CLAMP(c0[1], 0.0F, 1.0F);
+ pc2 = CLAMP(c0[2], 0.0F, 1.0F);
+ pc3 = CLAMP(c0[3], 0.0F, 1.0F);
+ } else {
+ pc0 = CLAMP(p[0], 0.0F, 1.0F);
+ pc1 = CLAMP(p[1], 0.0F, 1.0F);
+ pc2 = CLAMP(p[2], 0.0F, 1.0F);
+ pc3 = CLAMP(p[3], 0.0F, 1.0F);
+ }
/* compare four texcoords vs. four texture samples */
switch (sampler->compare_func) {
case PIPE_FUNC_LESS: