On Wed, 2009-11-11 at 16:58 -0800, Zack Rusin wrote:
> Module: Mesa
> Branch: master
> Commit: 2cfbbc76e445d88bdac7dd4dd22aaf36bbc8e4cc
> URL:    
> http://cgit.freedesktop.org/mesa/mesa/commit/?id=2cfbbc76e445d88bdac7dd4dd22aaf36bbc8e4cc
> 
> Author: Zack Rusin <[email protected]>
> Date:   Wed Nov 11 19:52:08 2009 -0500
> 
> st/xorg: implement repeatnone and make some code smell less like ass
> 
> ---
> 
>  src/gallium/state_trackers/xorg/xorg_composite.c |    9 ++-
>  src/gallium/state_trackers/xorg/xorg_exa.c       |    2 -
>  src/gallium/state_trackers/xorg/xorg_exa_tgsi.c  |   75 
> +++++++++++++++++-----
>  src/gallium/state_trackers/xorg/xorg_exa_tgsi.h  |    4 +-
>  4 files changed, 67 insertions(+), 23 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c 
> b/src/gallium/state_trackers/xorg/xorg_composite.c
> index 2689dae..02dc949 100644
> --- a/src/gallium/state_trackers/xorg/xorg_composite.c
> +++ b/src/gallium/state_trackers/xorg/xorg_composite.c
> @@ -199,10 +199,6 @@ boolean xorg_composite_accelerated(int op,
>                            op);
>           }
>        }
> -      if ((pSrcPicture && pSrcPicture->repeatType == RepeatNone) ||
> -          (pMaskPicture && pMaskPicture->repeatType == RepeatNone)) {
> -         XORG_FALLBACK("RepeatNone is not supported");
> -      }
>  
>        return TRUE;
>     }
> @@ -243,6 +239,9 @@ bind_shaders(struct exa_context *exa, int op,
>     exa->has_solid_color = FALSE;
>  
>     if (pSrcPicture) {
> +      if (pSrcPicture->repeatType == RepeatNone && pSrcPicture->transform)
> +         fs_traits |= FS_SRC_REPEAT_NONE;
> +
>        if (pSrcPicture->pSourcePict) {
>           if (pSrcPicture->pSourcePict->type == SourcePictTypeSolidFill) {
>              fs_traits |= FS_SOLID_FILL;
> @@ -263,6 +262,8 @@ bind_shaders(struct exa_context *exa, int op,
>     if (pMaskPicture) {
>        vs_traits |= VS_MASK;
>        fs_traits |= FS_MASK;
> +      if (pMaskPicture->repeatType == RepeatNone && pMaskPicture->transform)
> +         fs_traits |= FS_MASK_REPEAT_NONE;
>        if (pMaskPicture->componentAlpha) {
>           struct xorg_composite_blend blend;
>           blend_for_op(&blend, op,
> diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c 
> b/src/gallium/state_trackers/xorg/xorg_exa.c
> index c71779b..a77ee7a 100644
> --- a/src/gallium/state_trackers/xorg/xorg_exa.c
> +++ b/src/gallium/state_trackers/xorg/xorg_exa.c
> @@ -51,7 +51,6 @@
>  /*
>   * Helper functions
>   */
> -#if DEBUG_PRINT
>  struct render_format_str {
>     int format;
>     const char *name;
> @@ -109,7 +108,6 @@ static const char *render_format_name(int format)
>     }
>     return NULL;
>  }
> -#endif
>  
>  static void
>  exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp, int 
> *picture_format)
> diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c 
> b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
> index 83cc12f..5880de4 100644
> --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
> +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
> @@ -233,10 +233,10 @@ create_vs(struct pipe_context *pipe,
>     struct ureg_src src;
>     struct ureg_dst dst;
>     struct ureg_src const0, const1;
> -   boolean is_fill = vs_traits & VS_FILL;
> -   boolean is_composite = vs_traits & VS_COMPOSITE;
> -   boolean has_mask = vs_traits & VS_MASK;
> -   boolean is_yuv = vs_traits & VS_YUV;
> +   boolean is_fill = (vs_traits & VS_FILL) != 0;
> +   boolean is_composite = (vs_traits & VS_COMPOSITE) != 0;
> +   boolean has_mask = (vs_traits & VS_MASK) != 0;
> +   boolean is_yuv = (vs_traits & VS_YUV) != 0;
>     unsigned input_slot = 0;
>  
>     ureg = ureg_create(TGSI_PROCESSOR_VERTEX);
> @@ -353,6 +353,47 @@ create_yuv_shader(struct pipe_context *pipe, struct 
> ureg_program *ureg)
>     return ureg_create_shader_and_destroy(ureg, pipe);
>  }
>  
> +
> +static INLINE void
> +xrender_tex(struct ureg_program *ureg,
> +            struct ureg_dst dst,
> +            struct ureg_src coords,
> +            struct ureg_src sampler,
> +            boolean repeat_none)
> +{
> +   if (repeat_none) {
> +      struct ureg_dst tmp0 = ureg_DECL_temporary(ureg);
> +      struct ureg_dst tmp1 = ureg_DECL_temporary(ureg);
> +      struct ureg_src const0 = ureg_DECL_constant(ureg, 0);
> +      unsigned label;
> +      ureg_SLT(ureg, tmp1, ureg_swizzle(coords,
> +                                        TGSI_SWIZZLE_X,
> +                                        TGSI_SWIZZLE_Y,
> +                                        TGSI_SWIZZLE_X,
> +                                        TGSI_SWIZZLE_Y),
> +               ureg_scalar(const0, TGSI_SWIZZLE_X));
> +      ureg_SGT(ureg, tmp0, ureg_swizzle(coords,
> +                                        TGSI_SWIZZLE_X,
> +                                        TGSI_SWIZZLE_Y,
> +                                        TGSI_SWIZZLE_X,
> +                                        TGSI_SWIZZLE_Y),
> +               ureg_scalar(const0, TGSI_SWIZZLE_W));
> +      ureg_MAX(ureg, tmp0, ureg_src(tmp0), ureg_src(tmp1));
> +      ureg_MAX(ureg, tmp0, ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_X),
> +               ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_Y));
> +      label = ureg_get_instruction_number(ureg) + 2;
> +      ureg_IF(ureg, ureg_src(tmp0), &label);
> +      ureg_MOV(ureg, dst, ureg_scalar(const0, TGSI_SWIZZLE_X));
> +      label += 2;
> +      ureg_ELSE(ureg, &label);
> +      ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, coords, sampler);
> +      ureg_ENDIF(ureg);


Zack,

Instead of using an if-then-else here (and introducing a dependency on
flow-control in the driver), would it be possible to do the TEX
unconditionally, then do comparisons to selectively overwrite the result
with const0.x?

Also, could const0 really be an immediate or does it change over time?

Keith


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to