From 7017742ad726e5d396027223f7a9fcf6f9fa1807 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 6 Oct 2016 22:33:32 -0700 Subject: [PATCH] intel/blorp: Unify the DEPTH_STENCIL emit code across gens Signed-off-by: Jason Ekstrand Reviewed-by: Topi Pohjolainen --- src/intel/blorp/blorp_genX_exec.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h index 40387067f3f..69424c44370 100644 --- a/src/intel/blorp/blorp_genX_exec.h +++ b/src/intel/blorp/blorp_genX_exec.h @@ -914,42 +914,45 @@ blorp_emit_depth_stencil_state(struct blorp_batch *batch, const struct blorp_params *params) { #if GEN_GEN >= 8 + struct GENX(3DSTATE_WM_DEPTH_STENCIL) ds = { + GENX(3DSTATE_WM_DEPTH_STENCIL_header), + }; +#else + struct GENX(DEPTH_STENCIL_STATE) ds = { 0 }; +#endif - /* On gen8+, DEPTH_STENCIL state is simply an instruction */ - blorp_emit(batch, GENX(3DSTATE_WM_DEPTH_STENCIL), ds); - return 0; - -#else /* GEN_GEN <= 7 */ + ds.DepthBufferWriteEnable = params->depth.addr.buffer != NULL; /* See the following sections of the Sandy Bridge PRM, Volume 1, Part2: * - 7.5.3.1 Depth Buffer Clear * - 7.5.3.2 Depth Buffer Resolve * - 7.5.3.3 Hierarchical Depth Buffer Resolve */ - struct GENX(DEPTH_STENCIL_STATE) ds = { - .DepthBufferWriteEnable = true, - }; - if (params->hiz_op == BLORP_HIZ_OP_DEPTH_RESOLVE) { ds.DepthTestEnable = true; ds.DepthTestFunction = COMPAREFUNCTION_NEVER; } +#if GEN_GEN >= 8 + uint32_t offset = 0; + uint32_t *dw = blorp_emit_dwords(batch, + GENX(3DSTATE_WM_DEPTH_STENCIL_length)); + GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, dw, &ds); +#else uint32_t offset; void *state = blorp_alloc_dynamic_state(batch, AUB_TRACE_DEPTH_STENCIL_STATE, GENX(DEPTH_STENCIL_STATE_length) * 4, 64, &offset); GENX(DEPTH_STENCIL_STATE_pack)(NULL, state, &ds); +#endif -#if GEN_GEN >= 7 +#if GEN_GEN == 7 blorp_emit(batch, GENX(3DSTATE_DEPTH_STENCIL_STATE_POINTERS), sp) { sp.PointertoDEPTH_STENCIL_STATE = offset; } #endif return offset; - -#endif /* GEN_GEN */ } struct surface_state_info { -- 2.30.2