diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2025-07-21 19:15:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-21 19:15:07 -0700 |
| commit | 13dd01489efd89268d15751c5299e5783015bbcd (patch) | |
| tree | 13208541f8838a16e69d38645f7eebfc76326394 /examples/example-base/test-base.h | |
| parent | a77d22bf3bfc3098b01e4886c3a63fb751edc704 (diff) | |
Add command-line arguments to examples (#7835)
* Add command-line arguments to triangle example
- Add -h/--help flag to show usage information
- Add -api flag to select rendering API (d3d11 < /dev/null | d3d12|vulkan|metal|cpu|cuda|webgpu)
- Platform-specific API availability (D3D on Windows, Metal on macOS)
- Output works for both console and WIN32 applications
Diffstat (limited to 'examples/example-base/test-base.h')
| -rw-r--r-- | examples/example-base/test-base.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/example-base/test-base.h b/examples/example-base/test-base.h index 293c9f0d8..2705baa26 100644 --- a/examples/example-base/test-base.h +++ b/examples/example-base/test-base.h @@ -2,6 +2,7 @@ #include "core/slang-string-util.h" #include "slang-com-ptr.h" +#include "slang-rhi.h" #include "slang.h" using Slang::ComPtr; @@ -10,7 +11,7 @@ class TestBase { public: - // Parses command line options. This example only has one option for testing purpose. + // Parses command line options including help, API selection, and test mode. int parseOption(int argc, char** argv); void printEntrypointHashes( @@ -19,8 +20,14 @@ public: ComPtr<slang::IComponentType>& composedProgram); bool isTestMode() const { return m_isTestMode; } + bool shouldShowHelp() const { return m_showHelp; } + rhi::DeviceType getDeviceType() const { return m_deviceType; } + + void printUsage(const char* programName) const; private: bool m_isTestMode = false; + bool m_showHelp = false; + rhi::DeviceType m_deviceType = rhi::DeviceType::Default; uint64_t m_globalCounter = 0; }; |
