diff --git a/gtk/meson.build b/gtk/meson.build index 60eb9d6a..d24c1927 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -97,9 +97,10 @@ if slang and opengl osdependent_dep = c_compiler.find_library('OSDependent', required: false) ogl_compiler_dep = c_compiler.find_library('OGLCompiler', required: false) spv_remapper_dep = c_compiler.find_library('SPVRemapper', required: false) + resource_limits_dep = c_compiler.find_library('glslang-default-resource-limits', required:false) - if glslang_dep.found() and spirv_dep.found() and osdependent_dep.found() and ogl_compiler_dep.found() and spv_remapper_dep.found() - deps += [glslang_dep, spirv_dep, osdependent_dep, ogl_compiler_dep, spv_remapper_dep] + if glslang_dep.found() and spirv_dep.found() and osdependent_dep.found() and ogl_compiler_dep.found() and spv_remapper_dep.found() and resource_limits_dep.found() + deps += [glslang_dep, spirv_dep, osdependent_dep, ogl_compiler_dep, spv_remapper_dep, resource_limits_dep] args += ['-DUSE_SLANG', '-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS'] srcs += ['../shaders/slang.cpp'] diff --git a/shaders/slang.cpp b/shaders/slang.cpp index 7237a4ed..bd634a91 100644 --- a/shaders/slang.cpp +++ b/shaders/slang.cpp @@ -81,6 +81,10 @@ static void printuniforms(std::vector &unif) } } +namespace glslang { +#ifndef _WIN32 +extern TBuiltInResource DefaultTBuiltInResource; +#else static const TBuiltInResource DefaultTBuiltInResource = { /* .MaxLights = */ 32, /* .MaxClipPlanes = */ 6, @@ -186,6 +190,8 @@ static const TBuiltInResource DefaultTBuiltInResource = { /* .generalVariableIndexing = */ 1, /* .generalConstantMatrixVectorIndexing = */ 1, }}; +#endif +} // namespace glslang GLint GLSLShader::slang_compile(std::vector &lines, std::string stage) @@ -216,14 +222,14 @@ GLint GLSLShader::slang_compile(std::vector &lines, std::string debug; auto forbid_includer = glslang::TShader::ForbidIncluder(); - if (!shader.preprocess(&DefaultTBuiltInResource, 100, ENoProfile, false, + if (!shader.preprocess(&glslang::DefaultTBuiltInResource, 100, ENoProfile, false, false, messages, &debug, forbid_includer)) { puts(debug.c_str()); return -1; } - if (!shader.parse(&DefaultTBuiltInResource, 100, false, messages)) + if (!shader.parse(&glslang::DefaultTBuiltInResource, 100, false, messages)) { puts(shader.getInfoLog()); puts(shader.getInfoDebugLog());