Using a `NULL` pointer as `bitmap` in `glBitmap` leads to `GL_OUT_OF_MEMORY` while creating display-list ("glNewList -> glBitmap")
glBitmap(0, 0, 0, 0, xmove, ymove, NULL)
does not seem to work as expected while in a display-list.
I assume this problem exists since !17780 (merged).
The man page has a note about a NULL pointer being a valid option to advance the cursor position (although the OpenGL specification does not seem to talk about this case).
The steps leading to this start and end in save_bitmap
:
- A texture is created regardless of the size (which might have zero pixels) and
pixels
(which might beNULL
): https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/mesa/main/dlist.c#L1348-1349 - The function which creates the texture (
st_make_bitmap_texture
) will try to calculate the memory address: https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/mesa/state_tracker/st_cb_bitmap.c#L134 - However, that memory address calculation (
_mesa_map_pbo_source
) which just forwards thesrc
(=NULL
) parameter to the output: https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/mesa/main/pbo.c#L146 - The
NULL
memory address then fails the check inst_make_bitmap_texture
, which also returnsNULL
: https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/mesa/state_tracker/st_cb_bitmap.c#L133-137 - The
NULL
texture will then throw an out-of-memory error insave_bitmap
;GL_OUT_OF_MEMORY
with "glNewList -> glBitmap": https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/mesa/main/dlist.c#L1351-1354
- This problem has come up in https://github.com/LinuxCNC/linuxcnc/pull/2446#issuecomment-1521032212
- The problem has come up with (presumably) another mesa user (Intel GPU) before in https://github.com/LinuxCNC/linuxcnc/issues/1599#issuecomment-1374279032