Skip to content

Commit

Permalink
Ensure glslang include directories are specified before Vulkan SDK ones
Browse files Browse the repository at this point in the history
Otherwise some compilation units may use the definitions of inline glslang functions from the Vulkan SDK's copy of glslang instead of the glslang we're using, and if the necessary linker warnings aren't enabled and set as errors (they're not), this can cause ABI issues.

I noticed this after encountering stack corruption in glslang::GlslangToSpv as the Vulkan SDK version 1.3.296 provides glslang 15.0.0, where glslang::SpvOptions is ten bytes, whereas I was using glslang 14.3.0, where it's only nine bytes, so initialising defaultOptions would spill one byte past the object's end.
Fixing the include order ensures all TUs use the right function implementation and the linker won't randomly pick the wrong one.
  • Loading branch information
AnyOldName3 committed Dec 23, 2024
1 parent 308d7c9 commit 8c46628
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/vsg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ set(LIBRARIES PUBLIC
)

if (${VSG_SUPPORTS_ShaderCompiler})
list(APPEND LIBRARIES PRIVATE glslang::glslang glslang::glslang-default-resource-limits glslang::SPIRV)
list(INSERT LIBRARIES 0 PRIVATE glslang::glslang glslang::glslang-default-resource-limits glslang::SPIRV)
endif()

# Check for std::atomic
Expand Down

0 comments on commit 8c46628

Please sign in to comment.