From cbe376fa18e7795ec5dcd366836a93ac2e64fc4f Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 28 Jun 2021 14:26:54 +1000 Subject: [PATCH] i965: don't crash on incorrect texture use Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4995 Reviewed-by: Ian Romanick Reviewed-by: Lionel Landwerlin Part-of: (cherry picked from commit 02dd03ff3ce07362c1c1636d537f90ad96c87c49) --- .pick_status.json | 2 +- src/mesa/drivers/dri/i965/brw_tex_validate.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index e818c54e27b..5b36ef9ef8a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -499,7 +499,7 @@ "description": "i965: don't crash on incorrect texture use", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/mesa/drivers/dri/i965/brw_tex_validate.c b/src/mesa/drivers/dri/i965/brw_tex_validate.c index 43fbcdc7509..b3af6b14f37 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_validate.c +++ b/src/mesa/drivers/dri/i965/brw_tex_validate.c @@ -104,6 +104,8 @@ brw_finalize_mipmap_tree(struct brw_context *brw, assert(!tObj->Immutable || brw->screen->devinfo.ver < 6); firstImage = brw_texture_image(tObj->Image[0][tObj->Attrib.BaseLevel]); + if (!firstImage) + return; /* Check tree can hold all active levels. Check tree matches * target, imageFormat, etc.