Mesa (mesa_7_7_branch): i965: Use current draw buffer instead of drawable visual to get alpha bits

Ian Romanick idr at kemper.freedesktop.org
Tue Dec 15 00:36:29 UTC 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: b90f7f3ad324b1e4c39e334cdeb9556c3eb808ab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b90f7f3ad324b1e4c39e334cdeb9556c3eb808ab

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Dec 14 16:16:26 2009 -0800

i965: Use current draw buffer instead of drawable visual to get alpha bits

Use the currently bound draw buffer instead of the visual from the
drawable used to create the context.  This cause problems generating
mipmaps for an RGBA texture in an RGB context.

This fixes the failure in piglit's glsl-lod-bias test reported in bug #25614.

---

 src/mesa/drivers/dri/i965/brw_cc.c               |    4 ++--
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c
index ab301b9..bac1c3a 100644
--- a/src/mesa/drivers/dri/i965/brw_cc.c
+++ b/src/mesa/drivers/dri/i965/brw_cc.c
@@ -158,9 +158,9 @@ cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key)
 
       /* If the renderbuffer is XRGB, we have to frob the blend function to
        * force the destination alpha to 1.0.  This means replacing GL_DST_ALPHA
-       * with GL_ONE and GL_ONE_MINUS_DST_ALPAH with GL_ZERO.
+       * with GL_ONE and GL_ONE_MINUS_DST_ALPHA with GL_ZERO.
        */
-      if (ctx->Visual.alphaBits == 0) {
+      if (ctx->DrawBuffer->Visual.alphaBits == 0) {
 	 key->blend_src_rgb = fix_xRGB_alpha(key->blend_src_rgb);
 	 key->blend_src_a   = fix_xRGB_alpha(key->blend_src_a);
 	 key->blend_dst_rgb = fix_xRGB_alpha(key->blend_dst_rgb);
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 3f9b1fb..8335e5a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -581,7 +581,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
    /* As mentioned above, disable writes to the alpha component when the
     * renderbuffer is XRGB.
     */
-   if (ctx->Visual.alphaBits == 0)
+   if (ctx->DrawBuffer->Visual.alphaBits == 0)
      key.color_mask[3] = GL_FALSE;
 
    key.color_blend = (!ctx->Color._LogicOpEnabled &&




More information about the mesa-commit mailing list