| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef FFX_COMMON_TYPES_H |
| 22 |
#define FFX_COMMON_TYPES_H |
| 23 |
|
| 24 |
#if defined(FFX_CPU) |
| 25 |
#define FFX_PARAMETER_IN |
| 26 |
#define FFX_PARAMETER_OUT |
| 27 |
#define FFX_PARAMETER_INOUT |
| 28 |
#elif defined(FFX_HLSL) |
| 29 |
#define FFX_PARAMETER_IN in |
| 30 |
#define FFX_PARAMETER_OUT out |
| 31 |
#define FFX_PARAMETER_INOUT inout |
| 32 |
#elif defined(FFX_GLSL) |
| 33 |
#define FFX_PARAMETER_IN in |
| 34 |
#define FFX_PARAMETER_OUT out |
| 35 |
#define FFX_PARAMETER_INOUT inout |
| 36 |
#endif |
| 37 |
|
| 38 |
#if defined(FFX_CPU) |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
typedef bool FfxBoolean; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
typedef uint8_t FfxUInt8; |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
typedef uint16_t FfxUInt16; |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
typedef uint32_t FfxUInt32; |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
typedef uint64_t FfxUInt64; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
typedef int8_t FfxInt8; |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
typedef int16_t FfxInt16; |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
typedef int32_t FfxInt32; |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
typedef int64_t FfxInt64; |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
typedef float FfxFloat32; |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
typedef float FfxFloat32x2[2]; |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
typedef float FfxFloat32x3[3]; |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
typedef float FfxFloat32x4[4]; |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
typedef uint32_t FfxUInt32x2[2]; |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
typedef uint32_t FfxUInt32x3[3]; |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
typedef uint32_t FfxUInt32x4[4]; |
| 118 |
#endif |
| 119 |
|
| 120 |
#if defined(FFX_HLSL) |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
typedef bool FfxBoolean; |
| 125 |
|
| 126 |
#if FFX_HLSL_6_2 |
| 127 |
typedef float32_t FfxFloat32; |
| 128 |
typedef float32_t2 FfxFloat32x2; |
| 129 |
typedef float32_t3 FfxFloat32x3; |
| 130 |
typedef float32_t4 FfxFloat32x4; |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
typedef uint32_t FfxUInt32; |
| 136 |
typedef uint32_t2 FfxUInt32x2; |
| 137 |
typedef uint32_t3 FfxUInt32x3; |
| 138 |
typedef uint32_t4 FfxUInt32x4; |
| 139 |
typedef int32_t FfxInt32; |
| 140 |
typedef int32_t2 FfxInt32x2; |
| 141 |
typedef int32_t3 FfxInt32x3; |
| 142 |
typedef int32_t4 FfxInt32x4; |
| 143 |
#else |
| 144 |
#define FfxFloat32 float |
| 145 |
#define FfxFloat32x2 float2 |
| 146 |
#define FfxFloat32x3 float3 |
| 147 |
#define FfxFloat32x4 float4 |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
typedef uint FfxUInt32; |
| 153 |
typedef uint2 FfxUInt32x2; |
| 154 |
typedef uint3 FfxUInt32x3; |
| 155 |
typedef uint4 FfxUInt32x4; |
| 156 |
typedef int FfxInt32; |
| 157 |
typedef int2 FfxInt32x2; |
| 158 |
typedef int3 FfxInt32x3; |
| 159 |
typedef int4 FfxInt32x4; |
| 160 |
#endif |
| 161 |
|
| 162 |
#if FFX_HALF |
| 163 |
#if FFX_HLSL_6_2 |
| 164 |
typedef float16_t FfxFloat16; |
| 165 |
typedef float16_t2 FfxFloat16x2; |
| 166 |
typedef float16_t3 FfxFloat16x3; |
| 167 |
typedef float16_t4 FfxFloat16x4; |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
typedef uint16_t FfxUInt16; |
| 173 |
typedef uint16_t2 FfxUInt16x2; |
| 174 |
typedef uint16_t3 FfxUInt16x3; |
| 175 |
typedef uint16_t4 FfxUInt16x4; |
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
typedef int16_t FfxInt16; |
| 181 |
typedef int16_t2 FfxInt16x2; |
| 182 |
typedef int16_t3 FfxInt16x3; |
| 183 |
typedef int16_t4 FfxInt16x4; |
| 184 |
#else |
| 185 |
typedef min16float FfxFloat16; |
| 186 |
typedef min16float2 FfxFloat16x2; |
| 187 |
typedef min16float3 FfxFloat16x3; |
| 188 |
typedef min16float4 FfxFloat16x4; |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
typedef min16uint FfxUInt16; |
| 194 |
typedef min16uint2 FfxUInt16x2; |
| 195 |
typedef min16uint3 FfxUInt16x3; |
| 196 |
typedef min16uint4 FfxUInt16x4; |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
typedef min16int FfxInt16; |
| 202 |
typedef min16int2 FfxInt16x2; |
| 203 |
typedef min16int3 FfxInt16x3; |
| 204 |
typedef min16int4 FfxInt16x4; |
| 205 |
#endif |
| 206 |
#endif |
| 207 |
#endif |
| 208 |
|
| 209 |
#if defined(FFX_GLSL) |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
#define FfxBoolean bool |
| 214 |
#define FfxFloat32 float |
| 215 |
#define FfxFloat32x2 vec2 |
| 216 |
#define FfxFloat32x3 vec3 |
| 217 |
#define FfxFloat32x4 vec4 |
| 218 |
#define FfxUInt32 uint |
| 219 |
#define FfxUInt32x2 uvec2 |
| 220 |
#define FfxUInt32x3 uvec3 |
| 221 |
#define FfxUInt32x4 uvec4 |
| 222 |
#define FfxInt32 int |
| 223 |
#define FfxInt32x2 ivec2 |
| 224 |
#define FfxInt32x3 ivec3 |
| 225 |
#define FfxInt32x4 ivec4 |
| 226 |
#if FFX_HALF |
| 227 |
#define FfxFloat16 float16_t |
| 228 |
#define FfxFloat16x2 f16vec2 |
| 229 |
#define FfxFloat16x3 f16vec3 |
| 230 |
#define FfxFloat16x4 f16vec4 |
| 231 |
#define FfxUInt16 uint16_t |
| 232 |
#define FfxUInt16x2 u16vec2 |
| 233 |
#define FfxUInt16x3 u16vec3 |
| 234 |
#define FfxUInt16x4 u16vec4 |
| 235 |
#define FfxInt16 int16_t |
| 236 |
#define FfxInt16x2 i16vec2 |
| 237 |
#define FfxInt16x3 i16vec3 |
| 238 |
#define FfxInt16x4 i16vec4 |
| 239 |
#endif |
| 240 |
#endif |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
#if FFX_HALF |
| 247 |
|
| 248 |
#if FFX_HLSL_6_2 |
| 249 |
|
| 250 |
#define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType##16_t TypeName; |
| 251 |
#define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector<BaseComponentType##16_t, COL> TypeName; |
| 252 |
#define FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix<BaseComponentType##16_t, ROW, COL> TypeName; |
| 253 |
|
| 254 |
#define FFX_16BIT_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType##16_t TypeName; |
| 255 |
#define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) typedef vector<BaseComponentType##16_t, COL> TypeName; |
| 256 |
#define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix<BaseComponentType##16_t, ROW, COL> TypeName; |
| 257 |
|
| 258 |
#else |
| 259 |
|
| 260 |
#define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef min16##BaseComponentType TypeName; |
| 261 |
#define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector<min16##BaseComponentType, COL> TypeName; |
| 262 |
#define FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix<min16##BaseComponentType, ROW, COL> TypeName; |
| 263 |
|
| 264 |
#define FFX_16BIT_SCALAR( TypeName, BaseComponentType ) FFX_MIN16_SCALAR( TypeName, BaseComponentType ); |
| 265 |
#define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ); |
| 266 |
#define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ); |
| 267 |
|
| 268 |
#endif |
| 269 |
|
| 270 |
#else |
| 271 |
|
| 272 |
#define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType TypeName; |
| 273 |
#define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector<BaseComponentType, COL> TypeName; |
| 274 |
#define FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix<BaseComponentType, ROW, COL> TypeName; |
| 275 |
|
| 276 |
#define FFX_16BIT_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType TypeName; |
| 277 |
#define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) typedef vector<BaseComponentType, COL> TypeName; |
| 278 |
#define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix<BaseComponentType, ROW, COL> TypeName; |
| 279 |
|
| 280 |
#endif |
| 281 |
|
| 282 |
#if defined(FFX_GPU) |
| 283 |
|
| 284 |
#if defined(FFX_HLSL) |
| 285 |
FFX_MIN16_SCALAR( FFX_MIN16_F , float ); |
| 286 |
FFX_MIN16_VECTOR( FFX_MIN16_F2, float, 2 ); |
| 287 |
FFX_MIN16_VECTOR( FFX_MIN16_F3, float, 3 ); |
| 288 |
FFX_MIN16_VECTOR( FFX_MIN16_F4, float, 4 ); |
| 289 |
|
| 290 |
FFX_MIN16_SCALAR( FFX_MIN16_I, int ); |
| 291 |
FFX_MIN16_VECTOR( FFX_MIN16_I2, int, 2 ); |
| 292 |
FFX_MIN16_VECTOR( FFX_MIN16_I3, int, 3 ); |
| 293 |
FFX_MIN16_VECTOR( FFX_MIN16_I4, int, 4 ); |
| 294 |
|
| 295 |
FFX_MIN16_SCALAR( FFX_MIN16_U, uint ); |
| 296 |
FFX_MIN16_VECTOR( FFX_MIN16_U2, uint, 2 ); |
| 297 |
FFX_MIN16_VECTOR( FFX_MIN16_U3, uint, 3 ); |
| 298 |
FFX_MIN16_VECTOR( FFX_MIN16_U4, uint, 4 ); |
| 299 |
|
| 300 |
FFX_16BIT_SCALAR( FFX_F16_t , float ); |
| 301 |
FFX_16BIT_VECTOR( FFX_F16_t2, float, 2 ); |
| 302 |
FFX_16BIT_VECTOR( FFX_F16_t3, float, 3 ); |
| 303 |
FFX_16BIT_VECTOR( FFX_F16_t4, float, 4 ); |
| 304 |
|
| 305 |
FFX_16BIT_SCALAR( FFX_I16_t, int ); |
| 306 |
FFX_16BIT_VECTOR( FFX_I16_t2, int, 2 ); |
| 307 |
FFX_16BIT_VECTOR( FFX_I16_t3, int, 3 ); |
| 308 |
FFX_16BIT_VECTOR( FFX_I16_t4, int, 4 ); |
| 309 |
|
| 310 |
FFX_16BIT_SCALAR( FFX_U16_t, uint ); |
| 311 |
FFX_16BIT_VECTOR( FFX_U16_t2, uint, 2 ); |
| 312 |
FFX_16BIT_VECTOR( FFX_U16_t3, uint, 3 ); |
| 313 |
FFX_16BIT_VECTOR( FFX_U16_t4, uint, 4 ); |
| 314 |
|
| 315 |
#define TYPEDEF_MIN16_TYPES(Prefix) \ |
| 316 |
typedef FFX_MIN16_F Prefix##_F; \ |
| 317 |
typedef FFX_MIN16_F2 Prefix##_F2; \ |
| 318 |
typedef FFX_MIN16_F3 Prefix##_F3; \ |
| 319 |
typedef FFX_MIN16_F4 Prefix##_F4; \ |
| 320 |
typedef FFX_MIN16_I Prefix##_I; \ |
| 321 |
typedef FFX_MIN16_I2 Prefix##_I2; \ |
| 322 |
typedef FFX_MIN16_I3 Prefix##_I3; \ |
| 323 |
typedef FFX_MIN16_I4 Prefix##_I4; \ |
| 324 |
typedef FFX_MIN16_U Prefix##_U; \ |
| 325 |
typedef FFX_MIN16_U2 Prefix##_U2; \ |
| 326 |
typedef FFX_MIN16_U3 Prefix##_U3; \ |
| 327 |
typedef FFX_MIN16_U4 Prefix##_U4; |
| 328 |
|
| 329 |
#define TYPEDEF_16BIT_TYPES(Prefix) \ |
| 330 |
typedef FFX_16BIT_F Prefix##_F; \ |
| 331 |
typedef FFX_16BIT_F2 Prefix##_F2; \ |
| 332 |
typedef FFX_16BIT_F3 Prefix##_F3; \ |
| 333 |
typedef FFX_16BIT_F4 Prefix##_F4; \ |
| 334 |
typedef FFX_16BIT_I Prefix##_I; \ |
| 335 |
typedef FFX_16BIT_I2 Prefix##_I2; \ |
| 336 |
typedef FFX_16BIT_I3 Prefix##_I3; \ |
| 337 |
typedef FFX_16BIT_I4 Prefix##_I4; \ |
| 338 |
typedef FFX_16BIT_U Prefix##_U; \ |
| 339 |
typedef FFX_16BIT_U2 Prefix##_U2; \ |
| 340 |
typedef FFX_16BIT_U3 Prefix##_U3; \ |
| 341 |
typedef FFX_16BIT_U4 Prefix##_U4; |
| 342 |
|
| 343 |
#define TYPEDEF_FULL_PRECISION_TYPES(Prefix) \ |
| 344 |
typedef FfxFloat32 Prefix##_F; \ |
| 345 |
typedef FfxFloat32x2 Prefix##_F2; \ |
| 346 |
typedef FfxFloat32x3 Prefix##_F3; \ |
| 347 |
typedef FfxFloat32x4 Prefix##_F4; \ |
| 348 |
typedef FfxInt32 Prefix##_I; \ |
| 349 |
typedef FfxInt32x2 Prefix##_I2; \ |
| 350 |
typedef FfxInt32x3 Prefix##_I3; \ |
| 351 |
typedef FfxInt32x4 Prefix##_I4; \ |
| 352 |
typedef FfxUInt32 Prefix##_U; \ |
| 353 |
typedef FfxUInt32x2 Prefix##_U2; \ |
| 354 |
typedef FfxUInt32x3 Prefix##_U3; \ |
| 355 |
typedef FfxUInt32x4 Prefix##_U4; |
| 356 |
#endif |
| 357 |
|
| 358 |
#if defined(FFX_GLSL) |
| 359 |
|
| 360 |
#if FFX_HALF |
| 361 |
|
| 362 |
#define FFX_MIN16_F float16_t |
| 363 |
#define FFX_MIN16_F2 f16vec2 |
| 364 |
#define FFX_MIN16_F3 f16vec3 |
| 365 |
#define FFX_MIN16_F4 f16vec4 |
| 366 |
|
| 367 |
#define FFX_MIN16_I int16_t |
| 368 |
#define FFX_MIN16_I2 i16vec2 |
| 369 |
#define FFX_MIN16_I3 i16vec3 |
| 370 |
#define FFX_MIN16_I4 i16vec4 |
| 371 |
|
| 372 |
#define FFX_MIN16_U uint16_t |
| 373 |
#define FFX_MIN16_U2 u16vec2 |
| 374 |
#define FFX_MIN16_U3 u16vec3 |
| 375 |
#define FFX_MIN16_U4 u16vec4 |
| 376 |
|
| 377 |
#define FFX_16BIT_F float16_t |
| 378 |
#define FFX_16BIT_F2 f16vec2 |
| 379 |
#define FFX_16BIT_F3 f16vec3 |
| 380 |
#define FFX_16BIT_F4 f16vec4 |
| 381 |
|
| 382 |
#define FFX_16BIT_I int16_t |
| 383 |
#define FFX_16BIT_I2 i16vec2 |
| 384 |
#define FFX_16BIT_I3 i16vec3 |
| 385 |
#define FFX_16BIT_I4 i16vec4 |
| 386 |
|
| 387 |
#define FFX_16BIT_U uint16_t |
| 388 |
#define FFX_16BIT_U2 u16vec2 |
| 389 |
#define FFX_16BIT_U3 u16vec3 |
| 390 |
#define FFX_16BIT_U4 u16vec4 |
| 391 |
|
| 392 |
#else |
| 393 |
|
| 394 |
#define FFX_MIN16_F float |
| 395 |
#define FFX_MIN16_F2 vec2 |
| 396 |
#define FFX_MIN16_F3 vec3 |
| 397 |
#define FFX_MIN16_F4 vec4 |
| 398 |
|
| 399 |
#define FFX_MIN16_I int |
| 400 |
#define FFX_MIN16_I2 ivec2 |
| 401 |
#define FFX_MIN16_I3 ivec3 |
| 402 |
#define FFX_MIN16_I4 ivec4 |
| 403 |
|
| 404 |
#define FFX_MIN16_U uint |
| 405 |
#define FFX_MIN16_U2 uvec2 |
| 406 |
#define FFX_MIN16_U3 uvec3 |
| 407 |
#define FFX_MIN16_U4 uvec4 |
| 408 |
|
| 409 |
#define FFX_16BIT_F float |
| 410 |
#define FFX_16BIT_F2 vec2 |
| 411 |
#define FFX_16BIT_F3 vec3 |
| 412 |
#define FFX_16BIT_F4 vec4 |
| 413 |
|
| 414 |
#define FFX_16BIT_I int |
| 415 |
#define FFX_16BIT_I2 ivec2 |
| 416 |
#define FFX_16BIT_I3 ivec3 |
| 417 |
#define FFX_16BIT_I4 ivec4 |
| 418 |
|
| 419 |
#define FFX_16BIT_U uint |
| 420 |
#define FFX_16BIT_U2 uvec2 |
| 421 |
#define FFX_16BIT_U3 uvec3 |
| 422 |
#define FFX_16BIT_U4 uvec4 |
| 423 |
|
| 424 |
#endif |
| 425 |
|
| 426 |
#endif |
| 427 |
|
| 428 |
#endif |
| 429 |
#endif |