| 14 | #include <filesystem> |
| 15 | |
| 16 | bool CommandLineOptions::InitFromCommandLine(int _argc, char const* const* _argv) |
| 17 | { |
| 18 | using namespace cxxopts; |
| 19 | |
| 20 | try |
| 21 | { |
| 22 | std::filesystem::path exe_path = _argv[0]; |
| 23 | Options options(exe_path.filename().string(), "RTX Path Tracing is a code sample that strives to embody years of ray tracing and neural graphics research and experience. It is intended as a starting point for a path tracer integration, as a reference for various integrated SDKs, and/or for learning and experimentation."); |
| 24 | |
| 25 | bool help = false; |
| 26 | |
| 27 | options.add_options() |
| 28 | ("s,scene", "Preferred scene to load (.scene.json)", value(scene)) |
| 29 | ("nonInteractive", "Indicates that RTXPT will start in non-interactive mode, disabling popups and windows that require input", value(nonInteractive)) |
| 30 | ("noWindow", "Start PT-SDK without a window. This mode is useful when generating screenshots from command line.", value(noWindow)) |
| 31 | ("d,debug", "Enables the D3D12/VK debug layer and NVRHI validation layer", value(debug)) |
| 32 | ("width", "Window width", value(width)) |
| 33 | ("height", "Window height", value(height)) |
| 34 | ("f,fullscreen", "run in fullscreen mode", value(fullscreen)) |
| 35 | ("a,adapter", "--adapter must be followed by a string used to match the preferred adapter, e.g --adapter NVIDIA or --adapter RTX", value(adapter)) |
| 36 | ("h,help", "Print the help message", value(help)) |
| 37 | ("d3d12", "Render using DirectX 12 (default)") |
| 38 | ("vk", "Render using Vulkan", value(useVulkan)) |
| 39 | ("stopAnimations", "Always start the scene with animations disabled", value(stopAnimations)) |
| 40 | ("noSER", "Disable Shader Execution Reordering", value(disableSER)) |
| 41 | ("adapterIndex", "--adapterIndex must be followed by a number used to identify the preferred adapter index, e.g '--adapterIndex 0' or '--adapterIndex 1'; default is -1 (automatic)", value(adapterIndex)) |
| 42 | ("captureSimple", "Trigger simple screenshot capture with default warmup; use capturePath to specify output file.", value(captureSimple)) |
| 43 | ("captureSequence", "Trigger sequence capture; use capturePath to specify output file, sequenceWarmupTime, sequenceStartTime, sequenceFPS and sequenceFrames to control.", value(captureSequence)) |
| 44 | ("capturePath", "Specify output file or path for various capture commands.", value(capturePath)) |
| 45 | ("sequenceWarmupStart", "Scene time to start warmup when using captureSequence.", value(sequenceWarmupStart)) |
| 46 | ("sequenceRecordStart", "Scene time to start recording when using captureSequence.", value(sequenceRecordStart)) |
| 47 | ("sequenceFPS", "Fixed FPS at which to run when using captureSequence.", value(sequenceFPS)) |
| 48 | ("sequenceFrameCount", "Number of frames to record when using captureSequence", value(sequenceFrameCount)) |
| 49 | |
| 50 | ("useNEE", "Enable/disable NEE (on by default)", value(UseNEE)) |
| 51 | ("NEEType", "Set NEE type: 0 - uniform sampling; 1 - power-based sampling, 2 (default) - NEE-AT", value(NEEType)) |
| 52 | ("useReSTIRDI", "Enable/disable ReSTIR DI", value(UseReSTIRDI)) |
| 53 | ("useReSTIRGI", "Enable/disable ReSTIR GI", value(UseReSTIRGI)) |
| 54 | ("realtimeSamplesPerPixel", "Number of spp in realtime mode", value(RealtimeSamplesPerPixel)) |
| 55 | ("referenceSamplesPerPixel", "Number of spp in reference mode", value(ReferenceSamplesPerPixel)) |
| 56 | ("standaloneDenoiser", "Enable/disable standalone denoiser active when DLSS-RR not enabled (on by default)", value(StandaloneDenoiser)) |
| 57 | ("realtimeAA", "Set realtime AA mode: 0 - none; 1 - TAA; 2 - DLSS; 3 - DLSS-RR (AA+denoiser, default)", value(RealtimeAA)) |
| 58 | ("overrideToRealtimeMode", "Override scene default", value(OverrideToRealtimeMode)) |
| 59 | ("overrideToReferenceMode", "Override scene default", value(OverrideToReferenceMode)) |
| 60 | ("overrideAutoexposureOff", "Override scene default", value(OverrideAutoexposureOff)) |
| 61 | ("overrideExposureOffset", "Override scene default", value(OverrideExposureOffset)) |
| 62 | ("disableFireflyFilters", "Override realtime and reference mode firefly filters to off", value(DisableFireflyFilters)) |
| 63 | ("disablePostProcessFilters", "Disable post-process filters like bloom", value(DisablePostProcessFilters)) |
| 64 | ("cameraPosDirUp", "Specify camera location to set after loading the scene; format is 9 comma separated values; can be obtained via UI Camera->Copy TO clipboard", value(cameraPosDirUp)) |
| 65 | ("propShowTags", "To show special props only if tag found in list (comma separated values)", value(PropShowTags)) |
| 66 | ("propCameraAttach", "After load, try to attach camera to the named prop", value(PropCameraAttach)) |
| 67 | ; |
| 68 | |
| 69 | int argc = _argc; |
| 70 | char const* const* argv = _argv; |
| 71 | options.parse(argc, argv); |
| 72 | |
| 73 | if (help) |