st/dri: Don't call invalidate_resource for NULL depth/stencil buffers
authorMichel Dänzer <michel.daenzer@amd.com>
Fri, 15 Jan 2016 06:46:31 +0000 (15:46 +0900)
committerMichel Dänzer <michel@daenzer.net>
Mon, 18 Jan 2016 08:39:37 +0000 (17:39 +0900)
Fixes crash in 4 EGL piglit tests with radeonsi.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/state_trackers/dri/dri_drawable.c

index f0cc4a2a3ef042f2cff67f664978bf4c8e13b1dc..adc5128476786bdb5cb9b6d5720f2c589b9a2212 100644 (file)
@@ -492,8 +492,10 @@ dri_flush(__DRIcontext *cPriv,
 
       if (pipe->invalidate_resource &&
           (flags & __DRI2_FLUSH_INVALIDATE_ANCILLARY)) {
-         pipe->invalidate_resource(pipe, drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
-         pipe->invalidate_resource(pipe, drawable->msaa_textures[ST_ATTACHMENT_DEPTH_STENCIL]);
+         if (drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL])
+            pipe->invalidate_resource(pipe, drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
+         if (drawable->msaa_textures[ST_ATTACHMENT_DEPTH_STENCIL])
+            pipe->invalidate_resource(pipe, drawable->msaa_textures[ST_ATTACHMENT_DEPTH_STENCIL]);
       }
    }