Debian Codegraph @

third_party/spirv-cross/shaders-hlsl-no-opt/frag/native-16bit-types.fxconly.nofxc.sm62.native-16bit.frag

raw
1 #version 450
2 #extension GL_EXT_shader_explicit_arithmetic_types : require
3
4 layout(location = 0) out f16vec4 Output;
5 layout(location = 0) in f16vec4 Input;
6 layout(location = 1) out i16vec4 OutputI;
7 layout(location = 1) flat in i16vec4 InputI;
8 layout(location = 2) out u16vec4 OutputU;
9 layout(location = 2) flat in u16vec4 InputU;
10
11 layout(set = 0, binding = 0) buffer Buf
12 {
13 float16_t foo0[4];
14 int16_t foo1[4];
15 uint16_t foo2[4];
16
17 f16vec4 foo3[4];
18 i16vec4 foo4[4];
19 u16vec4 foo5[4];
20
21 f16mat2x3 foo6[4];
22 layout(row_major) f16mat2x3 foo7[4];
23 };
24
25 void main()
26 {
27 int index = int(gl_FragCoord.x);
28 Output = Input + float16_t(20.0);
29 OutputI = InputI + int16_t(-40);
30 OutputU = InputU + uint16_t(20);
31
32 // Load 16-bit scalar.
33 Output += foo0[index];
34 OutputI += foo1[index];
35 OutputU += foo2[index];
36
37 // Load 16-bit vector.
38 Output += foo3[index];
39 OutputI += foo4[index];
40 OutputU += foo5[index];
41
42 // Load 16-bit vector from ColMajor matrix.
43 Output += foo6[index][1].xyzz;
44
45 // Load 16-bit vector from RowMajor matrix.
46 Output += foo7[index][1].xyzz;
47
48 // Load 16-bit matrix from ColMajor.
49 f16mat2x3 m0 = foo6[index];
50 // Load 16-bit matrix from RowMajor.
51 f16mat2x3 m1 = foo7[index];
52
53 // Store 16-bit scalar
54 foo0[index] = Output.x;
55 foo1[index] = OutputI.y;
56 foo2[index] = OutputU.z;
57
58 // Store 16-bit vector
59 foo3[index] = Output;
60 foo4[index] = OutputI;
61 foo5[index] = OutputU;
62
63 // Store 16-bit vector to ColMajor matrix.
64 foo6[index][1] = Output.xyz;
65 // Store 16-bit vector to RowMajor matrix.
66 foo7[index][1] = Output.xyz;
67
68 // Store 16-bit matrix to ColMajor.
69 foo6[index] = f16mat2x3(Output.xyz, Output.wzy);
70 // Store 16-bit matrix to RowMajor.
71 foo7[index] = f16mat2x3(Output.xyz, Output.wzy);
72 }