summaryrefslogtreecommitdiffstats
path: root/tools/render-test/options.h
blob: bbc2364cd4cf39c028b2bdf227d9d8ed67545d49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// options.h
#pragma once

#include <stdint.h>

#ifndef SLANG_HANDLE_RESULT_FAIL
#define SLANG_HANDLE_RESULT_FAIL(x) assert(!"failure")
#endif

#include "../../source/compiler-core/slang-command-line-args.h"
#include "../../source/core/slang-process-util.h"
#include "../../source/core/slang-writer.h"
#include "slang-com-helper.h"

#include <slang-rhi.h>

namespace renderer_test
{

using namespace rhi;

struct Options
{
    enum class InputLanguageID
    {
        // Slang being used as an HLSL-ish compiler
        Slang,

        // Raw HLSL or GLSL input, bypassing Slang
        Native,
    };

    enum class ShaderProgramType
    {
        // Vertex and Fragment shader, writing an image out
        Graphics,
        // Compute shader, writing buffer contents out
        Compute,
        // Vertex and Fragment shader, writing buffer contents out
        GraphicsCompute,
        // Ray tracing shaders, writing buffer contents out
        RayTracing,
        // Mesh and Fragment shader, writing buffer contents out
        GraphicsMeshCompute,
        // Task, Mesh and Fragment shader, writing buffer contents out
        GraphicsTaskMeshCompute,
    };

    Slang::String appName = "render-test";
    Slang::String sourcePath;
    Slang::String outputPath;
    ShaderProgramType shaderType = ShaderProgramType::Graphics;

    /// The renderer type inferred from the target language type. Used if a rendererType is not
    /// explicitly set.
    DeviceType targetLanguageDeviceType = DeviceType::Default;
    /// The set render type
    DeviceType deviceType = DeviceType::Default;
    InputLanguageID inputLanguageID = InputLanguageID::Slang;
    SlangSourceLanguage sourceLanguage = SLANG_SOURCE_LANGUAGE_UNKNOWN;

    /// Can be used for overriding the profile
    Slang::String profileName;

    bool outputUsingType = false;

    bool useDXBC = false;

    bool onlyStartup = false;

    bool performanceProfile = false;

    bool dontAddDefaultEntryPoints = false;

    bool disableDebugInfo = false;

    bool allowGLSL = false;

    Slang::String entryPointName;

    Slang::List<Slang::String> renderFeatures; /// Required render features for this test to run

    uint32_t computeDispatchSize[3] = {1, 1, 1};

    Slang::String nvapiExtnSlot; ///< The nvapiRegister to use.

    Slang::DownstreamArgs downstreamArgs; ///< Args to downstream tools. Here it's just slang

    bool generateSPIRVDirectly = true;

    bool enableDebugLayers = false;

    bool dx12Experimental = false;

    bool showAdapterInfo = false;

    bool skipSPIRVValidation = false;

    // Whether to enable RHI device caching (default: false in render-test)
    bool cacheRhiDevice = false;

    Slang::List<Slang::String> capabilities;

    Options() { downstreamArgs.addName("slang"); }

    static SlangResult parse(
        int argc,
        const char* const* argv,
        Slang::WriterHelper stdError,
        Options& outOptions);
};

} // namespace renderer_test