Open Ravbug opened 1 month ago
The following shader does not compile, despite the included file existing:
#include "C:\users\Admin\Desktop\file.glsl" void main(){}
This is because quoted includes get passed to readLocalPath, which assumes the path is local and transforms it before trying to read it: https://github.com/KhronosGroup/glslang/blob/1cad045cc2bf79c976e1d7001ac71644f6cb29a8/StandAlone/DirStackFileIncluder.h#L103-L124
readLocalPath
I fixed this in my copy by changing readLocalPath to check headerName as-is, in case it's an absolute path, before transforming it as a local path:
headerName
virtual IncludeResult* readLocalPath(const char* headerName, const char* includerName, int depth) { // first check for absolute paths: std::ifstream file(headerName, std::ios_base::binary | std::ios_base::ate); if (file) { directoryStack.push_back(getDirectory(headerName)); includedFiles.insert(headerName); return newIncludeResult(headerName, file, (int)file.tellg()); } // Discard popped include directories, and // ...
The following shader does not compile, despite the included file existing:
This is because quoted includes get passed to
readLocalPath
, which assumes the path is local and transforms it before trying to read it: https://github.com/KhronosGroup/glslang/blob/1cad045cc2bf79c976e1d7001ac71644f6cb29a8/StandAlone/DirStackFileIncluder.h#L103-L124I fixed this in my copy by changing
readLocalPath
to checkheaderName
as-is, in case it's an absolute path, before transforming it as a local path: