iris: Check if resource has stencil before returning it
authorAndrii Kryvytskyi <andrii.o.kryvytskyi@globallogic.com>
Mon, 13 May 2019 12:19:03 +0000 (15:19 +0300)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 15 May 2019 04:16:11 +0000 (21:16 -0700)
Signed-off-by: Andrii Kryvytskyi <andrii.o.kryvytskyi@globallogic.com>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/drivers/iris/iris_resource.c

index 2c0b6fc258edb1830daf686b5eb2d65ff162cbfd..3d4bfd6fd9f78c58d582f7171fc5494fc766525f 100644 (file)
@@ -204,7 +204,11 @@ iris_resource_get_separate_stencil(struct pipe_resource *p_res)
    /* For packed depth-stencil, we treat depth as the primary resource
     * and store S8 as the "second plane" resource.
     */
-   return p_res->next;
+   if (p_res->next && p_res->next->format == PIPE_FORMAT_S8_UINT)
+      return p_res->next;
+
+   return NULL;
+
 }
 
 static void