You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto stageArgumentPos = std::find(arguments.begin(), arguments.end(), L"-HV");
98
+
if (stageArgumentPos != arguments.end()) {
99
+
auto index = stageArgumentPos - arguments.begin() + 1; // -HV XXXXX, get index of second
100
+
std::wstring version = arguments[index];
101
+
if (!isalpha(version.back()) && version.length() >= 4 && std::stoi(version) < 2021)
102
+
arguments[index] = L"2021";
103
+
}
104
+
else {
105
+
logger.log("Compile flag error: Required compile flag not found -HV. Force enabling -HV 202x, as it is required by Nabla.", system::ILogger::ELL_WARNING);
for (int j = 0; j < CHLSLCompiler::RequiredArgumentCount; j++)
109
-
{
110
-
if (arguments[i] == CHLSLCompiler::RequiredArguments[j]) {
111
-
found_arg_flags[j] = true;
112
-
break;
113
-
}
114
-
}
115
-
}
140
+
auto set = std::unordered_set<std::wstring>();
141
+
for (int i = 0; i < arguments.size(); i++)
142
+
set.insert(arguments[i]);
116
143
for (int j = 0; j < CHLSLCompiler::RequiredArgumentCount; j++)
117
144
{
118
-
if (!found_arg_flags[j]) {
119
-
logger.log("Required compile flag not found %ls. This flag will be force enabled as it is required by Nabla.", system::ILogger::ELL_WARNING, CHLSLCompiler::RequiredArguments[j]);
logger.log("Compile flag error: Required compile flag not found %ls. This flag will be force enabled, as it is required by Nabla.", system::ILogger::ELL_WARNING, CHLSLCompiler::RequiredArguments[j]);
@@ -68,7 +75,6 @@ struct preprocessing_hooks final : public boost::wave::context_policies::default
68
75
typename ContextT::token_type const& act_token
69
76
)
70
77
{
71
-
hash_token_occurences++;
72
78
auto optionStr = option.get_value().c_str();
73
79
if (strcmp(optionStr,"shader_stage")==0)
74
80
{
@@ -103,24 +109,27 @@ struct preprocessing_hooks final : public boost::wave::context_policies::default
103
109
returntrue;
104
110
}
105
111
106
-
if (strcmp(optionStr, "dxc_compile_flags") == 0 && hash_token_occurences == 1) {
112
+
if (strcmp(optionStr, "dxc_compile_flags") ) {
113
+
if (0 && hash_token_occurences != 1) {
114
+
m_logger.log("Pre-processor error: Encountered a \"#pragma wave dxc_compile_flags\" but it is not the first preprocessor directive.", system::ILogger::ELL_ERROR);
115
+
returnfalse;
116
+
}
107
117
m_dxc_compile_flags_override.clear();
108
118
std::string arg = "";
109
119
for (auto valueIter = values.begin(); valueIter != values.end(); valueIter++) {
result = includeFinder->getIncludeRelative(ctx.get_current_directory(),file_path);
492
501
}
493
502
else {
494
-
ctx.get_hooks().m_logger.log("Include finder not assigned, preprocessor will not include file " + file_path, nbl::system::ILogger::ELL_ERROR);
503
+
ctx.get_hooks().m_logger.log("Pre-processor error: Include finder not assigned, preprocessor will not include file " + file_path, nbl::system::ILogger::ELL_ERROR);
0 commit comments