intel/blorp: Simplify depth/stencil config
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 8 Oct 2016 00:04:10 +0000 (17:04 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 14 Oct 2016 22:39:41 +0000 (15:39 -0700)
The newly reworked depth/stencil config code can properly handle having
depth, stencil, both, or neither.  We no longer need to predicate it on
having depth or stencil.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/blorp/blorp_genX_exec.h

index 889e74c9ca1ba49c1137139f9d4765eacbf5cf3a..40387067f3fd6ab6a6caafc4492d88a5e0cb2e09 100644 (file)
@@ -787,13 +787,10 @@ blorp_emit_depth_stencil_config(struct blorp_batch *batch,
 
          db.SurfaceBaseAddress = params->depth.addr;
          db.DepthBufferMOCS = mocs;
-      } else {
+      } else if (params->stencil.addr.buffer) {
          db.SurfaceFormat = D32_FLOAT;
          db.SurfaceType = isl_to_gen_ds_surftype[params->stencil.surf.dim];
 
-         /* If we don't have a depth buffer, pull dimensions from stencil */
-         assert(params->stencil.addr.buffer != NULL);
-
          db.Width = params->stencil.surf.logical_level0_px.width - 1;
          db.Height = params->stencil.surf.logical_level0_px.height - 1;
          db.RenderTargetViewExtent = db.Depth =
@@ -801,6 +798,9 @@ blorp_emit_depth_stencil_config(struct blorp_batch *batch,
 
          db.LOD = params->stencil.view.base_level;
          db.MinimumArrayElement = params->stencil.view.base_array_layer;
+      } else {
+         db.SurfaceType = SURFTYPE_NULL;
+         db.SurfaceFormat = D32_FLOAT;
       }
    }
 
@@ -1261,17 +1261,7 @@ blorp_exec(struct blorp_batch *batch, const struct blorp_params *params)
 
    blorp_emit_viewport_state(batch, params);
 
-   if (params->depth.addr.buffer || params->stencil.addr.buffer) {
-      blorp_emit_depth_stencil_config(batch, params);
-   } else {
-      blorp_emit(batch, GENX(3DSTATE_DEPTH_BUFFER), db) {
-         db.SurfaceType = SURFTYPE_NULL;
-         db.SurfaceFormat = D32_FLOAT;
-      }
-      blorp_emit(batch, GENX(3DSTATE_HIER_DEPTH_BUFFER), hiz);
-      blorp_emit(batch, GENX(3DSTATE_STENCIL_BUFFER), sb);
-      blorp_emit(batch, GENX(3DSTATE_CLEAR_PARAMS), clear);
-   }
+   blorp_emit_depth_stencil_config(batch, params);
 
    blorp_emit(batch, GENX(3DPRIMITIVE), prim) {
       prim.VertexAccessType = SEQUENTIAL;