From c2f0fd28ac17fb40f454e02fbcbb5b7937f89283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 31 May 2023 11:09:03 -0400 Subject: [PATCH] mesa: fix glBitmap in display lists when width <= 0 || height <= 0 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8904 Fixes: bb860f63 - mesa: create glBitmap textures while creating display lists Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: (cherry picked from commit bac1c88ea3e1f0966505a3bfb016c6b2e8cbb629) --- .pick_status.json | 2 +- src/mesa/main/dlist.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index de9509ae057..481debd395f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3325,7 +3325,7 @@ "description": "mesa: fix glBitmap in display lists when width <= 0 || height <= 0", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "bb860f63f6df60a00c5a97df4cb98a2e0850d3aa" }, diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 0dc90bbd0d4..63feef2b097 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1345,12 +1345,15 @@ save_Bitmap(GLsizei width, GLsizei height, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - struct pipe_resource *tex = - st_make_bitmap_texture(ctx, width, height, &ctx->Unpack, pixels); + struct pipe_resource *tex = NULL; - if (!tex) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glNewList -> glBitmap"); - return; + if (width > 0 && height > 0) { + tex = st_make_bitmap_texture(ctx, width, height, &ctx->Unpack, pixels); + + if (!tex) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glNewList -> glBitmap"); + return; + } } n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);