diff options
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_cc.c | 15 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_render.c | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_state.c | 40 |
4 files changed, 31 insertions, 43 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index fa8121e02d..abae4b3215 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -84,6 +84,7 @@ static void cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key) { struct gl_stencil_attrib *stencil = brw->attribs.Stencil; + const unsigned back = stencil->_BackFace; memset(key, 0, sizeof(*key)); @@ -100,13 +101,13 @@ cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key) key->stencil_test_mask[0] = stencil->ValueMask[0]; } if (key->stencil_two_side) { - key->stencil_func[1] = stencil->Function[1]; - key->stencil_fail_op[1] = stencil->FailFunc[1]; - key->stencil_pass_depth_fail_op[1] = stencil->ZFailFunc[1]; - key->stencil_pass_depth_pass_op[1] = stencil->ZPassFunc[1]; - key->stencil_ref[1] = stencil->Ref[1]; - key->stencil_write_mask[1] = stencil->WriteMask[1]; - key->stencil_test_mask[1] = stencil->ValueMask[1]; + key->stencil_func[1] = stencil->Function[back]; + key->stencil_fail_op[1] = stencil->FailFunc[back]; + key->stencil_pass_depth_fail_op[1] = stencil->ZFailFunc[back]; + key->stencil_pass_depth_pass_op[1] = stencil->ZPassFunc[back]; + key->stencil_ref[1] = stencil->Ref[back]; + key->stencil_write_mask[1] = stencil->WriteMask[back]; + key->stencil_test_mask[1] = stencil->ValueMask[back]; } if (brw->attribs.Color->_LogicOpEnabled) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index c50b0d2dd9..24149cf8a1 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -189,8 +189,7 @@ static void brw_wm_populate_key( struct brw_context *brw, lookup |= IZ_STENCIL_TEST_ENABLE_BIT; if (brw->attribs.Stencil->WriteMask[0] || - (brw->attribs.Stencil->_TestTwoSide && - brw->attribs.Stencil->WriteMask[1])) + brw->attribs.Stencil->WriteMask[brw->attribs.Stencil->_BackFace]) lookup |= IZ_STENCIL_WRITE_ENABLE_BIT; } diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index f9266e44c1..16ce4a1199 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -347,6 +347,8 @@ static GLboolean r300RunRender(GLcontext * ctx, static int r300Fallback(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); + const unsigned back = ctx->Stencil._BackFace; + /* Do we need to use new-style shaders? * Also is there a better way to do this? */ if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { @@ -371,12 +373,14 @@ static int r300Fallback(GLcontext * ctx) FALLBACK_IF(ctx->RenderMode != GL_RENDER); - FALLBACK_IF(ctx->Stencil._TestTwoSide - && (ctx->Stencil.Ref[0] != ctx->Stencil.Ref[1] - || ctx->Stencil.ValueMask[0] != - ctx->Stencil.ValueMask[1] - || ctx->Stencil.WriteMask[0] != - ctx->Stencil.WriteMask[1])); + /* If GL_EXT_stencil_two_side is disabled, this fallback check can + * be removed. + */ + FALLBACK_IF(ctx->Stencil.Ref[0] != ctx->Stencil.Ref[back] + || ctx->Stencil.ValueMask[0] != + ctx->Stencil.ValueMask[back] + || ctx->Stencil.WriteMask[0] != + ctx->Stencil.WriteMask[back]); if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) FALLBACK_IF(ctx->Point.PointSprite); diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index a63dbac343..d02034f039 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -974,15 +974,9 @@ static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, { r300ContextPtr rmesa = R300_CONTEXT(ctx); GLuint refmask = - (((ctx->Stencil. - Ref[0] & 0xff) << R300_STENCILREF_SHIFT) | ((ctx-> - Stencil. - ValueMask - [0] & - 0xff) - << - R300_STENCILMASK_SHIFT)); - + ((ctx->Stencil.Ref[0] & 0xff) << R300_STENCILREF_SHIFT) + | ((ctx->Stencil.ValueMask[0] & 0xff) << R300_STENCILMASK_SHIFT); + const unsigned back = ctx->Stencil._BackFace; GLuint flag; R300_STATECHANGE(rmesa, zs); @@ -1000,8 +994,7 @@ static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= (flag << R300_S_FRONT_FUNC_SHIFT); - if (ctx->Stencil._TestTwoSide) - flag = translate_func(ctx->Stencil.Function[1]); + flag = translate_func(ctx->Stencil.Function[back]); rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= (flag << R300_S_BACK_FUNC_SHIFT); @@ -1026,6 +1019,7 @@ static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { r300ContextPtr rmesa = R300_CONTEXT(ctx); + const unsigned back = ctx->Stencil._BackFace; R300_STATECHANGE(rmesa, zs); /* It is easier to mask what's left.. */ @@ -1042,23 +1036,13 @@ static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, | (translate_stencil_op(ctx->Stencil.ZPassFunc[0]) << R300_S_FRONT_ZPASS_OP_SHIFT); - if (ctx->Stencil._TestTwoSide) { - rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= - (translate_stencil_op(ctx->Stencil.FailFunc[1]) << - R300_S_BACK_SFAIL_OP_SHIFT) - | (translate_stencil_op(ctx->Stencil.ZFailFunc[1]) << - R300_S_BACK_ZFAIL_OP_SHIFT) - | (translate_stencil_op(ctx->Stencil.ZPassFunc[1]) << - R300_S_BACK_ZPASS_OP_SHIFT); - } else { - rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= - (translate_stencil_op(ctx->Stencil.FailFunc[0]) << - R300_S_BACK_SFAIL_OP_SHIFT) - | (translate_stencil_op(ctx->Stencil.ZFailFunc[0]) << - R300_S_BACK_ZFAIL_OP_SHIFT) - | (translate_stencil_op(ctx->Stencil.ZPassFunc[0]) << - R300_S_BACK_ZPASS_OP_SHIFT); - } + rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= + (translate_stencil_op(ctx->Stencil.FailFunc[back]) << + R300_S_BACK_SFAIL_OP_SHIFT) + | (translate_stencil_op(ctx->Stencil.ZFailFunc[back]) << + R300_S_BACK_ZFAIL_OP_SHIFT) + | (translate_stencil_op(ctx->Stencil.ZPassFunc[back]) << + R300_S_BACK_ZPASS_OP_SHIFT); } /* ============================================================= |