Repository navigation
Keep the postgame scoreboard from drawing hi-res sprites without GL - #7
Closed
medic-code wants to merge 1 commit into
Closed
medic-code wants to merge 1 commit into
medic-code wants to merge 1 commit into
Conversation
Without a GL context (debug.null_renderer, or a context that failed and left the game running without a window) the GL functions are never loaded. The postgame scoreboard still asked for a high-res sprite texture, which called the NULL glGenTextures and crashed the host about 8 seconds after every game ended. A bitmap's sprites are now drawn from the stock bitmap when the GL functions are not loaded. Checked: two copies over loopback with HALO_NULL_RENDERER=1 and a kicked player ending the game. The build without the change loses the host to SIGSEGV (eip 0) 29.4 s in; with it the host runs to debug.exit_after and exits 0. The new hud_hires_sprites harness test runs the real hud_hires_sprites_drawable: drawn with GL loaded, not drawn and no texture made with glGenTextures NULL; without the guard, or with it inverted, it fails. test_linux_port.py, test_web_build.py and tools/harness pass (891 passed, 4 skipped).
medic-code
force-pushed
the
fix/null-renderer-postgame-textures
branch
from
October 25, 2026 07:09
869d3c4 to
0743760
Compare
Owner
Author
|
Opened upstream as OpenCommunityEdition#483. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A game run without a GL context (
HALO_NULL_RENDERER=1, or a context that failed and fell back to running without a window) crashes the host about 8 seconds after every game ends: SIGSEGV at address 0. CI journeys and harness runs that play a game to its end lose the host at every game end.Players are not affected: with no window there is no game to play.
The postgame scoreboard draws its icons through
hud_hires_sprites_drawable, which decodes the high-res texture and callsglGenTextures. The GL function pointers are filled only when a context exists (gl_initialize,d3d8_gl.c), soglGenTexturesis NULL.Solution
hud_hires_sprites_drawablereturns 0 when the GL functions are not loaded, so the scoreboard draws the stock bitmap.Details
port/linux/src/hud_hires.c:hud_hires_sprites_drawableis the one entry the game calls before using a high-res texture for a bitmap's sprites. It now answers "not drawable" whenglGenTexturesis NULL, in place of reachingpng_pixels_texture. The test is on the loaded functions, not ondebug.null_renderer, so a failed context takes the same path.hud_hires_map_loadedalready skips ondebug.null_renderer; it is left as it is.tools/harness/tests/hud_hires_sprites.c,test_hud_hires_sprites.py: compile the realhud_hires_sprites_drawableagainst a stub texture table and a stubglGenTextures. With GL loaded a drawable bitmap is drawn; withglGenTexturesNULL it is not, and no texture is made. The negative controls (guard removed, guard inverted) fail those cases.How to test
python3 configure.py && ninja linuxHALO_NULL_RENDERER=1,SDL_VIDEODRIVER=offscreenanddebug.hidden_window = true: the host withnetwork_test = "host:bloodgulch",network_test_start = 15.0andHALO_NETWORK_TEST_CUES="1.0 kick Player",HALO_NETWORK_TEST_CUE_PLAYERS=2; the client withnetwork_test = "join".segmentation fault (signal 11, code 1) at (nil), eip 00000000about 8 seconds after the cue. After: the host runs on todebug.exit_afterand exits with status 0.python3 -m pytest -q tools/harness/tests/test_hud_hires_sprites.py. Without theif (!glGenTextures) return 0;guard inhud_hires_sprites_drawable,not-drawn-without-glfails.Tested
python3 -m pytest -q tools/harness/tests/test_hud_hires_sprites.py: 5 passed (3 cases, 2 negative controls: guard removed, guard inverted).python3 -m pytest -q tools/test_linux_port.py tools/test_web_build.py tools/harness: 891 passed, 4 skipped, 0 failed.