@@ -55,18 +55,22 @@ class ShaderCompiler final : public system::IApplicationFramework
5555 }
5656
5757 auto output_flag_pos = std::find (m_arguments.begin (), m_arguments.end (), " -Fo" );
58- if (output_flag_pos != m_arguments.end ()) {
59- if (output_flag_pos + 1 != m_arguments.end ()) {
60- output_filepath = *(output_flag_pos + 1 );
61- m_logger->log (" Compiled shader code will be saved to " + output_filepath);
62- m_arguments.erase (output_flag_pos, output_flag_pos+1 );
63- }
64- else {
65- m_logger->log (" Incorrect arguments. Expecting filename after -Fo." , ILogger::ELL_ERROR);
66- }
58+ if (output_flag_pos != m_arguments.end ())
59+ output_flag_pos = std::find (m_arguments.begin (), m_arguments.end (), " -Fc" );
60+
61+ if (output_flag_pos == m_arguments.end ()) {
62+ m_logger->log (" Missing arguments. Expecting `-Fo {filename}` or `-Fc {filename}`." , ILogger::ELL_ERROR);
63+ return false ;
64+ }
65+
66+ if (output_flag_pos + 1 != m_arguments.end ()) {
67+ output_filepath = *(output_flag_pos + 1 );
68+ m_logger->log (" Compiled shader code will be saved to " + output_filepath);
69+ m_arguments.erase (output_flag_pos, output_flag_pos+1 );
6770 }
6871 else {
69- m_logger->log (" Missing arguments. Expecting -Fo {filename}." , ILogger::ELL_ERROR);
72+ m_logger->log (" Incorrect arguments. Expecting filename after -Fo or -Fc." , ILogger::ELL_ERROR);
73+ return false ;
7074 }
7175
7276#ifndef NBL_EMBED_BUILTIN_RESOURCES
@@ -91,11 +95,12 @@ class ShaderCompiler final : public system::IApplicationFramework
9195 output_file.write ((const char *)compilation_result->getContent ()->getPointer (), compilation_result->getContent ()->getSize ());
9296 output_file.close ();
9397 m_logger->log (" Shader compilation successful." );
98+ return true ;
9499 }
95100 else {
96101 m_logger->log (" Shader compilation failed." , ILogger::ELL_ERROR);
102+ return false ;
97103 }
98- return true ;
99104 }
100105
101106 void workLoopBody () override {}
0 commit comments