[Mesa-dev] [PATCH] swrast: Don't crash when there are no render slices

gurchetansingh at chromium.org gurchetansingh at chromium.org
Fri Nov 3 21:37:10 UTC 2017


From: Stéphane Marchesin <marcheu at chromium.org>

It is legal not to have slices (for example with a 0x0 texture)
so we should handle that case.
---
 src/mesa/swrast/s_texrender.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mesa/swrast/s_texrender.c b/src/mesa/swrast/s_texrender.c
index 4e41b3b72a..ff90bad625 100644
--- a/src/mesa/swrast/s_texrender.c
+++ b/src/mesa/swrast/s_texrender.c
@@ -52,7 +52,10 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
    /* Want to store linear values, not sRGB */
    rb->Format = _mesa_get_srgb_format_linear(format);
 
-   srb->Buffer = swImage->ImageSlices[zOffset];
+   if (swImage->ImageSlices)
+      srb->Buffer = swImage->ImageSlices[zOffset];
+   else
+      srb->Buffer = NULL;
 }
 
 
-- 
2.13.5



More information about the mesa-dev mailing list