diff options
author | Jordan Justen <jordan.l.justen@intel.com> | 2016-06-11 16:44:27 -0700 |
---|---|---|
committer | Jordan Justen <jordan.l.justen@intel.com> | 2016-08-26 10:09:22 -0700 |
commit | 7af51b8f0359131dbb11cf64c54638029aebad84 (patch) | |
tree | 177071177552c8a24dadd53fe073cfc4326780be /src | |
parent | c8194dc737464d19521c948aa555d936f47f381a (diff) | |
download | external_mesa3d-7af51b8f0359131dbb11cf64c54638029aebad84.zip external_mesa3d-7af51b8f0359131dbb11cf64c54638029aebad84.tar.gz external_mesa3d-7af51b8f0359131dbb11cf64c54638029aebad84.tar.bz2 |
i965: Add function to copy a stencil miptree to an R8_UINT miptree
v2:
* Cleanups suggested by Ian, Matt and Topi
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 57 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 4 |
2 files changed, 60 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index d4f6c34..c33d8fc 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -674,7 +674,6 @@ miptree_create(struct brw_context *brw, etc_format = (format != tex_format) ? tex_format : MESA_FORMAT_NONE; - assert((layout_flags & MIPTREE_LAYOUT_DISABLE_AUX) == 0); assert((layout_flags & MIPTREE_LAYOUT_FOR_BO) == 0); mt = intel_miptree_create_layout(brw, target, format, first_level, last_level, width0, @@ -2286,6 +2285,62 @@ intel_miptree_updownsample(struct brw_context *brw, } } +void +intel_update_r8stencil(struct brw_context *brw, + struct intel_mipmap_tree *mt) +{ + assert(brw->gen >= 7); + struct intel_mipmap_tree *src = + mt->format == MESA_FORMAT_S_UINT8 ? mt : mt->stencil_mt; + if (!src || brw->gen >= 8 || !src->r8stencil_needs_update) + return; + + if (!mt->r8stencil_mt) { + const uint32_t r8stencil_flags = + MIPTREE_LAYOUT_ACCELERATED_UPLOAD | MIPTREE_LAYOUT_TILING_Y | + MIPTREE_LAYOUT_DISABLE_AUX; + assert(brw->gen > 6); /* Handle MIPTREE_LAYOUT_FORCE_ALL_SLICE_AT_LOD */ + mt->r8stencil_mt = intel_miptree_create(brw, + src->target, + MESA_FORMAT_R_UINT8, + src->first_level, + src->last_level, + src->logical_width0, + src->logical_height0, + src->logical_depth0, + src->num_samples, + r8stencil_flags); + assert(mt->r8stencil_mt); + } + + struct intel_mipmap_tree *dst = mt->r8stencil_mt; + + for (int level = src->first_level; level <= src->last_level; level++) { + const unsigned depth = src->level[level].depth; + const int layers_per_blit = + (dst->msaa_layout == INTEL_MSAA_LAYOUT_UMS || + dst->msaa_layout == INTEL_MSAA_LAYOUT_CMS) ? + dst->num_samples : 1; + + for (unsigned layer = 0; layer < depth; layer++) { + brw_blorp_blit_miptrees(brw, + src, level, layer, + src->format, SWIZZLE_X, + dst, level, layers_per_blit * layer, + MESA_FORMAT_R_UNORM8, + 0, 0, + src->logical_width0, src->logical_height0, + 0, 0, + dst->logical_width0, dst->logical_height0, + GL_NEAREST, false, false /*mirror x, y*/, + false, false /* decode/encode srgb */); + } + } + + brw_render_cache_set_check_flush(brw, dst->bo); + src->r8stencil_needs_update = false; +} + static void * intel_miptree_map_raw(struct brw_context *brw, struct intel_mipmap_tree *mt) { diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h index 4473126..e7d4de0 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h @@ -974,6 +974,10 @@ intel_miptree_updownsample(struct brw_context *brw, struct intel_mipmap_tree *src, struct intel_mipmap_tree *dst); +void +intel_update_r8stencil(struct brw_context *brw, + struct intel_mipmap_tree *mt); + /** * Horizontal distance from one slice to the next in the two-dimensional * miptree layout. |