diff options
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_cc.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_misc_state.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen8_depth_state.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/genX_state_upload.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_pixel.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_pixel_copy.c | 3 |
10 files changed, 29 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index 78d3bc86d13..f0aa7b89704 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -72,7 +72,7 @@ static void upload_cc_unit(struct brw_context *brw) memset(cc, 0, sizeof(*cc)); /* _NEW_STENCIL | _NEW_BUFFERS */ - if (ctx->Stencil._Enabled) { + if (brw->stencil_enabled) { const unsigned back = ctx->Stencil._BackFace; cc->cc0.stencil_enable = 1; @@ -88,7 +88,7 @@ static void upload_cc_unit(struct brw_context *brw) cc->cc1.stencil_write_mask = ctx->Stencil.WriteMask[0]; cc->cc1.stencil_test_mask = ctx->Stencil.ValueMask[0]; - if (ctx->Stencil._TestTwoSide) { + if (brw->stencil_two_sided) { cc->cc0.bf_stencil_enable = 1; cc->cc0.bf_stencil_func = intel_translate_compare_func(ctx->Stencil.Function[back]); @@ -106,7 +106,7 @@ static void upload_cc_unit(struct brw_context *brw) /* Not really sure about this: */ if (ctx->Stencil.WriteMask[0] || - (ctx->Stencil._TestTwoSide && ctx->Stencil.WriteMask[back])) + (brw->stencil_two_sided && ctx->Stencil.WriteMask[back])) cc->cc0.stencil_write_enable = 1; } diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 05b0d8d04ec..ec87817c517 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -43,6 +43,7 @@ #include "main/vtxfmt.h" #include "main/texobj.h" #include "main/framebuffer.h" +#include "main/stencil.h" #include "vbo/vbo_context.h" @@ -201,6 +202,13 @@ intel_update_state(struct gl_context * ctx) _mesa_unlock_context_textures(ctx); + if (new_state & (_NEW_STENCIL | _NEW_BUFFERS)) { + brw->stencil_enabled = _mesa_stencil_is_enabled(ctx); + brw->stencil_two_sided = _mesa_stencil_is_two_sided(ctx); + brw->stencil_write_enabled = + _mesa_stencil_is_write_enabled(ctx, brw->stencil_two_sided); + } + intel_prepare_render(brw); /* Resolve the depth buffer's HiZ buffer. */ diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index f4b5b8335fe..2eea3030115 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -774,6 +774,11 @@ struct brw_context */ bool needs_unlit_centroid_workaround; + /** Derived stencil states. */ + bool stencil_enabled; + bool stencil_two_sided; + bool stencil_write_enabled; + struct isl_device isl_dev; struct blorp_context blorp; diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index d1309ac4837..821f1e24e94 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -391,7 +391,7 @@ brw_postdraw_set_buffers_need_resolve(struct brw_context *brw) } if (ctx->Extensions.ARB_stencil_texturing && - stencil_irb && ctx->Stencil._WriteEnabled) { + stencil_irb && brw->stencil_write_enabled) { brw_render_cache_set_add_bo(brw, stencil_irb->mt->bo); } diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 0f075a11f75..a93f4c50379 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -474,7 +474,7 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key) lookup |= BRW_WM_IZ_DEPTH_WRITE_ENABLE_BIT; /* _NEW_STENCIL | _NEW_BUFFERS */ - if (ctx->Stencil._Enabled) { + if (brw->stencil_enabled) { lookup |= BRW_WM_IZ_STENCIL_TEST_ENABLE_BIT; if (ctx->Stencil.WriteMask[0] || diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c index d417f7c2994..6c69fa8ba59 100644 --- a/src/mesa/drivers/dri/i965/gen7_misc_state.c +++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c @@ -108,7 +108,7 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw, OUT_BATCH((depth_mt ? depth_mt->pitch - 1 : 0) | (depthbuffer_format << 18) | ((hiz ? 1 : 0) << 22) | - ((stencil_mt != NULL && ctx->Stencil._WriteEnabled) << 27) | + ((stencil_mt != NULL && brw->stencil_write_enabled) << 27) | (brw_depth_writes_enabled(brw) << 28) | (surftype << 29)); diff --git a/src/mesa/drivers/dri/i965/gen8_depth_state.c b/src/mesa/drivers/dri/i965/gen8_depth_state.c index c961c8d7aed..29f16b7960b 100644 --- a/src/mesa/drivers/dri/i965/gen8_depth_state.c +++ b/src/mesa/drivers/dri/i965/gen8_depth_state.c @@ -219,7 +219,7 @@ gen8_emit_depth_stencil_hiz(struct brw_context *brw, emit_depth_packets(brw, depth_mt, brw_depthbuffer_format(brw), surftype, brw_depth_writes_enabled(brw), - stencil_mt, ctx->Stencil._WriteEnabled, + stencil_mt, brw->stencil_write_enabled, hiz, width, height, depth, lod, min_array_element); } @@ -287,7 +287,7 @@ pma_fix_enable(const struct brw_context *brw) * !3DSTATE_DEPTH_BUFFER::Stencil Buffer Enable || * !3DSTATE_STENCIL_BUFFER::Stencil Buffer Enable */ - const bool stencil_writes_enabled = ctx->Stencil._WriteEnabled; + const bool stencil_writes_enabled = brw->stencil_write_enabled; /* 3DSTATE_PS_EXTRA::Pixel Shader Computed Depth Mode != PSCDEPTH_OFF */ const bool ps_computes_depth = @@ -340,7 +340,7 @@ gen8_write_pma_stall_bits(struct brw_context *brw, uint32_t pma_stall_bits) * Flush is also necessary. */ const uint32_t render_cache_flush = - ctx->Stencil._WriteEnabled ? PIPE_CONTROL_RENDER_TARGET_FLUSH : 0; + brw->stencil_write_enabled ? PIPE_CONTROL_RENDER_TARGET_FLUSH : 0; brw_emit_pipe_control_flush(brw, PIPE_CONTROL_CS_STALL | PIPE_CONTROL_DEPTH_CACHE_FLUSH | diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index 064880b8209..8c6d3ff012e 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -1182,7 +1182,7 @@ genX(upload_depth_stencil_state)(struct brw_context *brw) wmds.DepthTestFunction = intel_translate_compare_func(depth->Func); } - if (stencil->_Enabled) { + if (brw->stencil_enabled) { wmds.StencilTestEnable = true; wmds.StencilWriteMask = stencil->WriteMask[0] & 0xff; wmds.StencilTestMask = stencil->ValueMask[0] & 0xff; @@ -1196,9 +1196,9 @@ genX(upload_depth_stencil_state)(struct brw_context *brw) wmds.StencilPassDepthFailOp = intel_translate_stencil_op(stencil->ZFailFunc[0]); - wmds.StencilBufferWriteEnable = stencil->_WriteEnabled; + wmds.StencilBufferWriteEnable = brw->stencil_write_enabled; - if (stencil->_TestTwoSide) { + if (brw->stencil_two_sided) { wmds.DoubleSidedStencilEnable = true; wmds.BackfaceStencilWriteMask = stencil->WriteMask[b] & 0xff; wmds.BackfaceStencilTestMask = stencil->ValueMask[b] & 0xff; diff --git a/src/mesa/drivers/dri/i965/intel_pixel.c b/src/mesa/drivers/dri/i965/intel_pixel.c index d4f86fdffe0..e2babf83c47 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel.c +++ b/src/mesa/drivers/dri/i965/intel_pixel.c @@ -26,6 +26,7 @@ #include "main/accum.h" #include "main/enums.h" #include "main/state.h" +#include "main/stencil.h" #include "main/bufferobj.h" #include "main/context.h" #include "swrast/swrast.h" @@ -107,7 +108,7 @@ intel_check_blit_fragment_ops(struct gl_context * ctx, bool src_alpha_is_one) return false; } - if (ctx->Stencil._Enabled) { + if (_mesa_stencil_is_enabled(ctx)) { DBG("fallback due to image stencil\n"); return false; } diff --git a/src/mesa/drivers/dri/i965/intel_pixel_copy.c b/src/mesa/drivers/dri/i965/intel_pixel_copy.c index 05c35bd61b3..986707c9d80 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_copy.c @@ -25,6 +25,7 @@ #include "main/image.h" #include "main/state.h" +#include "main/stencil.h" #include "main/mtypes.h" #include "main/condrender.h" #include "main/fbobject.h" @@ -115,7 +116,7 @@ do_blit_copypixels(struct gl_context * ctx, return false; } - if (ctx->Stencil._Enabled) { + if (brw->stencil_enabled) { perf_debug("glCopyPixels(): Unsupported stencil test state\n"); return false; } |