-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen_template.h
More file actions
58 lines (57 loc) · 2 KB
/
gen_template.h
File metadata and controls
58 lines (57 loc) · 2 KB
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
#pragma once
#include <stdint.h>
#include <array>
#include "CoreMinimal.h"
#include "ShaderParameterStruct.h"
#include "LuisaShaderBase.h"
class $ClsName : public FGlobalShader
{
public:
$ArgType
DECLARE_EXPORTED_SHADER_TYPE($ClsName, Global,);
BEGIN_SHADER_PARAMETER_STRUCT(FParameters,)
SHADER_PARAMETER_SAMPLER(SamplerState, s_0)
SHADER_PARAMETER_SAMPLER(SamplerState, s_1)
SHADER_PARAMETER_SAMPLER(SamplerState, s_2)
SHADER_PARAMETER_SAMPLER(SamplerState, s_3)
SHADER_PARAMETER_SAMPLER(SamplerState, s_4)
SHADER_PARAMETER_SAMPLER(SamplerState, s_5)
SHADER_PARAMETER_SAMPLER(SamplerState, s_6)
SHADER_PARAMETER_SAMPLER(SamplerState, s_7)
SHADER_PARAMETER_SAMPLER(SamplerState, s_8)
SHADER_PARAMETER_SAMPLER(SamplerState, s_9)
SHADER_PARAMETER_SAMPLER(SamplerState, s_10)
SHADER_PARAMETER_SAMPLER(SamplerState, s_11)
SHADER_PARAMETER_SAMPLER(SamplerState, s_12)
SHADER_PARAMETER_SAMPLER(SamplerState, s_13)
SHADER_PARAMETER_SAMPLER(SamplerState, s_14)
SHADER_PARAMETER_SAMPLER(SamplerState, s_15)
$ShaderBind
END_SHADER_PARAMETER_STRUCT()
SHADER_USE_PARAMETER_STRUCT($ClsName, FGlobalShader);
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
{
return IsFeatureLevelSupported(Parameters.Platform, ERHIFeatureLevel::SM6);
}
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
{
FGlobalShader::ModifyCompilationEnvironment(Parameters, OutEnvironment);
OutEnvironment.CompilerFlags.Add(CFLAG_AllowTypedUAVLoads);
}
};
struct $ClsDspName
{
using Args = $ClsName::Args;
FRDGBuilder* graphBuilder;
TShaderMapRef<$ClsName> shader;
$ClsDspName(FRDGBuilder& graphBuilder)
: graphBuilder(&graphBuilder),
shader([this]()
{
const FGlobalShaderMap* GlobalShaderMap = GetGlobalShaderMap(GMaxRHIFeatureLevel);
return TShaderMapRef<$ClsName>(GlobalShaderMap);
}())
{
}
void dispatch(uint32_t dispatch_x, uint32_t dispatch_y, uint32_t dispatch_z$declareDispatchArg);
};