[Mesa-dev] [PATCH 2/2] glsl_to_tgsi: add support for shadow cube map sampling.

Brian Paul brianp at vmware.com
Wed Jan 11 07:27:58 PST 2012


On 01/11/2012 06:25 AM, Dave Airlie wrote:
> From: Dave Airlie<airlied at redhat.com>
>
> This along with the TGSI support lets the piglit sampler-cube-shadow
> test pass on softpipe.
>
> Signed-off-by: Dave Airlie<airlied at redhat.com>
> ---
>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp |    5 +++--
>   src/mesa/state_tracker/st_mesa_to_tgsi.c   |    1 +
>   2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index cb44e2b..a947e18 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -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;
> diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
> index ac61534..e467ffd 100644
> --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
> +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
> @@ -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;
>         }
>      }


Reviewed-by: Brian Paul <brianp at vmware.com>

BTW, the translate_texture_target() function should be renamed 
st_translate_texture_target() someday since it's not static.

-Brian


More information about the mesa-dev mailing list