[Mesa-dev] [PATCH] mesa: fix frag shader generation for alpha test with no color buffers

Ian Romanick idr at freedesktop.org
Wed Nov 23 15:08:23 PST 2011


On 11/23/2011 02:35 PM, Brian Paul wrote:
> If alpha test is enabled and there's no color buffers we still need the
> fragment shader to emit a color.
>
> Fixes piglit fbo-alphatest-nocolor-ff failures with Gallium drivers.

It looks like this an Eric's recent patch 
(http://lists.freedesktop.org/archives/mesa-dev/2011-November/015049.html) 
may trip over each other.  You guys should sort this out.

> ---
>   src/mesa/main/ff_fragment_shader.cpp |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
> index 2ce81fe..3d7947b 100644
> --- a/src/mesa/main/ff_fragment_shader.cpp
> +++ b/src/mesa/main/ff_fragment_shader.cpp
> @@ -489,6 +489,12 @@ static GLuint make_state_key( struct gl_context *ctx,  struct state_key *key )
>      /* _NEW_BUFFERS */
>      key->num_draw_buffers = ctx->DrawBuffer->_NumColorDrawBuffers;
>
> +   /* _NEW_COLOR */
> +   if (ctx->Color.AlphaEnabled&&  key->num_draw_buffers == 0) {
> +      /* if alpha test is enabled we need to emit at least one color */
> +      key->num_draw_buffers = 1;
> +   }
> +
>      key->inputs_available = (inputs_available&  inputs_referenced);
>
>      /* compute size of state key, ignoring unused texture units */


More information about the mesa-dev mailing list