Skip to content

Commit 9bb6c7d

Browse files
committed
bugfixes
1 parent 0ab944b commit 9bb6c7d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/nbl/asset/utils/CHLSLCompiler.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ static void try_upgrade_shader_stage(std::vector<std::wstring>& arguments, asset
132132

133133
std::vector<std::wstring::iterator> underscorePositions = {};
134134
auto it = std::find(s.begin(), s.end(), '_');
135-
while (it != s.end())
135+
while (it != s.end()) {
136136
underscorePositions.push_back(it);
137+
it = std::find(it + 1, s.end(), '_');
138+
}
137139
std::wstring majorVersionString, minorVersionString;
138140
int size = underscorePositions.size();
139141
auto secondLastUnderscore = underscorePositions[size - 2];

tools/nsc/main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,17 @@ class ShaderCompiler final : public system::IApplicationFramework
5757
auto output_flag_pos = std::find(m_arguments.begin(), m_arguments.end(), "-Fo");
5858
if (output_flag_pos != m_arguments.end()) {
5959
if (output_flag_pos + 1 != m_arguments.end()) {
60-
output_filepath = *output_flag_pos;
60+
output_filepath = *(output_flag_pos + 1);
6161
m_logger->log("Compiled shader code will be saved to " + output_filepath);
6262
m_arguments.erase(output_flag_pos, output_flag_pos+1);
6363
}
6464
else {
6565
m_logger->log("Incorrect arguments. Expecting filename after -Fo.", ILogger::ELL_ERROR);
6666
}
6767
}
68+
else {
69+
m_logger->log("Missing arguments. Expecting -Fo {filename}.", ILogger::ELL_ERROR);
70+
}
6871

6972
#ifndef NBL_EMBED_BUILTIN_RESOURCES
7073
if (!no_nbl_builtins) {
@@ -120,7 +123,7 @@ class ShaderCompiler final : public system::IApplicationFramework
120123
const ICPUShader* open_shader_file(std::string& filepath) {
121124

122125
m_assetMgr = make_smart_refctd_ptr<asset::IAssetManager>(smart_refctd_ptr(m_system));
123-
auto resourceArchive = make_smart_refctd_ptr<system::CMountDirectoryArchive>(localInputCWD, smart_refctd_ptr(m_logger), m_system.get());
126+
auto resourceArchive = make_smart_refctd_ptr<system::CMountDirectoryArchive>(path(localInputCWD), logger_opt_smart_ptr(smart_refctd_ptr(m_logger)), m_system.get());
124127
m_system->mount(std::move(resourceArchive));
125128

126129
IAssetLoader::SAssetLoadParams lp = {};
@@ -130,7 +133,7 @@ class ShaderCompiler final : public system::IApplicationFramework
130133
const auto assets = assetBundle.getContents();
131134
if (assets.empty()) {
132135
m_logger->log("Could not load shader %s", ILogger::ELL_ERROR, filepath);
133-
return false;
136+
return nullptr;
134137
}
135138
assert(assets.size() == 1);
136139
smart_refctd_ptr<ICPUSpecializedShader> source = IAsset::castDown<ICPUSpecializedShader>(assets[0]);

0 commit comments

Comments
 (0)