GL textures incorrectly load at first with SDL Wayland backend

Make all T-Engine/ToME 4 bug reports here

Moderator: Moderator

Post Reply
Posts: 1
Joined: Fri Dec 31, 2021 5:27 pm

GL textures incorrectly load at first with SDL Wayland backend

#1 Post by 14162326141 »

(First, thank you for making this game; I do like it enough to track down this bug :-) )

* t-engine4, version 1.7.4 or from git master
* SDL 2.0.18, or from git master
* env variable SDL_VIDEODRIVER=wayland
* Running in windowed mode with Wayland compositor Sway

When running t-engine4 in this setup, almost all rectangles on screen are drawn with a solid color, instead of with their image contents. After going to the Load Game/New Game dialog and back a few times, textures draw normally again. Resizing the window sometimes clears some textures again.

Calling SDL_GetWindowSurface with the Wayland backend can create a second OpenGL context, which gets made current unpredictably (when resizing ?); some OpenGl operations like texture loading happen in the wrong context, leaving the textures invalid in the correct context. The documentation for SDL_GetWindowSurface warns: "You may not combine this with 3D or the rendering API on this window.".

I've attached a patch which fixes this problem, by replacing all uses of SDL_GetWindowSurface()->w with SDL_GetWindowSize(...) . The patch is in the public domain, and is also offered under CC-0 license , so no attribution will be necessary.
(5.21 KiB) Downloaded 4 times

Post Reply