Debian Codegraph @

third_party/spirv-cross/shaders-msl/vert/in_out_array_mat.vert

raw
1 #version 450
2
3 layout(binding = 0, std140) uniform UBO
4 {
5 mat4 projection;
6 mat4 model;
7 float lodBias;
8 } ubo;
9
10 layout(location = 0) in vec3 inPos;
11 layout(location = 1) in vec4 colors[3];
12 layout(location = 4) in vec3 inNormal;
13 layout(location = 5) in mat4 inViewMat;
14 layout(location = 0) out vec3 outPos;
15 layout(location = 1) out vec3 outNormal;
16 layout(location = 2) out mat4 outTransModel;
17 layout(location = 6) out float outLodBias;
18 layout(location = 7) out vec4 color;
19
20 void write_deeper_in_function()
21 {
22 outTransModel[1][1] = ubo.lodBias;
23 color = colors[2];
24 }
25
26 void write_in_function()
27 {
28 outTransModel[2] = vec4(inNormal, 1.0);
29 write_deeper_in_function();
30 }
31
32 void main()
33 {
34 gl_Position = (ubo.projection * ubo.model) * vec4(inPos, 1.0);
35 outPos = vec3((ubo.model * vec4(inPos, 1.0)).xyz);
36 outNormal = mat3(vec3(ubo.model[0].x, ubo.model[0].y, ubo.model[0].z), vec3(ubo.model[1].x, ubo.model[1].y, ubo.model[1].z), vec3(ubo.model[2].x, ubo.model[2].y, ubo.model[2].z)) * inNormal;
37 outLodBias = ubo.lodBias;
38 outTransModel = transpose(ubo.model) * inViewMat;
39 write_in_function();
40 }
41