This commit is contained in:
parent
de9865b583
commit
d7a9c85ea6
11 changed files with 183 additions and 43 deletions
|
|
@ -57,7 +57,7 @@ namespace Crafter {
|
|||
fs::path spv = outputDir / path.filename().replace_extension("spv");
|
||||
return fs::exists(spv) && fs::last_write_time(path) < fs::last_write_time(spv);
|
||||
}
|
||||
std::string Shader::Compile(const fs::path& outputDir) const {
|
||||
std::string Shader::Compile(const fs::path& outputDir, std::span<const fs::path> includeDirs) const {
|
||||
EShLanguage glslangType = ToEShLanguage(type);
|
||||
glslang::InitializeProcess();
|
||||
|
||||
|
|
@ -98,6 +98,9 @@ namespace Crafter {
|
|||
shader.setEnvTarget(glslang::EShTargetSpv, glslang::EShTargetSpv_1_4);
|
||||
DirStackFileIncluder includeDir;
|
||||
includeDir.pushExternalLocalDirectory(path.parent_path().generic_string());
|
||||
for (const fs::path& dir : includeDirs) {
|
||||
includeDir.pushExternalLocalDirectory(dir.generic_string());
|
||||
}
|
||||
|
||||
if (!shader.parse(GetDefaultResources(), 100, false, messages, includeDir)) {
|
||||
return fail("GLSL parse failed", std::string(shader.getInfoLog()) + shader.getInfoDebugLog());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue