i965/blorp: Set r8stencil_needs_update when writing stencil
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 17 Jun 2017 20:50:30 +0000 (13:50 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 15 Sep 2017 17:58:55 +0000 (10:58 -0700)
This fixes a crash on Haswell when we try to upload a stencil texture
with blorp.  It would also be a problem if someone tried to texture from
stencil after glBlitFramebuffers.

Cc: "17.2 17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/drivers/dri/i965/brw_blorp.c

index 4c6ae3691964987c22031ffe2c31e31c3bded715..0c58e74b67dc5d31e4f61770a5a9bc28ad685ca6 100644 (file)
@@ -135,6 +135,8 @@ blorp_surf_for_miptree(struct brw_context *brw,
                        unsigned start_layer, unsigned num_layers,
                        struct isl_surf tmp_surfs[1])
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
+
    if (mt->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY) {
       const unsigned num_samples = mt->surf.samples;
       for (unsigned i = 0; i < num_layers; i++) {
@@ -163,6 +165,10 @@ blorp_surf_for_miptree(struct brw_context *brw,
    else if (mt->hiz_buf)
       aux_surf = &mt->hiz_buf->surf;
 
+   if (mt->format == MESA_FORMAT_S_UINT8 && is_render_target &&
+       devinfo->gen <= 7)
+      mt->r8stencil_needs_update = true;
+
    if (surf->aux_usage == ISL_AUX_USAGE_HIZ &&
        !intel_miptree_level_has_hiz(mt, *level))
       surf->aux_usage = ISL_AUX_USAGE_NONE;