summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/ff_fragment_shader.cpp
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-11-26 08:54:57 -0700
committerBrian Paul <[email protected]>2011-11-28 08:13:04 -0700
commite68994494b159d4f44e34b6b6c1d489a184a2dfe (patch)
treebc092393a00569f4749217696a6c6c98c56bc94c /src/mesa/main/ff_fragment_shader.cpp
parent56b870e44106188f425df6eb45b7a394f0420e5e (diff)
mesa: fix frag shader generation for alpha test with no color buffers
If alpha test is enabled and there's no color buffers we still need the fragment shader to emit a color. v2: add _NEW_COLOR flag in _mesa_update_state_locked() Fixes piglit fbo-alphatest-nocolor-ff failures with Gallium drivers. Reviewed-by: Eric Anholt <[email protected]> Tested-by: Eric Anholt <[email protected]> (i965)
Diffstat (limited to 'src/mesa/main/ff_fragment_shader.cpp')
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp6
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 2ce81fef61e..3d7947bae10 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 */