clang 20.0.0git
hlsl_basic_types.h
Go to the documentation of this file.
1//===----- hlsl_basic_types.h - HLSL definitions for basic types ----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _HLSL_HLSL_BASIC_TYPES_H_
10#define _HLSL_HLSL_BASIC_TYPES_H_
11
12namespace hlsl {
13// built-in scalar data types:
14
15/// \typedef template<typename Ty, int Size> using vector = Ty
16/// __attribute__((ext_vector_type(Size)))
17///
18/// \tparam Ty The base type of the vector may be any builtin integral or
19/// floating point type.
20/// \tparam Size The size of the vector may be any value between 1 and 4.
21
22#ifdef __HLSL_ENABLE_16_BIT
23// 16-bit integer.
24typedef unsigned short uint16_t;
25typedef short int16_t;
26
27// 16-bit floating point.
28typedef half float16_t;
29#endif
30
31// 32-bit integer.
32typedef int int32_t;
33
34// unsigned 32-bit integer.
35typedef unsigned int uint;
36typedef unsigned int uint32_t;
37
38// 32-bit floating point.
39typedef float float32_t;
40
41// 64-bit integer.
42typedef unsigned long uint64_t;
43typedef long int64_t;
44
45// 64-bit floating point
46typedef double float64_t;
47
48// built-in vector data types:
49
50#ifdef __HLSL_ENABLE_16_BIT
51typedef vector<int16_t, 1> int16_t1;
52typedef vector<int16_t, 2> int16_t2;
53typedef vector<int16_t, 3> int16_t3;
54typedef vector<int16_t, 4> int16_t4;
55typedef vector<uint16_t, 1> uint16_t1;
56typedef vector<uint16_t, 2> uint16_t2;
57typedef vector<uint16_t, 3> uint16_t3;
58typedef vector<uint16_t, 4> uint16_t4;
59#endif
60typedef vector<bool, 1> bool1;
61typedef vector<bool, 2> bool2;
62typedef vector<bool, 3> bool3;
63typedef vector<bool, 4> bool4;
64typedef vector<int, 1> int1;
65typedef vector<int, 2> int2;
66typedef vector<int, 3> int3;
67typedef vector<int, 4> int4;
68typedef vector<uint, 1> uint1;
69typedef vector<uint, 2> uint2;
70typedef vector<uint, 3> uint3;
71typedef vector<uint, 4> uint4;
72typedef vector<int32_t, 1> int32_t1;
73typedef vector<int32_t, 2> int32_t2;
74typedef vector<int32_t, 3> int32_t3;
75typedef vector<int32_t, 4> int32_t4;
76typedef vector<uint32_t, 1> uint32_t1;
77typedef vector<uint32_t, 2> uint32_t2;
78typedef vector<uint32_t, 3> uint32_t3;
79typedef vector<uint32_t, 4> uint32_t4;
80typedef vector<int64_t, 1> int64_t1;
81typedef vector<int64_t, 2> int64_t2;
82typedef vector<int64_t, 3> int64_t3;
83typedef vector<int64_t, 4> int64_t4;
84typedef vector<uint64_t, 1> uint64_t1;
85typedef vector<uint64_t, 2> uint64_t2;
86typedef vector<uint64_t, 3> uint64_t3;
87typedef vector<uint64_t, 4> uint64_t4;
88
89typedef vector<half, 1> half1;
90typedef vector<half, 2> half2;
91typedef vector<half, 3> half3;
92typedef vector<half, 4> half4;
93typedef vector<float, 1> float1;
94typedef vector<float, 2> float2;
95typedef vector<float, 3> float3;
96typedef vector<float, 4> float4;
97typedef vector<double, 1> double1;
98typedef vector<double, 2> double2;
99typedef vector<double, 3> double3;
100typedef vector<double, 4> double4;
101
102#ifdef __HLSL_ENABLE_16_BIT
103typedef vector<float16_t, 1> float16_t1;
104typedef vector<float16_t, 2> float16_t2;
105typedef vector<float16_t, 3> float16_t3;
106typedef vector<float16_t, 4> float16_t4;
107#endif
108
109typedef vector<float32_t, 1> float32_t1;
110typedef vector<float32_t, 2> float32_t2;
111typedef vector<float32_t, 3> float32_t3;
112typedef vector<float32_t, 4> float32_t4;
113typedef vector<float64_t, 1> float64_t1;
114typedef vector<float64_t, 2> float64_t2;
115typedef vector<float64_t, 3> float64_t3;
116typedef vector<float64_t, 4> float64_t4;
117
118} // namespace hlsl
119
120#endif //_HLSL_HLSL_BASIC_TYPES_H_
unsigned int uint
double float64_t
vector< half, 4 > half4
vector< int32_t, 1 > int32_t1
vector< float64_t, 4 > float64_t4
vector< half, 2 > half2
vector< float64_t, 3 > float64_t3
vector< float32_t, 3 > float32_t3
vector< uint, 2 > uint2
vector< int, 3 > int3
vector< uint64_t, 2 > uint64_t2
vector< uint64_t, 1 > uint64_t1
vector< float32_t, 1 > float32_t1
vector< float, 4 > float4
vector< int64_t, 4 > int64_t4
unsigned long uint64_t
vector< uint, 1 > uint1
vector< uint32_t, 1 > uint32_t1
vector< uint32_t, 3 > uint32_t3
vector< uint64_t, 3 > uint64_t3
vector< bool, 4 > bool4
long int64_t
vector< int64_t, 3 > int64_t3
vector< int, 4 > int4
vector< bool, 3 > bool3
vector< float64_t, 1 > float64_t1
vector< uint64_t, 4 > uint64_t4
vector< bool, 1 > bool1
int int32_t
vector< int32_t, 2 > int32_t2
vector< double, 3 > double3
vector< float, 2 > float2
vector< double, 1 > double1
vector< float, 3 > float3
vector< int64_t, 2 > int64_t2
vector< half, 1 > half1
vector< float32_t, 2 > float32_t2
vector< uint, 3 > uint3
vector< int64_t, 1 > int64_t1
vector< uint32_t, 2 > uint32_t2
vector< int32_t, 4 > int32_t4
vector< double, 4 > double4
vector< double, 2 > double2
vector< bool, 2 > bool2
vector< int, 2 > int2
vector< uint, 4 > uint4
vector< half, 3 > half3
vector< float32_t, 4 > float32_t4
vector< int, 1 > int1
vector< float64_t, 2 > float64_t2
float float32_t
vector< float, 1 > float1
vector< uint32_t, 4 > uint32_t4
vector< int32_t, 3 > int32_t3
unsigned int uint32_t