From f75f7039f4bf883c61d6ea308211f331f46fdd2c Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 19 Oct 2023 14:12:48 -0700 Subject: [PATCH] Add support for stenciled swapchains in EGL Support for GLX, WGL and WebGL is still missing. partially fixes #7232 --- filament/backend/src/opengl/platforms/PlatformEGL.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/filament/backend/src/opengl/platforms/PlatformEGL.cpp b/filament/backend/src/opengl/platforms/PlatformEGL.cpp index 0a31b81f50..9b3e08b20d 100644 --- a/filament/backend/src/opengl/platforms/PlatformEGL.cpp +++ b/filament/backend/src/opengl/platforms/PlatformEGL.cpp @@ -174,7 +174,9 @@ Driver* PlatformEGL::createDriver(void* sharedContext, const Platform::DriverCon // find a config we can use if we don't have "EGL_KHR_no_config_context" and that we can use // for the dummy pbuffer surface. - mEGLConfig = findSwapChainConfig(SWAP_CHAIN_CONFIG_TRANSPARENT); + mEGLConfig = findSwapChainConfig( + SWAP_CHAIN_CONFIG_TRANSPARENT | + SWAP_CHAIN_HAS_STENCIL_BUFFER ); if (UTILS_UNLIKELY(mEGLConfig == EGL_NO_CONFIG_KHR)) { goto error; // error already logged } @@ -344,6 +346,7 @@ EGLConfig PlatformEGL::findSwapChainConfig(uint64_t flags) const { { EGL_BLUE_SIZE, 8 }, { EGL_ALPHA_SIZE, (flags & SWAP_CHAIN_CONFIG_TRANSPARENT) ? 8 : 0 }, { EGL_DEPTH_SIZE, 24 }, + { EGL_STENCIL_SIZE, (flags & SWAP_CHAIN_HAS_STENCIL_BUFFER) ? 8 : 0 } };