MCPcopy Create free account
hub / github.com/GPUOpen-Tools/GPU-Reshape / main

Function main

Source/Backends/DX12/Generator/Source/Generator.cpp:41–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39#include "GenTypes.h"
40
41int main(int argc, char *const argv[]) {
42 argparse::ArgumentParser program("GPUOpen GRS - DX12 Generator");
43
44 // Setup parameters
45 program.add_argument("-specjson").help("Path of the specification json file").default_value(std::string(""));
46 program.add_argument("-dxilrst").help("Path of the dxil rst file").default_value(std::string(""));
47 program.add_argument("-hooksjson").help("Path of the hooks json file").default_value(std::string(""));
48 program.add_argument("-deepcopyjson").help("Path of the deep copy json file").default_value(std::string(""));
49 program.add_argument("-template").help("The file to template").required();
50 program.add_argument("-gentype").help("The generation type, one of [specification, detour, wrappers, wrappersimpl, objectwrappers, vtable, table, deepcopy, deepcopyimpl, dxiltables, dxilintrinsics, featureproxies]").required();
51 program.add_argument("-d3d12h").help("The d3d12 header file").default_value(std::string(""));
52 program.add_argument("-o").help("Output of the generated file").required();
53
54 // Attempt to parse the input
55 try {
56 program.parse_args(argc, argv);
57 } catch (const std::runtime_error &err) {
58 std::cerr << err.what() << std::endl;
59 std::cerr << program;
60 return 1;
61 }
62
63 // Arguments
64 auto &&specjson = program.get<std::string>("-specjson");
65 auto &&dxilrst = program.get<std::string>("-dxilrst");
66 auto &&hooksjson = program.get<std::string>("-hooksjson");
67 auto &&deepcopyjson = program.get<std::string>("-deepcopyjson");
68 auto &&ftemplate = program.get<std::string>("-template");
69 auto &&gentype = program.get<std::string>("-gentype");
70 auto &&d3d12h = program.get<std::string>("-d3d12h");
71 auto &&output = program.get<std::string>("-o");
72
73 // Generator information
74 GeneratorInfo generatorInfo{};
75 generatorInfo.d3d12HeaderPath = d3d12h;
76
77 // Parse optional json
78 if (!specjson.empty()) {
79 // Open json
80 std::ifstream stream(specjson);
81 if (!stream.good()) {
82 std::cerr << "Failed to open json file: " << specjson << std::endl;
83 return 1;
84 }
85
86 // Parse json
87 try {
88 stream >> generatorInfo.specification;
89 } catch(nlohmann::json::exception& ex) {
90 std::cerr << "Failed to parse json file: " << specjson << ", " << ex.what() << std::endl;
91 return 1;
92 }
93 }
94
95 // Parse optional dxil rst
96 if (!dxilrst.empty()) {
97 std::ifstream file(dxilrst);
98

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.45
LoadMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected