From 230be38eef294a9df0990a44bfb3f1a5b5df62dc Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Tue, 14 May 2024 21:16:53 +0200 Subject: [PATCH] GLSLang: check version before applying our API hack --- PlugIns/GLSLang/CMakeLists.txt | 1 + PlugIns/GLSLang/src/OgreGLSLang.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/PlugIns/GLSLang/CMakeLists.txt b/PlugIns/GLSLang/CMakeLists.txt index 470530b6b1b..60d8f0694b9 100644 --- a/PlugIns/GLSLang/CMakeLists.txt +++ b/PlugIns/GLSLang/CMakeLists.txt @@ -10,6 +10,7 @@ target_compile_features(Plugin_GLSLangProgramManager PRIVATE cxx_std_17) if(ANDROID) target_include_directories(Plugin_GLSLangProgramManager SYSTEM PRIVATE ${ANDROID_NDK}/sources/third_party/shaderc/third_party/glslang + ${ANDROID_NDK}/sources/third_party/shaderc/obj/local/${ANDROID_ABI}/include/ ${ANDROID_NDK}/sources/third_party/shaderc/third_party/) target_link_libraries(Plugin_GLSLangProgramManager PUBLIC OgreMain ${ANDROID_NDK}/sources/third_party/shaderc/libs/c++_static/${ANDROID_ABI}/libshaderc.a) diff --git a/PlugIns/GLSLang/src/OgreGLSLang.cpp b/PlugIns/GLSLang/src/OgreGLSLang.cpp index b37d60a5c8a..50eca1c4e21 100644 --- a/PlugIns/GLSLang/src/OgreGLSLang.cpp +++ b/PlugIns/GLSLang/src/OgreGLSLang.cpp @@ -10,6 +10,11 @@ #include #include +#ifndef GLSLANG_MINOR_VERSION +#include +#else +#define GLSLANG_VERSION_MAJOR 10 +#endif #include "gl_types.h" namespace @@ -457,7 +462,12 @@ void GLSLangProgram::prepareImpl() } } +#if GLSLANG_VERSION_MAJOR < 14 + auto utype = program.getUniformTType(i); +#else auto utype = (const TType*)program.getUniformTType(i); +#endif + GpuConstantDefinition def; def.logicalIndex = isUBO ? uoffset : utype->getQualifier().layoutLocation; def.arraySize = program.getUniformArraySize(i);