Merge pull request #11334 from weihuoya/glslang-args

Some glslang options for vulkan
This commit is contained in:
Henrik Rydgård 2018-09-01 11:02:08 +02:00 committed by GitHub
commit d91637390d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1040,6 +1040,8 @@ bool GLSLtoSPV(const VkShaderStageFlagBits shader_type,
glslang::TProgram program;
const char *shaderStrings[1];
EProfile profile = ECoreProfile;
int defaultVersion = 450;
TBuiltInResource Resources;
init_resources(Resources);
@ -1052,7 +1054,7 @@ bool GLSLtoSPV(const VkShaderStageFlagBits shader_type,
shaderStrings[0] = pshader;
shader.setStrings(shaderStrings, 1);
if (!shader.parse(&Resources, 100, false, messages)) {
if (!shader.parse(&Resources, defaultVersion, profile, false, true, messages)) {
puts(shader.getInfoLog());
puts(shader.getInfoDebugLog());
if (errorMessage) {
@ -1076,7 +1078,11 @@ bool GLSLtoSPV(const VkShaderStageFlagBits shader_type,
}
// Can't fail, parsing worked, "linking" worked.
glslang::GlslangToSpv(*program.getIntermediate(stage), spirv);
glslang::SpvOptions options;
options.disableOptimizer = false;
options.optimizeSize = false;
options.generateDebugInfo = false;
glslang::GlslangToSpv(*program.getIntermediate(stage), spirv, &options);
return true;
}