Debian Codegraph @

thirdparty/amd-fsr2/shaders/ffx_core_cpu.h

raw symbols SCIP
1 // This file is part of the FidelityFX SDK.
2 //
3 // Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 // THE SOFTWARE.
21
22 /// A define for a true value in a boolean expression.
23 ///
24 /// @ingroup CPU
25 #define FFX_TRUE (1)
26
27 /// A define for a false value in a boolean expression.
28 ///
29 /// @ingroup CPU
30 #define FFX_FALSE (0)
31
32 #if !defined(FFX_STATIC)
33 /// A define to abstract declaration of static variables and functions.
34 ///
35 /// @ingroup CPU
36 #define FFX_STATIC static
37 #endif // #if !defined(FFX_STATIC)
38
39 #ifdef __clang__
40 #pragma clang diagnostic ignored "-Wunused-variable"
41 #endif
42
43 /// Interpret the bit layout of an IEEE-754 floating point value as an unsigned integer.
44 ///
45 /// @param [in] x A 32bit floating value.
46 ///
47 /// @returns
48 /// An unsigned 32bit integer value containing the bit pattern of <c><i>x</i></c>.
49 ///
50 /// @ingroup CPU
51 FFX_STATIC FfxUInt32 ffxAsUInt32(FfxFloat32 x)
52 {
53 union
54 {
55 FfxFloat32 f;
56 FfxUInt32 u;
57 } bits;
58
59 bits.f = x;
60 return bits.u;
61 }
62
63 FFX_STATIC FfxFloat32 ffxDot2(FfxFloat32x2 a, FfxFloat32x2 b)
64 {
65 return a[0] * b[0] + a[1] * b[1];
66 }
67
68 FFX_STATIC FfxFloat32 ffxDot3(FfxFloat32x3 a, FfxFloat32x3 b)
69 {
70 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
71 }
72
73 FFX_STATIC FfxFloat32 ffxDot4(FfxFloat32x4 a, FfxFloat32x4 b)
74 {
75 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
76 }
77
78 /// Compute the linear interopation between two values.
79 ///
80 /// Implemented by calling the GLSL <c><i>mix</i></c> instrinsic function. Implements the
81 /// following math:
82 ///
83 /// (1 - t) * x + t * y
84 ///
85 /// @param [in] x The first value to lerp between.
86 /// @param [in] y The second value to lerp between.
87 /// @param [in] t The value to determine how much of <c><i>x</i></c> and how much of <c><i>y</i></c>.
88 ///
89 /// @returns
90 /// A linearly interpolated value between <c><i>x</i></c> and <c><i>y</i></c> according to <c><i>t</i></c>.
91 ///
92 /// @ingroup CPU
93 FFX_STATIC FfxFloat32 ffxLerp(FfxFloat32 x, FfxFloat32 y, FfxFloat32 t)
94 {
95 return y * t + (-x * t + x);
96 }
97
98 /// Compute the reciprocal of a value.
99 ///
100 /// @param [in] x The value to compute the reciprocal for.
101 ///
102 /// @returns
103 /// The reciprocal value of <c><i>x</i></c>.
104 ///
105 /// @ingroup CPU
106 FFX_STATIC FfxFloat32 ffxReciprocal(FfxFloat32 a)
107 {
108 return 1.0f / a;
109 }
110
111 /// Compute the square root of a value.
112 ///
113 /// @param [in] x The first value to compute the min of.
114 ///
115 /// @returns
116 /// The the square root of <c><i>x</i></c>.
117 ///
118 /// @ingroup CPU
119 FFX_STATIC FfxFloat32 ffxSqrt(FfxFloat32 x)
120 {
121 return sqrt(x);
122 }
123
124 FFX_STATIC FfxUInt32 AShrSU1(FfxUInt32 a, FfxUInt32 b)
125 {
126 return FfxUInt32(FfxInt32(a) >> FfxInt32(b));
127 }
128
129 /// Compute the factional part of a decimal value.
130 ///
131 /// This function calculates <c><i>x - floor(x)</i></c>.
132 ///
133 /// @param [in] x The value to compute the fractional part from.
134 ///
135 /// @returns
136 /// The fractional part of <c><i>x</i></c>.
137 ///
138 /// @ingroup CPU
139 FFX_STATIC FfxFloat32 ffxFract(FfxFloat32 a)
140 {
141 return a - floor(a);
142 }
143
144 /// Compute the reciprocal square root of a value.
145 ///
146 /// @param [in] x The value to compute the reciprocal for.
147 ///
148 /// @returns
149 /// The reciprocal square root value of <c><i>x</i></c>.
150 ///
151 /// @ingroup CPU
152 FFX_STATIC FfxFloat32 rsqrt(FfxFloat32 a)
153 {
154 return ffxReciprocal(ffxSqrt(a));
155 }
156
157 FFX_STATIC FfxFloat32 ffxMin(FfxFloat32 x, FfxFloat32 y)
158 {
159 return x < y ? x : y;
160 }
161
162 FFX_STATIC FfxUInt32 ffxMin(FfxUInt32 x, FfxUInt32 y)
163 {
164 return x < y ? x : y;
165 }
166
167 FFX_STATIC FfxFloat32 ffxMax(FfxFloat32 x, FfxFloat32 y)
168 {
169 return x > y ? x : y;
170 }
171
172 FFX_STATIC FfxUInt32 ffxMax(FfxUInt32 x, FfxUInt32 y)
173 {
174 return x > y ? x : y;
175 }
176
177 /// Clamp a value to a [0..1] range.
178 ///
179 /// @param [in] x The value to clamp to [0..1] range.
180 ///
181 /// @returns
182 /// The clamped version of <c><i>x</i></c>.
183 ///
184 /// @ingroup CPU
185 FFX_STATIC FfxFloat32 ffxSaturate(FfxFloat32 a)
186 {
187 return ffxMin(1.0f, ffxMax(0.0f, a));
188 }
189
190 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
191 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
192
193 FFX_STATIC void opAAddOneF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b)
194 {
195 d[0] = a[0] + b;
196 d[1] = a[1] + b;
197 d[2] = a[2] + b;
198 return;
199 }
200
201 FFX_STATIC void opACpyF3(FfxFloat32x3 d, FfxFloat32x3 a)
202 {
203 d[0] = a[0];
204 d[1] = a[1];
205 d[2] = a[2];
206 return;
207 }
208
209 FFX_STATIC void opAMulF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32x3 b)
210 {
211 d[0] = a[0] * b[0];
212 d[1] = a[1] * b[1];
213 d[2] = a[2] * b[2];
214 return;
215 }
216
217 FFX_STATIC void opAMulOneF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b)
218 {
219 d[0] = a[0] * b;
220 d[1] = a[1] * b;
221 d[2] = a[2] * b;
222 return;
223 }
224
225 FFX_STATIC void opARcpF3(FfxFloat32x3 d, FfxFloat32x3 a)
226 {
227 d[0] = ffxReciprocal(a[0]);
228 d[1] = ffxReciprocal(a[1]);
229 d[2] = ffxReciprocal(a[2]);
230 return;
231 }
232
233 /// Convert FfxFloat32 to half (in lower 16-bits of output).
234 ///
235 /// This function implements the same fast technique that is documented here: ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf
236 ///
237 /// The function supports denormals.
238 ///
239 /// Some conversion rules are to make computations possibly "safer" on the GPU,
240 /// -INF & -NaN -> -65504
241 /// +INF & +NaN -> +65504
242 ///
243 /// @param [in] f The 32bit floating point value to convert.
244 ///
245 /// @returns
246 /// The closest 16bit floating point value to <c><i>f</i></c>.
247 ///
248 /// @ingroup CPU
249 FFX_STATIC FfxUInt32 f32tof16(FfxFloat32 f)
250 {
251 static FfxUInt16 base[512] = {
252 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
253 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
254 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
255 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
256 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
257 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400,
258 0x0800, 0x0c00, 0x1000, 0x1400, 0x1800, 0x1c00, 0x2000, 0x2400, 0x2800, 0x2c00, 0x3000, 0x3400, 0x3800, 0x3c00, 0x4000, 0x4400, 0x4800, 0x4c00, 0x5000,
259 0x5400, 0x5800, 0x5c00, 0x6000, 0x6400, 0x6800, 0x6c00, 0x7000, 0x7400, 0x7800, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
260 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
261 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
262 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
263 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
264 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
265 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
266 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
267 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
268 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
269 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
270 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8001, 0x8002,
271 0x8004, 0x8008, 0x8010, 0x8020, 0x8040, 0x8080, 0x8100, 0x8200, 0x8400, 0x8800, 0x8c00, 0x9000, 0x9400, 0x9800, 0x9c00, 0xa000, 0xa400, 0xa800, 0xac00,
272 0xb000, 0xb400, 0xb800, 0xbc00, 0xc000, 0xc400, 0xc800, 0xcc00, 0xd000, 0xd400, 0xd800, 0xdc00, 0xe000, 0xe400, 0xe800, 0xec00, 0xf000, 0xf400, 0xf800,
273 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff,
274 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff,
275 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff,
276 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff,
277 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff,
278 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff
279 };
280
281 static FfxUInt8 shift[512] = {
282 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
283 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
284 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
285 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
286 0x18, 0x18, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
287 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
288 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
289 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
290 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
291 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
292 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
293 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
294 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
295 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
296 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
297 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x18,
298 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
299 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
300 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
301 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
302 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18
303 };
304
305 union
306 {
307 FfxFloat32 f;
308 FfxUInt32 u;
309 } bits;
310
311 bits.f = f;
312 FfxUInt32 u = bits.u;
313 FfxUInt32 i = u >> 23;
314 return (FfxUInt32)(base[i]) + ((u & 0x7fffff) >> shift[i]);
315 }
316
317 /// Pack 2x32-bit floating point values in a single 32bit value.
318 ///
319 /// This function first converts each component of <c><i>value</i></c> into their nearest 16-bit floating
320 /// point representation, and then stores the X and Y components in the lower and upper 16 bits of the
321 /// 32bit unsigned integer respectively.
322 ///
323 /// @param [in] value A 2-dimensional floating point value to convert and pack.
324 ///
325 /// @returns
326 /// A packed 32bit value containing 2 16bit floating point values.
327 ///
328 /// @ingroup CPU
329 FFX_STATIC FfxUInt32 packHalf2x16(FfxFloat32x2 a)
330 {
331 return f32tof16(a[0]) + (f32tof16(a[1]) << 16);
332 }