glsl_to_tgsi: add support for shadow cube map sampling.
authorDave Airlie <airlied@redhat.com>
Wed, 11 Jan 2012 13:23:38 +0000 (13:23 +0000)
committerDave Airlie <airlied@redhat.com>
Wed, 11 Jan 2012 17:35:25 +0000 (17:35 +0000)
This along with the TGSI support lets the piglit sampler-cube-shadow
test pass on softpipe.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp
src/mesa/state_tracker/st_mesa_to_tgsi.c

index cb44e2b95b3dc070862154bb739f99e207998349..a947e186b50b12c567dd57706dfc157c6ac45910 100644 (file)
@@ -2646,8 +2646,9 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
       ir->shadow_comparitor->accept(this);
 
       /* XXX This will need to be updated for cubemap array samplers. */
-      if (sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_2D &&
-          sampler_type->sampler_array) {
+      if ((sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_2D &&
+          sampler_type->sampler_array) ||
+         sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) {
          coord_dst.writemask = WRITEMASK_W;
       } else {
          coord_dst.writemask = WRITEMASK_Z;
index ac615343ae3b0d443b07e6d01e22aae226745bb5..e467ffd56add5324ffb94c37835a4f143628da8a 100644 (file)
@@ -279,6 +279,7 @@ translate_texture_target( GLuint textarget,
       case TEXTURE_RECT_INDEX: return TGSI_TEXTURE_SHADOWRECT;
       case TEXTURE_1D_ARRAY_INDEX: return TGSI_TEXTURE_SHADOW1D_ARRAY;
       case TEXTURE_2D_ARRAY_INDEX: return TGSI_TEXTURE_SHADOW2D_ARRAY;
+      case TEXTURE_CUBE_INDEX: return TGSI_TEXTURE_SHADOWCUBE;
       default: break;
       }
    }