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
[[vk::constant_id(0)]] const int NUM_LIGHTS = 4;
[[vk::constant_id(1)]] const float BRIGHTNESS = 1.0;
[[vk::constant_id(2)]] const bool USE_GAMMA = true;
struct Uniforms {
float3 base_color;
float ambient;
};
cbuffer uniforms_CB : register(b0, space0) {
Uniforms uniforms;
};
struct _vs_main_Input {
float3 position : TEXCOORD0;
};
struct VertexOutput {
float4 position : SV_Position;
};
struct _fs_main_Input {
float4 _sv_position : SV_Position;
float4 frag_coord : TEXCOORD0;
};
struct _fs_main_Output {
float4 color : SV_Target0;
};
VertexOutput vs_main(_vs_main_Input input) {
VertexOutput __luma_output;
__luma_output.position = float4(input.position, 1.0);
return __luma_output;
}
_fs_main_Output fs_main(_fs_main_Input input) {
_fs_main_Output __luma_output;
float3 color = (uniforms.base_color * uniforms.ambient);
int i = 0;
while ((i < NUM_LIGHTS)) {
color = (color + float3(0.1, 0.1, 0.1));
i = (i + 1);
}
color = (color * BRIGHTNESS);
__luma_output.color = float4(color, 1.0);
return __luma_output;
}