From 14b3e8fc8fe75a8a5e78eae8b54ac2b215dbeceb Mon Sep 17 00:00:00 2001 From: renderexpert Date: Thu, 19 Jun 2025 11:41:53 +0100 Subject: [PATCH] Fix shader tests on Linux Signed-off-by: renderexpert --- libs/shaders/gl_program_pool.cpp | 2 +- .../gl_shaders_mobile_compile_test.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libs/shaders/gl_program_pool.cpp b/libs/shaders/gl_program_pool.cpp index d44187091..d373bc559 100644 --- a/libs/shaders/gl_program_pool.cpp +++ b/libs/shaders/gl_program_pool.cpp @@ -14,7 +14,7 @@ GLProgramPool::GLProgramPool(dp::ApiVersion apiVersion) if (m_apiVersion == dp::ApiVersion::OpenGLES3) { -#if defined(OMIM_OS_DESKTOP) && !defined(OMIM_OS_LINUX) +#if defined(OMIM_OS_DESKTOP) m_baseDefines = std::string(GL3_SHADER_VERSION); #else m_baseDefines = std::string(GLES3_SHADER_VERSION); diff --git a/libs/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp b/libs/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp index 0285e0beb..a23fb6803 100644 --- a/libs/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp +++ b/libs/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp @@ -112,9 +112,23 @@ void TestShaders(dp::ApiVersion apiVersion, std::string const & defines, QString TEST(srcFile.open(), ("Temporary file can't be created!")); std::string fullSrc; if (apiVersion == dp::ApiVersion::OpenGLES3) - fullSrc = std::string(gpu::GLES3_SHADER_VERSION) + defines + src.second; + { + // Use desktop shader version for Linux +#ifdef OMIM_OS_LINUX + if (glslCompiler.contains(kCompilerOpenGLES.c_str())) + { + fullSrc = std::string(gpu::GL3_SHADER_VERSION) + defines + src.second; + } + else +#endif + { + fullSrc = std::string(gpu::GLES3_SHADER_VERSION) + defines + src.second; + } + } else + { fullSrc = defines + src.second; + } WriteShaderToFile(srcFile, fullSrc); RunShaderTest(apiVersion, src.first, glslCompiler, srcFile.fileName(), procPrepare, argsPrepare, successChecker, errorLog);