Skip to content

Commit 24b31dc

Browse files
committed
Update CHLSLCompiler.cpp
1 parent aecf0f3 commit 24b31dc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/nbl/asset/utils/CHLSLCompiler.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ namespace nbl::asset::hlsl::impl
7070
BOOST_WAVE_THROW_CTX(iter_ctx.ctx, boost::wave::preprocess_exception,
7171
bad_include_file, iter_ctx.filename.c_str(), act_pos);
7272
auto& res_str = *result;
73-
iter_ctx.instring = res_str + "\n";
73+
iter_ctx.instring = res_str;
7474
}
7575
else // include finder not provided
7676
{
7777
auto builtin_pair = nbl::builtin::get_resource_runtime(filepath);
7878
if (builtin_pair.first) // builtin exists
7979
{
80-
iter_ctx.instring = std::string(builtin_pair.first, builtin_pair.first + builtin_pair.second) + "\n";
80+
iter_ctx.instring = std::string(builtin_pair.first, builtin_pair.first + builtin_pair.second);
8181
}
8282
else // default boost behavior
8383
{
@@ -328,7 +328,8 @@ std::string CHLSLCompiler::preprocessShader(std::string&& code, IShader::E_SHADE
328328
hlsl::impl::custom_preprocessing_hooks hooks(preprocessOptions, stage);
329329
std::string startingFileIdentifier = std::string("../") + preprocessOptions.sourceIdentifier.data();
330330
wave_context_t context(code.begin(), code.end(), startingFileIdentifier.data(), hooks);
331-
context.set_language(boost::wave::support_cpp20);
331+
auto language = boost::wave::support_cpp20 | boost::wave::support_option_preserve_comments | boost::wave::support_option_emit_line_directives;
332+
context.set_language(static_cast<boost::wave::language_support>(language));
332333
context.add_macro_definition("__HLSL_VERSION");
333334
//TODO fix bad syntax and uncomment
334335
// instead of defining extraDefines as "NBL_GLSL_LIMIT_MAX_IMAGE_DIMENSION_1D 32768",

0 commit comments

Comments
 (0)