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
#include "dropbear.slang"
[[vk::binding(0, 0)]]
ConstantBuffer<CameraUniform> u_camera;
[[vk::binding(0, 1)]]
ConstantBuffer<Light> u_light;
struct VertexInput {
[[vk::location(0)]]
float3 position : POSITION;
[[vk::location(5)]]
float4 model_matrix_0 : TEXCOORD5;
[[vk::location(6)]]
float4 model_matrix_1 : TEXCOORD6;
[[vk::location(7)]]
float4 model_matrix_2 : TEXCOORD7;
[[vk::location(8)]]
float4 model_matrix_3 : TEXCOORD8;
};
struct VertexOutput {
float4 clip_position : SV_Position;
[[vk::location(0)]]
float3 color : COLOR0;
};
[shader("vertex")]
VertexOutput vs_main(VertexInput input) {
float4x4 model_matrix = vs_input_matrix(
input.model_matrix_0,
input.model_matrix_1,
input.model_matrix_2,
input.model_matrix_3,
);
VertexOutput output;
output.clip_position = mul(u_camera.view_proj, mul(model_matrix, float4(input.position, 1.0)));
output.color = u_light.color.xyz;
return output;
}
[shader("fragment")]
float4 fs_main(VertexOutput input) : SV_Target0 {
return float4(input.color, 1.0);
}