GTK: Use system DefaultTBuiltInResource.

This commit is contained in:
Brandon Wright 2019-02-22 10:57:45 -06:00
parent 7dd2f760f7
commit 4bd0fd5bf7
2 changed files with 11 additions and 4 deletions

View File

@ -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']

View File

@ -81,6 +81,10 @@ static void printuniforms(std::vector<SlangUniform> &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<std::string> &lines,
std::string stage)
@ -216,14 +222,14 @@ GLint GLSLShader::slang_compile(std::vector<std::string> &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());