[Mesa-dev] [PATCH 2/9] i915: Fix GL_DOT3_RGBA a bit

Ian Romanick idr at freedesktop.org
Thu Aug 7 17:21:55 PDT 2014


I double checked with the existing code and the extension spec.  I
believe this change is correct.  If GL_DOT3_RGBA is used, the alpha mode
is ignored.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 08/06/2014 11:56 AM, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> The spec says using DOT4 for alpha is undefined unless DOT4 is also used
> for color. It seems to do the right thing anyway, but better safe than sorry.
> 
> Also override numAlphaArgs to 2 for DOT4 since that's what it wants.
> This migth fix something in case the specified alpha mode has only one
> argument. Also avoids emitting a needless 3DSTATE_MAP_BLEND_ARG if
> the specified alpha mode has three arguments.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  src/mesa/drivers/dri/i915/i830_texblend.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i915/i830_texblend.c b/src/mesa/drivers/dri/i915/i830_texblend.c
> index 236be59..feea383 100644
> --- a/src/mesa/drivers/dri/i915/i830_texblend.c
> +++ b/src/mesa/drivers/dri/i915/i830_texblend.c
> @@ -136,7 +136,7 @@ i830SetTexEnvCombine(struct i830_context * i830,
>                       GLuint texel_op, GLuint * state, const GLfloat * factor)
>  {
>     const GLuint numColorArgs = combine->_NumArgsRGB;
> -   const GLuint numAlphaArgs = combine->_NumArgsA;
> +   GLuint numAlphaArgs = combine->_NumArgsA;
>  
>     GLuint blendop;
>     GLuint ablendop;
> @@ -209,7 +209,7 @@ i830SetTexEnvCombine(struct i830_context * i830,
>        break;
>     case GL_DOT3_RGBA_EXT:
>     case GL_DOT3_RGBA:
> -      blendop = TEXBLENDOP_DOT3;
> +      blendop = TEXBLENDOP_DOT4;
>        break;
>     default:
>        return pass_through(state, blendUnit);
> @@ -273,6 +273,7 @@ i830SetTexEnvCombine(struct i830_context * i830,
>     if (combine->ModeRGB == GL_DOT3_RGBA_EXT ||
>         combine->ModeRGB == GL_DOT3_RGBA) {
>        ablendop = TEXBLENDOP_DOT4;
> +      numAlphaArgs = 2;
>        args_A[0] = TEXBLENDARG_FACTOR;   /* the global factor */
>        args_A[1] = TEXBLENDARG_FACTOR;
>        args_A[2] = TEXBLENDARG_FACTOR;
> 



More information about the mesa-dev mailing list