From b90f7f3ad324b1e4c39e334cdeb9556c3eb808ab Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 14 Dec 2009 16:16:26 -0800 Subject: 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(-) (limited to 'src/mesa/drivers/dri/i965') diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index ab301b9a3a..bac1c3a49c 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 3f9b1fbfdc..8335e5a650 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 && -- cgit v1.2.3 From f06c8bd8dd961c9b722759b5d1f8fca78023aba8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 15 Dec 2009 14:32:47 -0800 Subject: i965: Add support for OPCODE_CMP in the VS to fix GLSL sqrt() Bug #25628. Fixes piglit case glsl-vs-sqrt-zero. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/mesa/drivers/dri/i965') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 00efd3443d..27aac8b54a 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -392,6 +392,17 @@ static void emit_sge( struct brw_vs_compile *c, emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_GE); } +static void emit_cmp( struct brw_compile *p, + struct brw_reg dst, + struct brw_reg arg0, + struct brw_reg arg1, + struct brw_reg arg2 ) +{ + brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0, brw_imm_f(0)); + brw_SEL(p, dst, arg1, arg2); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); +} + static void emit_max( struct brw_compile *p, struct brw_reg dst, struct brw_reg arg0, @@ -1485,6 +1496,9 @@ void brw_vs_emit(struct brw_vs_compile *c ) brw_MOV(p, brw_acc_reg(), args[2]); brw_MAC(p, dst, args[0], args[1]); break; + case OPCODE_CMP: + emit_cmp(p, dst, args[0], args[1], args[2]); + break; case OPCODE_MAX: emit_max(p, dst, args[0], args[1]); break; -- cgit v1.2.3