Skip to content

Commit c37a0d7

Browse files
fix up the regexp for preprocessor disabling
1 parent 65b33c4 commit c37a0d7

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

src/nbl/asset/utils/CHLSLCompiler.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ static tcpp::TInputStreamUniquePtr getInputStreamInclude(
7373
std::vector<std::pair<uint32_t, std::string>>& includeStack
7474
)
7575
{
76-
7776
std::filesystem::path relDir;
7877
#ifdef NBL_EMBED_BUILTIN_RESOURCES
7978
const bool reqFromBuiltin = nbl::builtin::hasPathPrefix(requestingSource) || spirv::builtin::hasPathPrefix(requestingSource);

src/nbl/asset/utils/IShaderCompiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ std::string IShaderCompiler::escapeFilename(std::string&& code)
3030
void IShaderCompiler::disableAllDirectivesExceptIncludes(std::string& _code)
3131
{
3232
// TODO: replace this with a proper-ish proprocessor and includer one day
33-
std::regex directive("#(?!(include|version|pragma shader_stage))");//all # not followed by "include" nor "version" nor "pragma shader_stage"
33+
std::regex directive("#(?!(( |\t|\r|\v|\f)*(include|version|pragma shader_stage)))");//all # not followed by "include" nor "version" nor "pragma shader_stage"
3434
//`#pragma shader_stage(...)` is needed for determining shader stage when `_stage` param of IShaderCompiler functions is set to ESS_UNKNOWN
3535
_code = std::regex_replace(_code, directive, IShaderCompiler::PREPROC_DIRECTIVE_DISABLER);
3636
}

0 commit comments

Comments
 (0)