Validates the inputs, prints error messages as necessary and also adjusts the configuration as necessary. Returns true if valid, otherwise returns false.
| 59 | // necessary and also adjusts the configuration as necessary. |
| 60 | // Returns true if valid, otherwise returns false. |
| 61 | static bool IsInputValid(rga::RgDx12Config& config) |
| 62 | { |
| 63 | bool ret = true; |
| 64 | if (!config.should_list_targets) |
| 65 | { |
| 66 | bool is_compute_pipeline = !config.comp.hlsl.empty() || !config.comp.dxbc.empty(); |
| 67 | if (is_compute_pipeline) |
| 68 | { |
| 69 | // Only a single input file is valid. |
| 70 | if (!config.comp.hlsl.empty() && !config.comp.dxbc.empty()) |
| 71 | { |
| 72 | std::cout << kStrErrorMultipleInputFilesPerStage1 << "compute" << |
| 73 | kStrErrorMultipleInputFilesPerStage2 << std::endl; |
| 74 | ret = false; |
| 75 | } |
| 76 | if (ret && config.comp.hlsl.empty() && config.comp.dxbc.empty()) |
| 77 | { |
| 78 | std::cout << kStrErrorNoInputFileProvided1 << "compute" << |
| 79 | kStrErrorNoInputFileProvided2 << std::endl; |
| 80 | ret = false; |
| 81 | } |
| 82 | } |
| 83 | else |
| 84 | { |
| 85 | bool is_dxr = config.is_config_dxr; |
| 86 | if (is_dxr) |
| 87 | { |
| 88 | if (config.dxr_state_file.empty() && config.dxr_hlsl_input.empty()) |
| 89 | { |
| 90 | std::cout << kStrErrorNoDxrStateDescriptionFile << std::endl; |
| 91 | ret = false; |
| 92 | } |
| 93 | } |
| 94 | else |
| 95 | { |
| 96 | // Vertex shader must be present. |
| 97 | if (config.vert.hlsl.empty() && config.vert.dxbc.empty()) |
| 98 | { |
| 99 | std::cout << kStrErrorNoInputFileProvided1 << "vertex" << |
| 100 | kStrErrorNoInputFileProvided2 << std::endl; |
| 101 | ret = false; |
| 102 | } |
| 103 | |
| 104 | // Only a single input file is valid. |
| 105 | if (ret && !config.vert.hlsl.empty() && !config.vert.dxbc.empty()) |
| 106 | { |
| 107 | std::cout << kStrErrorMultipleInputFilesPerStage1 << "vertex" << |
| 108 | kStrErrorMultipleInputFilesPerStage2 << std::endl; |
| 109 | ret = false; |
| 110 | } |
| 111 | if (ret && !config.hull.hlsl.empty() && !config.hull.dxbc.empty()) |
| 112 | { |
| 113 | std::cout << kStrErrorMultipleInputFilesPerStage1 << "hull" << |
| 114 | kStrErrorMultipleInputFilesPerStage2 << std::endl; |
| 115 | ret = false; |
| 116 | } |
| 117 | if (ret && !config.domain.hlsl.empty() && !config.domain.dxbc.empty()) |
| 118 | { |