Skip to content

Commit 0bf5b36

Browse files
committed
fixed include handling for CHLSLCompiler
1 parent d4bb5c0 commit 0bf5b36

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/nbl/asset/utils/CHLSLCompiler.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ static tcpp::IInputStream* getInputStreamInclude(
4141
const system::ISystem* _fs,
4242
uint32_t _maxInclCnt,
4343
const char* _requesting_source,
44+
const char* _requested_source,
4445
bool _type // true for #include "string"; false for #include <string>
4546
)
4647
{
@@ -57,15 +58,15 @@ static tcpp::IInputStream* getInputStreamInclude(
5758
// or path relative to executable's working directory (""-type).
5859
relDir = std::filesystem::path(_requesting_source).parent_path();
5960
}
60-
std::filesystem::path name = _type ? (relDir / _requesting_source) : (_requesting_source);
61+
std::filesystem::path name = _type ? (relDir / _requested_source) : (_requested_source);
6162

6263
if (std::filesystem::exists(name) && !reqBuiltin)
6364
name = std::filesystem::absolute(name);
6465

6566
if (_type)
66-
res_str = _inclFinder->getIncludeRelative(relDir, _requesting_source);
67+
res_str = _inclFinder->getIncludeRelative(relDir, _requested_source);
6768
else //shaderc_include_type_standard
68-
res_str = _inclFinder->getIncludeStandard(relDir, _requesting_source);
69+
res_str = _inclFinder->getIncludeStandard(relDir, _requested_source);
6970

7071
if (!res_str.size()) {
7172
return new tcpp::StringInputStream("#error File not found");
@@ -172,7 +173,7 @@ std::string CHLSLCompiler::preprocessShader(std::string&& code, IShader::E_SHADE
172173
[&](auto path, auto isSystemPath) {
173174
return getInputStreamInclude(
174175
preprocessOptions.includeFinder, m_system.get(), preprocessOptions.maxSelfInclusionCount + 1u,
175-
path.c_str(), !isSystemPath
176+
preprocessOptions.sourceIdentifier.data(), path.c_str(), !isSystemPath
176177
);
177178
}
178179
);

0 commit comments

Comments
 (0)