yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
ba8132345
master
1// options.h 2#pragma once 3 4#include <stdint.h> 5 6#ifndef SLANG_HANDLE_RESULT_FAIL 7#define SLANG_HANDLE_RESULT_FAIL (x ) assert(!"failure") 8#endif 9 10#include "../../source/compiler-core/slang-command-line-args.h" 11#include "../../source/core/slang-process-util.h" 12#include "../../source/core/slang-writer.h" 13#include "slang-com-helper.h" 14 15#include <slang-rhi.h> 16 17namespace renderer_test 18{ 19 20using namespace rhi ; 21 22struct Options 23{ 24enum class InputLanguageID 25 { 26// Slang being used as an HLSL-ish compiler 27Slang , 28 29// Raw HLSL or GLSL input, bypassing Slang 30Native , 31 }; 32 33enum class ShaderProgramType 34 { 35// Vertex and Fragment shader, writing an image out 36Graphics , 37// Compute shader, writing buffer contents out 38Compute , 39// Vertex and Fragment shader, writing buffer contents out 40GraphicsCompute , 41// Ray tracing shaders, writing buffer contents out 42RayTracing , 43// Mesh and Fragment shader, writing buffer contents out 44GraphicsMeshCompute , 45// Task, Mesh and Fragment shader, writing buffer contents out 46GraphicsTaskMeshCompute , 47 }; 48 49Slang ::String appName = "render-test" ; 50Slang ::String sourcePath ; 51Slang ::String outputPath ; 52ShaderProgramType shaderType = ShaderProgramType ::Graphics ; 53 54/// The renderer type inferred from the target language type. Used if a rendererType is not 55/// explicitly set. 56DeviceType targetLanguageDeviceType = DeviceType ::Default ; 57/// The set render type 58DeviceType deviceType = DeviceType ::Default ; 59InputLanguageID inputLanguageID = InputLanguageID ::Slang ; 60SlangSourceLanguage sourceLanguage = SLANG_SOURCE_LANGUAGE_UNKNOWN ; 61 62/// Can be used for overriding the profile 63Slang ::String profileName ; 64 65bool outputUsingType = false; 66 67bool useDXBC = false; 68 69bool onlyStartup = false; 70 71bool performanceProfile = false; 72 73bool dontAddDefaultEntryPoints = false; 74 75bool disableDebugInfo = false; 76 77bool allowGLSL = false; 78 79Slang ::String entryPointName ; 80 81Slang ::List < Slang ::String > renderFeatures ;/// Required render features for this test to run 82 83uint32_t computeDispatchSize [3 ]= {1 ,1 ,1 }; 84 85Slang ::String nvapiExtnSlot ;///< The nvapiRegister to use. 86 87Slang ::DownstreamArgs downstreamArgs ;///< Args to downstream tools. Here it's just slang 88 89bool generateSPIRVDirectly = true; 90 91bool enableDebugLayers = false; 92 93bool dx12Experimental = false; 94 95bool showAdapterInfo = false; 96 97bool skipSPIRVValidation = false; 98 99// Whether to enable RHI device caching (default: false in render-test) 100bool cacheRhiDevice = false; 101 102Slang ::List < Slang ::String > capabilities ; 103 104Options () {downstreamArgs .addName ("slang "); } 105 106static SlangResult parse ( 107int argc , 108const char * const * argv , 109Slang ::WriterHelper stdError , 110Options & outOptions ); 111}; 112 113}// namespace renderer_test