shadow_mt will hold a miptree with ASTC LDR void extent blocks that are modified to workaround a sampler bug. --- src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 25 +++++++++++++++++++ src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 1 + 2 files changed, 26 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 332c5d88f58..5e99b563102 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -354,6 +354,19 @@ needs_separate_stencil(const struct brw_context *brw, intel_miptree_supports_hiz(brw, mt); } +/* Determine if we may run into a problematic void-extent block for our sampler + * (see WA #0300). This isn't 100% accurate because we don't actually inspect + * the blocks. + */ +static bool +may_need_astc_shadow(const struct gen_device_info *devinfo, + mesa_format format) +{ + return devinfo->gen == 9 && !gen_device_info_is_9lp(devinfo) && + _mesa_get_format_layout(format) == MESA_FORMAT_LAYOUT_ASTC && + _mesa_get_format_color_encoding(format) == GL_LINEAR; +} + /** * Choose the aux usage for this miptree. This function must be called fairly * late in the miptree create process after we have a tiling. @@ -719,6 +732,18 @@ miptree_create(struct brw_context *brw, } } + if (may_need_astc_shadow(devinfo, format)) { + mt->shadow_mt = + make_surface(brw, target, format, first_level, last_level, + width0, height0, depth0, num_samples, + ISL_TILING_Y0_BIT, mt_surf_usage(format), + BO_ALLOC_BUSY, 0, NULL); + if (mt->shadow_mt == NULL) { + intel_miptree_release(&mt); + return NULL; + } + } + mt->etc_format = (_mesa_is_format_color_format(format) && mt_fmt != format) ? format : MESA_FORMAT_NONE; diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h index d75c93b8b42..b22514de386 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h @@ -301,6 +301,7 @@ struct intel_mipmap_tree * * This miptree may be used for: * - Stencil texturing (pre-BDW) as required by GL_ARB_stencil_texturing. + * - Correctly sampling from ASTC LDR blocks on big-core gen9 platforms. */ struct intel_mipmap_tree *shadow_mt; bool shadow_needs_update; -- 2.19.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev