[Mesa-dev] [PATCH] i965: Avoid segfault in gen6_upload_state

Carl Worth cworth at cworth.org
Wed Feb 20 11:23:41 PST 2013

This fixes a bug introduced in commit 258453716f001eab1288d99765213 and
triggered whenever "rb" is NULL. This uses the same condition as similar
code in brw_cc.c (used for older hardware).

Fixes bug #59445:

	[SNB/IVB/HSW Bisected]Oglc draw-buffers2(advanced.blending.none) segfault

Ian Romanick <idr at freedesktop.org> writes:
> Either way, ctx->DrawBuffer->Visual contains either the window 
> configuration or a mirror of the state for the current FBO.  It should 
> always be safe to use that.  Using ctx->DrawBuffer->Visual.alphaBits 
> will ensure that you get the correct answer even when rb is NULL.

OK. Here's a patch that does exactly that.


 src/mesa/drivers/dri/i965/gen6_cc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c
index d32f636..a7ff573 100644
--- a/src/mesa/drivers/dri/i965/gen6_cc.c
+++ b/src/mesa/drivers/dri/i965/gen6_cc.c
@@ -126,7 +126,7 @@ gen6_upload_blend_state(struct brw_context *brw)
           * not read the alpha channel, but will instead use the correct
           * implicit value for alpha.
-         if (!_mesa_base_format_has_channel(rb->_BaseFormat, GL_TEXTURE_ALPHA_TYPE))
+         if (ctx->DrawBuffer->Visual.alphaBits == 0)
             srcRGB = brw_fix_xRGB_alpha(srcRGB);
             srcA = brw_fix_xRGB_alpha(srcA);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130220/7c7a8039/attachment.pgp>

More information about the mesa-dev mailing list