Skip to content

Commit 71d155e

Browse files
nahiimAnastaZIuk
authored andcommitted
Use IApplicationFramework
1 parent c3bc9bf commit 71d155e

File tree

1 file changed

+28
-19
lines changed

1 file changed

+28
-19
lines changed

tools/ndt/main.cpp

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33

44
// nsc input/simple_shader.hlsl -T ps_6_0 -E Main -Fo output/shader.ps
55

6+
#include "nbl/system/IApplicationFramework.h"
7+
68
#include <iostream>
79
#include <cstdlib>
8-
#include <vector>
10+
911

1012

1113
bool no_nbl_builtins;
1214

1315

14-
bool noNblBuiltinsEnabled(const std::vector<std::string>& args)
16+
bool noNblBuiltinsEnabled(const core::vector<std::string>& args)
1517
{
1618
for (auto i=0; i<args.size(); i++)
1719
{
@@ -23,30 +25,37 @@ bool noNblBuiltinsEnabled(const std::vector<std::string>& args)
2325

2426

2527

26-
int main(int argc, char* argv[])
28+
class ShaderCompiler final : public system::IApplicationFramework
2729
{
28-
// std::cout << "\n\t\t:: ::\n";
29-
// std::cout << "\tNABLA SHADER COMPILER";
30-
// std::cout << "\n\t\t:: ::\n\n";
30+
using base_t = system::IApplicationFramework;
3131

32+
public:
33+
using base_t::base_t;
3234

33-
std::vector<std::string> arguments(argv + 1, argv + argc);
35+
bool onAppInitialized(smart_refctd_ptr<ISystem>&& system) override
36+
{
37+
auto argc = argv.size();
3438

35-
no_nbl_builtins = noNblBuiltinsEnabled(arguments);
39+
core::vector<std::string> arguments(argv + 1, argv + argc);
3640

37-
std::string command = "dxc.exe";
38-
for (std::string arg : arguments)
39-
{
40-
command.append(" ").append(arg);
41-
}
41+
no_nbl_builtins = noNblBuiltinsEnabled(arguments);
4242

43-
int execute = std::system(command.c_str());
43+
std::string command = "dxc.exe";
44+
for (std::string arg : arguments)
45+
{
46+
command.append(" ").append(arg);
47+
}
4448

45-
std::string flag_set = no_nbl_builtins ? "TRUE" : "FALSE";
49+
int execute = std::system(command.c_str());
50+
51+
std::cout << "-no-nbl-builtins - " << no_nbl_builtins;
52+
53+
54+
return true;
55+
}
4656

47-
std::cout << "-no-nbl-builtins - " << flag_set;
4857

58+
void workLoopBody() override {}
4959

50-
std::cout << "\n\n\n\n PRESS ENTER TO EXIT(): ";
51-
std::cin.get();
52-
}
60+
bool keepRunning() override { return false; }
61+
};

0 commit comments

Comments
 (0)