yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
e4d1200cb
master
1// options.h 2 3#ifndef OPTIONS_H_INCLUDED 4#define OPTIONS_H_INCLUDED 5 6#include "../../source/core/slang-dictionary.h" 7#include "../../source/core/slang-render-api-util.h" 8#include "../../source/core/slang-smart-pointer.h" 9#include "test-reporter.h" 10 11// A category that a test can be tagged with 12struct TestCategory :public Slang ::RefObject 13{ 14// The name of the category, from the user perspective 15Slang ::String name ; 16 17// The logical "super-category" of this category 18TestCategory * parent ; 19}; 20 21struct TestCategorySet 22{ 23public : 24/// Find a category with the specified name. Returns nullptr if not found 25TestCategory * find ( Slang :: String const & name ); 26/// Adds a category with the specified name, and parent. Returns the category object. 27/// Parent can be nullptr 28TestCategory * add( Slang :: String const & name , TestCategory * parent ); 29/// Finds a category by name, else reports and writes an error 30TestCategory * findOrError( Slang :: String const & name ); 31 32Slang ::RefPtr < TestCategory > defaultCategory; ///< The default category 33 34protected : 35Slang:: Dictionary < Slang :: String , Slang:: RefPtr < TestCategory >> m_categoryMap ; 36}; 37 38enum class SpawnType 39{ 40Default , ///< Default - typically uses shared library, on CI may use TestServer 41UseExe , ///< Tests using executable (for example slangc) 42UseSharedLibrary , ///< Runs testing in process (a crash tan take down the 43UseTestServer , ///< Use the test server to isolate testing 44UseFullyIsolatedTestServer , ///< Uses a test server for each test (slow!) 45}; 46 47enum class VerbosityLevel 48{ 49Failure , ///< Only show failures and errors 50Info , ///< Show test discovery and results (default) 51Verbose , ///< Show detailed output including command lines 52}; 53 54struct Options 55{ 56char const * appName = " slang - test "; 57 58// Directory to use when looking for binaries to run. If empty it's not set. 59Slang ::String binDir; 60 61// Root directory to use when looking for test cases 62Slang ::String testDir; 63 64// only run test cases with names have one of these prefixes. 65Slang ::List < Slang:: String > testPrefixes ; 66 67// skip test cases with names that have one of these prefixes. 68Slang ::List < Slang:: String > excludePrefixes ; 69 70// verbosity level for output 71VerbosityLevel verbosity = VerbosityLevel:: Info ; 72 73// When true results from ignored tests are not shown 74bool hideIgnored = false; 75 76// When true only tests that use an api that matches the enabledApis flags will run 77bool apiOnly = false; 78 79// Use verbose paths 80bool verbosePaths = false; 81 82// force generation of baselines for HLSL tests 83bool generateHLSLBaselines = false; 84 85// Skip generation of reference images for render tests, assume they already exist 86bool skipReferenceImageGeneration = false; 87 88// Whether to skip the step of creating test devices to check if an API is actually available. 89bool skipApiDetection = false; 90 91// Dump expected/actual output on failures, for debugging. 92// This is especially intended for use in continuous 93// integration builds. 94bool dumpOutputOnFailure = false; 95 96// When true it will run with debug layer (e.g. vulkan validation layer) 97bool enableDebugLayers = false; 98 99// Set the default spawn type to use 100// Having tests isolated, slows down testing considerably, so using UseSharedLibrary is the most 101// desirable default usually. 102SpawnType defaultSpawnType = SpawnType :: Default ; 103 104// kind of output to generate 105TestOutputMode outputMode = TestOutputMode:: Default ; 106 107// Only run tests that match one of the given categories 108Slang ::Dictionary < TestCategory * , TestCategory *> includeCategories; 109 110// Exclude test that match one these categories 111Slang ::Dictionary < TestCategory * , TestCategory *> excludeCategories; 112 113// By default we can test against all apis. If is set to anything other than AllOf only tests 114// that *require* the API will be run. 115Slang ::RenderApiFlags enabledApis = Slang:: RenderApiFlag :: AllOf ; 116 117// The subCommand to execute. Will be empty if there is no subCommand 118Slang ::String subCommand; 119 120// Arguments to the sub command. Note that if there is a subCommand the first parameter is 121// always the subCommand itself. 122Slang ::List < Slang:: String > subCommandArgs ; 123 124// By default we potentially synthesize test for all 125// TODO: Vulkan is disabled by default for now as the majority as vulkan synthesized tests 126// CPU is disabled by default 127// CUDA is disabled by default 128Slang ::RenderApiFlags synthesizedTestApis = 129Slang:: RenderApiFlag :: AllOf & ~( Slang :: RenderApiFlag :: Vulkan | Slang :: RenderApiFlag :: CPU ); 130 131// If true, print detailed adapter information 132bool showAdapterInfo = false; 133 134// Maximum number of test servers to run. 135int serverCount = 1 ; 136 137bool emitSPIRVDirectly = true; 138 139// Whether to enable RHI device caching in render-test (default: true in slang-test) 140bool cacheRhiDevice = true; 141 142Slang ::HashSet < Slang:: String > capabilities ; 143Slang ::HashSet < Slang:: String > expectedFailureList ; 144 145// Ignore abort message dialog popup on Windows 146bool ignoreAbortMsg = false; 147 148/// Parse the args, report any errors into stdError, and write the results into optionsOut 149static SlangResult parse( 150int argc , 151char ** argv , 152TestCategorySet * categorySet , 153Slang :: WriterHelper stdOut , 154Slang :: WriterHelper stdError , 155Options * optionsOut ); 156 157/// Display help message 158static void showHelp( Slang :: WriterHelper stdOut ); 159 160/// Whether to shuffle tests 161bool shuffleTests = false; 162 163/// Seed for shuffling deterministically 164uint32_t shuffleSeed = 1 ; 165}; 166 167#endif // OPTIONS_H_INCLUDED