clang 19.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#endif
27
28// unsigned 32-bit integer.
29typedef unsigned int uint;
30
31// 64-bit integer.
32typedef unsigned long uint64_t;
33typedef long int64_t;
34
35// built-in vector data types:
36
37#ifdef __HLSL_ENABLE_16_BIT
38typedef vector<int16_t, 2> int16_t2;
39typedef vector<int16_t, 3> int16_t3;
40typedef vector<int16_t, 4> int16_t4;
41typedef vector<uint16_t, 2> uint16_t2;
42typedef vector<uint16_t, 3> uint16_t3;
43typedef vector<uint16_t, 4> uint16_t4;
44#endif
45typedef vector<bool, 2> bool2;
46typedef vector<bool, 3> bool3;
47typedef vector<bool, 4> bool4;
48typedef vector<int, 2> int2;
49typedef vector<int, 3> int3;
50typedef vector<int, 4> int4;
51typedef vector<uint, 2> uint2;
52typedef vector<uint, 3> uint3;
53typedef vector<uint, 4> uint4;
54typedef vector<int64_t, 2> int64_t2;
55typedef vector<int64_t, 3> int64_t3;
56typedef vector<int64_t, 4> int64_t4;
57typedef vector<uint64_t, 2> uint64_t2;
58typedef vector<uint64_t, 3> uint64_t3;
59typedef vector<uint64_t, 4> uint64_t4;
60
61typedef vector<half, 2> half2;
62typedef vector<half, 3> half3;
63typedef vector<half, 4> half4;
64
65typedef vector<float, 2> float2;
66typedef vector<float, 3> float3;
67typedef vector<float, 4> float4;
68typedef vector<double, 2> double2;
69typedef vector<double, 3> double3;
70typedef vector<double, 4> double4;
71
72} // namespace hlsl
73
74#endif //_HLSL_HLSL_BASIC_TYPES_H_
unsigned int uint
vector< half, 4 > half4
vector< half, 2 > half2
vector< uint, 2 > uint2
vector< int, 3 > int3
vector< uint64_t, 2 > uint64_t2
vector< float, 4 > float4
vector< int64_t, 4 > int64_t4
unsigned long uint64_t
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< uint64_t, 4 > uint64_t4
vector< double, 3 > double3
vector< float, 2 > float2
vector< float, 3 > float3
vector< int64_t, 2 > int64_t2
vector< uint, 3 > uint3
vector< double, 4 > double4
vector< double, 2 > double2
vector< bool, 2 > bool2
vector< int, 2 > int2
vector< uint, 4 > uint4
vector< half, 3 > half3