i965/draw: Fix adding the stencil bo to the depth cache
authorNanley Chery <nanley.g.chery@intel.com>
Fri, 8 Jun 2018 20:24:09 +0000 (13:24 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Fri, 13 Jul 2018 15:31:21 +0000 (08:31 -0700)
Fix the case where stencil writes are enabled on a depth stencil
texture. Found by inspection.

v2: Fix message to allow for depth stencil writes (Topi).

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_draw.c

index 271456e0f7d41fa76c72e4616b0e4c2098d6e950..71461d7b0a75a9bcf6f95398499b573391643ab9 100644 (file)
@@ -623,10 +623,10 @@ brw_postdraw_set_buffers_need_resolve(struct brw_context *brw)
    }
 
    if (stencil_irb && brw->stencil_write_enabled) {
-      brw_depth_cache_add_bo(brw, stencil_irb->mt->bo);
       struct intel_mipmap_tree *stencil_mt =
          stencil_irb->mt->stencil_mt != NULL ?
          stencil_irb->mt->stencil_mt : stencil_irb->mt;
+      brw_depth_cache_add_bo(brw, stencil_mt->bo);
       intel_miptree_finish_write(brw, stencil_mt, stencil_irb->mt_level,
                                  stencil_irb->mt_layer,
                                  stencil_irb->layer_count, ISL_AUX_USAGE_NONE);