Create unit-test windows hidden from the start while preserving hardware OpenGL rendering. Force double buffering for hidden X11 windows so framebuffer capture reads the rendered back buffer reliably, and keep SDL2/SDL3 behavior consistent. Update unit-test documentation to use direct desktop execution by default, with Xvfb retained for headless environments.

This change might break unit-tests in other platforms, next CI run will let us know.
This commit is contained in:
Martín Lucas Golini
2026-08-22 14:11:11 -03:00
parent 405e84608f
commit 681841e11d
9 changed files with 61 additions and 22 deletions
+13 -1
View File
@@ -84,6 +84,13 @@ bool WindowSDL::create( WindowSettings Settings, ContextSettings Context ) {
mWindow.WindowConfig = Settings;
mWindow.ContextConfig = Context;
#if defined( EE_X11_PLATFORM )
// Unmapped GLX windows do not provide reliable front-buffer storage. Keep hidden windows
// double-buffered so rendering and readback use the drawable's back buffer.
if ( mWindow.WindowConfig.Style & WindowStyle::Hidden )
mWindow.ContextConfig.DoubleBuffering = true;
#endif
if ( !SDL_WasInit( SDL_INIT_VIDEO ) && SDL_Init( SDL_INIT_VIDEO ) != 0 ) {
Log::error( "Unable to initialize SDL: %s", SDL_GetError() );
@@ -106,7 +113,9 @@ bool WindowSDL::create( WindowSettings Settings, ContextSettings Context ) {
mWindow.WindowConfig.Height = mWindow.DesktopResolution.getHeight();
}
mWindow.Flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN |
mWindow.Flags = SDL_WINDOW_OPENGL |
( ( mWindow.WindowConfig.Style & WindowStyle::Hidden ) ? SDL_WINDOW_HIDDEN
: SDL_WINDOW_SHOWN ) |
( ( !mWindow.WindowConfig.DisableHiDPI ? SDL_WINDOW_ALLOW_HIGHDPI : 0 ) );
if ( mWindow.WindowConfig.Style & WindowStyle::Resize ) {
@@ -284,6 +293,9 @@ bool WindowSDL::create( WindowSettings Settings, ContextSettings Context ) {
Backend::BackendHelper::setUserTheme( (HWND)getWindowHandler() );
#endif
if ( mWindow.WindowConfig.Style & WindowStyle::Hidden )
SDL_HideWindow( mSDLWindow );
logSuccessfulInit( getVersion() );
return true;
+14 -2
View File
@@ -69,6 +69,13 @@ bool WindowSDL::create( WindowSettings Settings, ContextSettings Context ) {
mWindow.WindowConfig = Settings;
mWindow.ContextConfig = Context;
#if defined( EE_X11_PLATFORM )
// Unmapped GLX windows do not provide reliable front-buffer storage. Keep hidden windows
// double-buffered so rendering and readback use the drawable's back buffer.
if ( mWindow.WindowConfig.Style & WindowStyle::Hidden )
mWindow.ContextConfig.DoubleBuffering = true;
#endif
if ( !SDL_WasInit( SDL_INIT_VIDEO ) && !SDL_Init( SDL_INIT_VIDEO ) ) {
Log::error( "Unable to initialize SDL: %s", SDL_GetError() );
@@ -96,8 +103,10 @@ bool WindowSDL::create( WindowSettings Settings, ContextSettings Context ) {
mWindow.WindowConfig.Height = mWindow.DesktopResolution.getHeight();
}
mWindow.Flags = SDL_WINDOW_OPENGL |
( ( !mWindow.WindowConfig.DisableHiDPI ? SDL_WINDOW_HIGH_PIXEL_DENSITY : 0 ) );
mWindow.Flags =
SDL_WINDOW_OPENGL |
( ( mWindow.WindowConfig.Style & WindowStyle::Hidden ) ? SDL_WINDOW_HIDDEN : 0 ) |
( ( !mWindow.WindowConfig.DisableHiDPI ? SDL_WINDOW_HIGH_PIXEL_DENSITY : 0 ) );
if ( mWindow.WindowConfig.Style & WindowStyle::Resize ) {
mWindow.Flags |= SDL_WINDOW_RESIZABLE;
@@ -259,6 +268,9 @@ bool WindowSDL::create( WindowSettings Settings, ContextSettings Context ) {
Backend::BackendHelper::setUserTheme( (HWND)getWindowHandler() );
#endif
if ( mWindow.WindowConfig.Style & WindowStyle::Hidden )
SDL_HideWindow( mSDLWindow );
logSuccessfulInit( getVersion() );
return true;
+1 -1
View File
@@ -14,7 +14,7 @@ using namespace EE::System;
using namespace EE::Graphics;
using namespace EE::Window;
static constexpr Uint32 VisualTestWindowStyle = WindowStyle::Borderless;
static constexpr Uint32 VisualTestWindowStyle = WindowStyle::Borderless | WindowStyle::Hidden;
static void compareImages( utest_state_s& utest_state, int* utest_result, EE::Window::Window* win,
const std::string& imageName,
+1 -1
View File
@@ -8,7 +8,7 @@ using namespace EE;
#define ECODE_MAJOR_VERSION 0
#define ECODE_MINOR_VERSION 8
#define ECODE_PATCH_LEVEL 1
#define ECODE_PATCH_LEVEL 2
/* ECODE_COMMIT_NUMBER 9999 is used for official releases, nightly builds (pre-releases) will
* contain the number of commits after the last official release
*/