Cogs.Core
DataFormat.cpp
1#include "DataFormat.h"
2
3#include <stddef.h>
4
5namespace {
6 using namespace Cogs;
7
8 FormatInfo formatInfo[] = {
9 { 0, { 0, 0, 0 }, 0 , "Unknown", "", FormatFlags::None }, // Unknown
10
11 // Normalized unsigned byte formats
12
13 { 1, { 1, 1, 1 }, 1, "R8_UNORM", "X8_UNORM", FormatFlags::VertexFormat },
14 { 2, { 1, 1, 1 }, 2, "R8G8_UNORM", "X8Y8_UNORM", FormatFlags::VertexFormat },
15 { 3, { 1, 1, 1 }, 3, "R8G8B8_UNORM", "X8Y8Z8_UNORM", FormatFlags::VertexFormat },
16 { 4, { 1, 1, 1 }, 4, "R8G8B8A8_UNORM", "X8Y8Z8W8_UNORM", FormatFlags::Alpha | FormatFlags::VertexFormat },
17
18 // Normalized unsigned 16 bit integer formats
19
20 { 2, { 1, 1, 1 }, 1, "R16_UNORM", "X16_UNORM", FormatFlags::VertexFormat },
21 { 4, { 1, 1, 1 }, 2, "R16G16_UNORM", "X16Y16_UNORM", FormatFlags::VertexFormat },
22 { 6, { 1, 1, 1 }, 3, "R16G16B16_UNORM", "X16Y16Z16_UNORM", FormatFlags::VertexFormat },
23 { 8, { 1, 1, 1 }, 4, "R16G16B16A16_UNORM", "X16Y16Z16W16_UNORM", FormatFlags::Alpha | FormatFlags::VertexFormat },
24
25 // Normalized signed byte formats
26
27 { 1, { 1, 1, 1 }, 1, "R8_SNORM", "X8_SNORM", FormatFlags::VertexFormat },
28 { 2, { 1, 1, 1 }, 2, "R8G8_SNORM", "X8Y8_SNORM", FormatFlags::VertexFormat },
29 { 3, { 1, 1, 1 }, 3, "R8G8B8_SNORM", "X8Y8Z8_SNORM", FormatFlags::VertexFormat },
30 { 4, { 1, 1, 1 }, 4, "R8G8B8A8_SNORM", "X8Y8Z8W8_SNORM", FormatFlags::Alpha | FormatFlags::VertexFormat },
31
32 // Normalized signed 16 bit integer formats
33
34 { 2, { 1, 1, 1 }, 1, "R16_SNORM", "X16_SNORM", FormatFlags::VertexFormat },
35 { 4, { 1, 1, 1 }, 2, "R16G16_SNORM", "X16Y16_SNORM", FormatFlags::VertexFormat },
36 { 6, { 1, 1, 1 }, 3, "R16G16B16_SNORM", "X16Y16Z16_SNORM", FormatFlags::VertexFormat },
37 { 8, { 1, 1, 1 }, 4, "R16G16B16A16_SNORM", "X16Y16Z16W16_SNORM", FormatFlags::Alpha | FormatFlags::VertexFormat },
38
39 // Unsigned byte formats
40
41 { 1, { 1, 1, 1 }, 1, "R8_UINT", "X8_UINT", FormatFlags::VertexFormat | FormatFlags::Unsigned },
42 { 2, { 1, 1, 1 }, 2, "R8G8_UINT", "X8Y8_UINT", FormatFlags::VertexFormat | FormatFlags::Unsigned },
43 { 3, { 1, 1, 1 }, 3, "R8G8B8_UINT", "X8Y8Z8_UINT", FormatFlags::VertexFormat | FormatFlags::Unsigned },
44 { 4, { 1, 1, 1 }, 4, "R8G8B8A8_UINT", "X8Y8Z8W8_UINT", FormatFlags::Alpha | FormatFlags::VertexFormat | FormatFlags::Unsigned },
45
46 // Unsigned 16 bit integer formats
47
48 { 2, { 1, 1, 1 }, 1, "R16_UINT", "X16_UINT", FormatFlags::VertexFormat | FormatFlags::Unsigned },
49 { 4, { 1, 1, 1 }, 2, "R16G16_UINT", "X16Y16_UINT", FormatFlags::VertexFormat | FormatFlags::Unsigned },
50 { 6, { 1, 1, 1 }, 3, "R16G16B16_UINT", "X16Y16Z16_UINT", FormatFlags::VertexFormat | FormatFlags::Unsigned },
51 { 8, { 1, 1, 1 }, 4, "R16G16B16A16_UINT", "X16Y16Z16W16_UINT", FormatFlags::Alpha | FormatFlags::VertexFormat | FormatFlags::Unsigned },
52
53 // Unsigned 32 bit integer formats
54
55 { 4, { 1, 1, 1 }, 1, "R32_UINT", "X32_UINT", FormatFlags::VertexFormat | FormatFlags::Unsigned },
56 { 8, { 1, 1, 1 }, 2, "R32G32_UINT", "X32Y32_UINT", FormatFlags::VertexFormat | FormatFlags::Unsigned },
57 { 12, { 1, 1, 1 }, 3, "R32G32B32_UINT", "X32Y32Z32_UINT", FormatFlags::VertexFormat | FormatFlags::Unsigned },
58 { 16, { 1, 1, 1 }, 4, "R32G32B32A32_UINT", "X32Y32Z32W32_UINT", FormatFlags::Alpha | FormatFlags::VertexFormat | FormatFlags::Unsigned },
59
60 // Signed byte formats
61
62 { 1, { 1, 1, 1 }, 1, "R8_SINT", "X8_SINT", FormatFlags::VertexFormat | FormatFlags::Integer },
63 { 2, { 1, 1, 1 }, 2, "R8G8_SINT", "X8Y8_SINT", FormatFlags::VertexFormat | FormatFlags::Integer},
64 { 3, { 1, 1, 1 }, 3, "R8G8B8_SINT", "X8Y8Z8_SINT", FormatFlags::VertexFormat | FormatFlags::Integer},
65 { 4, { 1, 1, 1 }, 4, "R8G8B8A8_SINT", "X8Y8Z8W8_SINT", FormatFlags::Alpha | FormatFlags::VertexFormat | FormatFlags::Integer},
66
67 // Signed 16 bit integer formats
68
69 { 2, { 1, 1, 1 }, 1, "R16_SINT", "X16_SINT", FormatFlags::VertexFormat | FormatFlags::Integer},
70 { 4, { 1, 1, 1 }, 2, "R16G16_SINT", "X16Y16_SINT", FormatFlags::VertexFormat | FormatFlags::Integer},
71 { 6, { 1, 1, 1 }, 3, "R16G16B16_SINT", "X16Y16Z16_SINT", FormatFlags::VertexFormat | FormatFlags::Integer},
72 { 8, { 1, 1, 1 }, 4, "R16G16B16A16_SINT", "X16Y16Z16W16_SINT", FormatFlags::Alpha | FormatFlags::VertexFormat | FormatFlags::Integer},
73
74 // Signed 32 bit integer formats
75
76 { 4, { 1, 1, 1 }, 1, "R32_SINT", "X32_SINT", FormatFlags::VertexFormat | FormatFlags::Integer},
77 { 8, { 1, 1, 1 }, 2, "R32G32_SINT", "X32Y32_SINT", FormatFlags::VertexFormat | FormatFlags::Integer},
78 { 12, { 1, 1, 1 }, 3, "R32G32B32_SINT", "X32Y32Z32_SINT", FormatFlags::VertexFormat | FormatFlags::Integer},
79 { 16, { 1, 1, 1 }, 4, "R32G32B32A32_SINT", "X32Y32Z32W32_SINT", FormatFlags::Alpha | FormatFlags::VertexFormat | FormatFlags::Integer},
80
81 // 16 bit floating point formats
82
83 { 2, { 1, 1, 1 }, 1, "R16_FLOAT", "X16_FLOAT", FormatFlags::VertexFormat },
84 { 4, { 1, 1, 1 }, 2, "R16G16_FLOAT", "X16Y16_FLOAT", FormatFlags::VertexFormat },
85 { 6, { 1, 1, 1 }, 3, "R16G16B16_FLOAT", "X16Y16Z16_FLOAT", FormatFlags::VertexFormat },
86 { 8, { 1, 1, 1 }, 4, "R16G16B16A16_FLOAT", "X16Y16Z16W16_FLOAT", FormatFlags::Alpha | FormatFlags::VertexFormat },
87
88 // 32 bit floating point formats
89
90 { 4, { 1, 1, 1 }, 1, "R32_FLOAT", "X32_FLOAT", FormatFlags::VertexFormat },
91 { 8, { 1, 1, 1 }, 2, "R32G32_FLOAT", "X32Y32_FLOAT", FormatFlags::VertexFormat },
92 { 12, { 1, 1, 1 }, 3, "R32G32B32_FLOAT", "X32Y32Z32_FLOAT", FormatFlags::VertexFormat },
93 { 16, { 1, 1, 1 }, 4, "R32G32B32A32_FLOAT", "X32Y32Z32W32_FLOAT", FormatFlags::Alpha | FormatFlags::VertexFormat },
94
95 // Depth buffer formats
96
97 { 2, { 1, 1, 1 }, 1, "D16_UNORM", "", FormatFlags::Depth },
98 { 3, { 1, 1, 1 }, 1, "D24_UNORM", "", FormatFlags::Depth },
99 { 4, { 1, 1, 1 }, 2, "D24S8_UNORM", "", FormatFlags::Depth },
100 { 4, { 1, 1, 1 }, 1, "D32_FLOAT", "", FormatFlags::Depth },
101 { 4, { 1, 1, 1 }, 1, "R32_TYPELESS", "", FormatFlags::Depth | FormatFlags::Typeless },
102 { 2, { 1, 1, 1 }, 1, "R16_TYPELESS", "", FormatFlags::Depth | FormatFlags::Typeless },
103
104 // 8 bit typeless formats
105
106 { 1, { 1, 1, 1 }, 1, "R8_TYPELESS", "", FormatFlags::Typeless },
107 { 2, { 1, 1, 1 }, 2, "R8G8_TYPELESS", "", FormatFlags::Typeless },
108 { 3, { 1, 1, 1 }, 3, "R8G8B8_TYPELESS", "", FormatFlags::Typeless },
109 { 4, { 1, 1, 1 }, 4, "R8G8B8A8_TYPELESS", "", FormatFlags::Typeless | FormatFlags::Typeless },
110
111 // Reverse component order formats.
112
113 { 3, { 1, 1, 1 }, 3, "B8G8R8", "", FormatFlags::None },
114 { 4, { 1, 1, 1 }, 4, "B8G8R8A8", "", FormatFlags::Alpha },
115
116 // Alpha formats
117
118 { 1, { 1, 1, 1 }, 1, "B8G8R8A8", "", FormatFlags::Alpha },
119
120 // Compressed formats
121
122 { 8, { 4, 4, 1 }, 4, "BC1_TYPELESS", "", FormatFlags::None },
123 { 8, { 4, 4, 1 }, 4, "BC1_UNORM", "", FormatFlags::None },
124 { 8, { 4, 4, 1 }, 4, "BC1_UNORM_SRGB", "", FormatFlags::None },
125 { 16, { 4, 4, 1 }, 4, "BC2_TYPELESS", "", FormatFlags::None },
126 { 16, { 4, 4, 1 }, 4, "BC2_UNORM", "", FormatFlags::None },
127 { 16, { 4, 4, 1 }, 4, "BC2_UNORM_SRGB", "", FormatFlags::None },
128 { 16, { 4, 4, 1 }, 4, "BC3_TYPELESS", "", FormatFlags::None },
129 { 16, { 4, 4, 1 }, 4, "BC3_UNORM", "", FormatFlags::None },
130 { 16, { 4, 4, 1 }, 4, "BC3_UNORM_SRGB", "", FormatFlags::None },
131 { 8, { 4, 4, 1 }, 4, "BC4_TYPELESS", "", FormatFlags::None },
132 { 8, { 4, 4, 1 }, 4, "BC4_UNORM", "", FormatFlags::None },
133 { 8, { 4, 4, 1 }, 4, "BC4_SNORM", "", FormatFlags::None },
134 { 16, { 4, 4, 1 }, 4, "BC5_TYPELESS", "", FormatFlags::None },
135 { 16, { 4, 4, 1 }, 4, "BC5_UNORM", "", FormatFlags::None },
136 { 16, { 4, 4, 1 }, 4, "BC5_SNORM", "", FormatFlags::None },
137
138 // BC7
139 { 16, { 4, 4, 1 }, 3, "BC6H_RGB_SIGNED_FLOAT", "", FormatFlags::None },
140 { 16, { 4, 4, 1 }, 3, "BC6H_RGB_UNSIGNED_FLOAT", "", FormatFlags::None },
141 { 16, { 4, 4, 1 }, 4, "BC7_RGBA_UNORM", "", FormatFlags::None },
142 { 16, { 4, 4, 1 }, 4, "BC7_SRGB_ALPHA_UNORM", "", FormatFlags::None },
143
144 //PVRTC
145 { 32, { 16, 8, 1 }, 3, "PVRTC_2BPPV1_UNORM_RGB", "", FormatFlags::None },
146 { 32, { 8, 8, 1 }, 3, "PVRTC_4BPPV1_UNORM_RGB", "", FormatFlags::None },
147 { 32, { 16, 8, 1 }, 4, "PVRTC_2BPPV1_UNORM_RGBA", "", FormatFlags::None },
148 { 32, { 8, 8, 1 }, 4, "PVRTC_4BPPV1_UNORM_RGBA", "", FormatFlags::None },
149
150 // ETC
151 { 8, { 4, 4, 1 }, 1, "EAC_BLOCK8_UNSIGNED_FLOAT_R", "", FormatFlags::None },
152 { 8, { 4, 4, 1 }, 1, "EAC_BLOCK8_SIGNED_FLOAT_R", "", FormatFlags::None },
153 { 16, { 4, 4, 1 }, 3, "EAC_BLOCK8_UNSIGNED_FLOAT_RG", "", FormatFlags::None },
154 { 16, { 4, 4, 1 }, 3, "EAC_BLOCK8_SIGNED_FLOAT_RG", "", FormatFlags::None },
155
156
157 { 8, { 4, 4, 1 }, 3, "ETC2_BLOCK8_UNORM_RGB", "", FormatFlags::None },
158 { 8, { 4, 4, 1 }, 3, "ETC2_BLOCK8_SRGB_RGB", "", FormatFlags::None },
159
160 { 16, { 4, 4, 1 }, 4, "ETC2_BLOCK16_UNORM_RGBA", "", FormatFlags::Alpha },
161 { 16, { 4, 4, 1 }, 4, "ETC2_BLOCK16_UNORM_SRGBA", "", FormatFlags::Alpha },
162
163 // ASTC
164 { 16, { 4, 4, 1 }, 4, "ASTC_4x4_UNORM_RGBA", "", FormatFlags::Alpha },
165 { 16, { 5, 4, 1 }, 4, "ASTC_5x4_UNORM_RGBA", "", FormatFlags::Alpha },
166 { 16, { 5, 5, 1 }, 4, "ASTC_5x5_UNORM_RGBA", "", FormatFlags::Alpha },
167 { 16, { 6, 5, 1 }, 4, "ASTC_6x5_UNORM_RGBA", "", FormatFlags::Alpha },
168 { 16, { 6, 6, 1 }, 4, "ASTC_6x6_UNORM_RGBA", "", FormatFlags::Alpha },
169 { 16, { 8, 5, 1 }, 4, "ASTC_8x5_UNORM_RGBA", "", FormatFlags::Alpha },
170 { 16, { 8, 6, 1 }, 4, "ASTC_8x6_UNORM_RGBA", "", FormatFlags::Alpha },
171 { 16, { 8, 8, 1 }, 4, "ASTC_8x8_UNORM_RGBA", "", FormatFlags::Alpha },
172 { 16, { 10, 5, 1 }, 4, "ASTC_10x5_UNORM_RGBA", "", FormatFlags::Alpha },
173 { 16, { 10, 6, 1 }, 4, "ASTC_10x6_UNORM_RGBA", "", FormatFlags::Alpha },
174 { 16, { 10, 8, 1 }, 4, "ASTC_10x8_UNORM_RGBA", "", FormatFlags::Alpha },
175 { 16, { 10, 10, 1 }, 4, "ASTC_10x10_UNORM_RGBA", "", FormatFlags::Alpha },
176 { 16, { 12, 10, 1 }, 4, "ASTC_12x10_UNORM_RGBA", "", FormatFlags::Alpha },
177 { 16, { 12, 12, 1 }, 4, "ASTC_12x12_UNORM_RGBA", "", FormatFlags::Alpha },
178 // ASTC SRGBA
179 { 16, { 4, 4, 1 }, 4, "ASTC_4x4_SRGB_RGBA", "", FormatFlags::Alpha },
180 { 16, { 5, 4, 1 }, 4, "ASTC_5x4_SRGB_RGBA", "", FormatFlags::Alpha },
181 { 16, { 5, 5, 1 }, 4, "ASTC_5x5_SRGB_RGBA", "", FormatFlags::Alpha },
182 { 16, { 6, 5, 1 }, 4, "ASTC_6x5_SRGB_RGBA", "", FormatFlags::Alpha },
183 { 16, { 6, 6, 1 }, 4, "ASTC_6x6_SRGB_RGBA", "", FormatFlags::Alpha },
184 { 16, { 8, 5, 1 }, 4, "ASTC_8x5_SRGB_RGBA", "", FormatFlags::Alpha },
185 { 16, { 8, 6, 1 }, 4, "ASTC_8x6_SRGB_RGBA", "", FormatFlags::Alpha },
186 { 16, { 8, 8, 1 }, 4, "ASTC_8x8_SRGB_RGBA", "", FormatFlags::Alpha },
187 { 16, { 10, 5, 1 }, 4, "ASTC_10x5_SRGB_RGBA", "", FormatFlags::Alpha },
188 { 16, { 10, 6, 1 }, 4, "ASTC_10x6_SRGB_RGBA", "", FormatFlags::Alpha },
189 { 16, { 10, 8, 1 }, 4, "ASTC_10x8_SRGB_RGBA", "", FormatFlags::Alpha },
190 { 16, { 10, 10, 1 }, 4, "ASTC_10x10_SRGB_RGBA", "", FormatFlags::Alpha },
191 { 16, { 12, 10, 1 }, 4, "ASTC_12x10_SRGB_RGBA", "", FormatFlags::Alpha },
192 { 16, { 12, 12, 1 }, 4, "ASTC_12x12_SRGB_RGBA", "", FormatFlags::Alpha },
193
194 // SRGB formats
195 { 3,{ 1, 1, 1 }, 3, "R8G8B8_UNORM_SRGB", "", FormatFlags::None },
196 { 4,{ 1, 1, 1 }, 4, "R8G8B8A8_UNORM_SRGB", "", FormatFlags::None },
197
198 // Specialized formats
199
200 { 4, { 1, 1, 1 }, 4, "R10G10B10A2_TYPELESS", "X10Y10Z10W2_TYPELESS", FormatFlags::VertexFormat },
201 { 4, { 1, 1, 1 }, 4, "R10G10B10A2_UNORM", "X10Y10Z10W2_UNORM", FormatFlags::VertexFormat },
202 { 4, { 1, 1, 1 }, 4, "R10G10B10A2_UINT", "X10Y10Z10W2_UINT", FormatFlags::VertexFormat | FormatFlags::Unsigned },
203 { 4, { 1, 1, 1 }, 4, "R11G11B10_FLOAT", "", FormatFlags::None },
204 { 4, { 1, 1, 1 }, 4, "R5G6B5_UNORM", "", FormatFlags::None },
205 { 4, { 1, 1, 1 }, 4, "R5G5B5A1_UNORM", "", FormatFlags::None },
206 { 4, { 1, 1, 1 }, 4, "R4G4B4A4_UNORM", "", FormatFlags::None },
207 { 4, { 1, 1, 1 }, 4, "R9G9B9E5_FLOAT", "", FormatFlags::None },
208
209 // Matrix formats
210
211 { 64, { 1, 1, 1 }, 16, "MAT4X4_FLOAT", "MAT4X4_FLOAT", FormatFlags::VertexFormat },
212 };
213
214 static_assert(sizeof(formatInfo) / sizeof(FormatInfo) == (size_t)Format::Format_Size, "Formats has wrong number of elements.");
215
216}
217
218const Cogs::FormatInfo* Cogs::getFormatInfo(Format format)
219{
220 return &formatInfo[(int)format];
221}
222
223Cogs::DataFormat Cogs::parseDataFormat(const StringView& format)
224{
225 const size_t code = Cogs::hash(format);
226
227 switch (code)
228 {
229 case Cogs::hash("R8_UNORM"): return DataFormat::R8_UNORM;
230 case Cogs::hash("R8G8_UNORM"): return DataFormat::R8G8_UNORM;
231 case Cogs::hash("R8G8B8_UNORM"): return DataFormat::R8G8B8_UNORM;
232 case Cogs::hash("R8G8B8A8_UNORM"): return DataFormat::R8G8B8A8_UNORM;
233
234 case Cogs::hash("R16_UNORM"): return DataFormat::R16_UNORM;
235 case Cogs::hash("R16G16_UNORM"): return DataFormat::R16G16_UNORM;
236 case Cogs::hash("R16G16B16_UNORM"): return DataFormat::R16G16B16_UNORM;
237 case Cogs::hash("R16G16B16A16_UNORM"): return DataFormat::R16G16B16A16_UNORM;
238
239 case Cogs::hash("R8_SNORM"): return DataFormat::R8_SNORM;
240 case Cogs::hash("R8G8_SNORM"): return DataFormat::R8G8_SNORM;
241 case Cogs::hash("R8G8B8_SNORM"): return DataFormat::R8G8B8_SNORM;
242 case Cogs::hash("R8G8B8A8_SNORM"): return DataFormat::R8G8B8A8_SNORM;
243
244 case Cogs::hash("R16_SNORM"): return DataFormat::R16_SNORM;
245 case Cogs::hash("R16G16_SNORM"): return DataFormat::R16G16_SNORM;
246 case Cogs::hash("R16G16B16_SNORM"): return DataFormat::R16G16B16_SNORM;
247 case Cogs::hash("R16G16B16A16_SNORM"): return DataFormat::R16G16B16A16_SNORM;
248
249 case Cogs::hash("R8_UINT"): return DataFormat::R8_UINT;
250 case Cogs::hash("R8G8_UINT"): return DataFormat::R8G8_UINT;
251 case Cogs::hash("R8G8B8_UINT"): return DataFormat::R8G8B8_UINT;
252 case Cogs::hash("R8G8B8A8_UINT"): return DataFormat::R8G8B8A8_UINT;
253
254 case Cogs::hash("R16_UINT"): return DataFormat::R16_UINT;
255 case Cogs::hash("R16G16_UINT"): return DataFormat::R16G16_UINT;
256 case Cogs::hash("R16G16B16_UINT"): return DataFormat::R16G16B16_UINT;
257 case Cogs::hash("R16G16B16A16_UINT"): return DataFormat::R16G16B16A16_UINT;
258
259 case Cogs::hash("R32_UINT"): return DataFormat::R32_UINT;
260 case Cogs::hash("R32G32_UINT"): return DataFormat::R32G32_UINT;
261 case Cogs::hash("R32G32B32_UINT"): return DataFormat::R32G32B32_UINT;
262 case Cogs::hash("R32G32B32A32_UINT"): return DataFormat::R32G32B32A32_UINT;
263
264 case Cogs::hash("R8_SINT"): return DataFormat::R8_SINT;
265 case Cogs::hash("R8G8_SINT"): return DataFormat::R8G8_SINT;
266 case Cogs::hash("R8G8B8_SINT"): return DataFormat::R8G8B8_SINT;
267 case Cogs::hash("R8G8B8A8_SINT"): return DataFormat::R8G8B8A8_SINT;
268
269 case Cogs::hash("R16_SINT"): return DataFormat::R16_SINT;
270 case Cogs::hash("R16G16_SINT"): return DataFormat::R16G16_SINT;
271 case Cogs::hash("R16G16B16_SINT"): return DataFormat::R16G16B16_SINT;
272 case Cogs::hash("R16G16B16A16_SINT"): return DataFormat::R16G16B16A16_SINT;
273
274 case Cogs::hash("R32_SINT"): return DataFormat::R32_SINT;
275 case Cogs::hash("R32G32_SINT"): return DataFormat::R32G32_SINT;
276 case Cogs::hash("R32G32B32_SINT"): return DataFormat::R32G32B32_SINT;
277 case Cogs::hash("R32G32B32A32_SINT"): return DataFormat::R32G32B32A32_SINT;
278
279 case Cogs::hash("R16_FLOAT"): return DataFormat::R16_FLOAT;
280 case Cogs::hash("R16G16_FLOAT"): return DataFormat::R16G16_FLOAT;
281 case Cogs::hash("R16G16B16_FLOAT"): return DataFormat::R16G16B16_FLOAT;
282 case Cogs::hash("R16G16B16A16_FLOAT"): return DataFormat::R16G16B16A16_FLOAT;
283
284 case Cogs::hash("R32_FLOAT"): return DataFormat::R32_FLOAT;
285 case Cogs::hash("R32G32_FLOAT"): return DataFormat::R32G32_FLOAT;
286 case Cogs::hash("R32G32B32_FLOAT"): return DataFormat::R32G32B32_FLOAT;
287 case Cogs::hash("R32G32B32A32_FLOAT"): return DataFormat::R32G32B32A32_FLOAT;
288
289 case Cogs::hash("D16_UNORM"): return DataFormat::D16_UNORM;
290 case Cogs::hash("D24_UNORM"): return DataFormat::D24_UNORM;
291 case Cogs::hash("D24S8_UNORM"): return DataFormat::D24S8_UNORM;
292 case Cogs::hash("D32_FLOAT"): return DataFormat::D32_FLOAT;
293 case Cogs::hash("R32_TYPELESS"): return DataFormat::R32_TYPELESS;
294 case Cogs::hash("R16_TYPELESS"): return DataFormat::R16_TYPELESS;
295
296 case Cogs::hash("R8T"): return DataFormat::R8T;
297 case Cogs::hash("R8G8T"): return DataFormat::R8G8T;
298 case Cogs::hash("R8G8B8T"): return DataFormat::R8G8B8T;
299 case Cogs::hash("R8G8B8A8T"): return DataFormat::R8G8B8A8T;
300
301 case Cogs::hash("B8G8R8"): return DataFormat::B8G8R8;
302 case Cogs::hash("B8G8R8A8"): return DataFormat::B8G8R8A8;
303
304 case Cogs::hash("A8_UNORM"): return DataFormat::A8_UNORM;
305
306 case Cogs::hash("BC1_TYPELESS"): return DataFormat::BC1_TYPELESS;
307 case Cogs::hash("BC1_UNORM"): return DataFormat::BC1_UNORM;
308 case Cogs::hash("BC1_UNORM_SRGB"): return DataFormat::BC1_UNORM_SRGB;
309 case Cogs::hash("BC2_TYPELESS"): return DataFormat::BC2_TYPELESS;
310 case Cogs::hash("BC2_UNORM"): return DataFormat::BC2_UNORM;
311 case Cogs::hash("BC2_UNORM_SRGB"): return DataFormat::BC2_UNORM_SRGB;
312 case Cogs::hash("BC3_TYPELESS"): return DataFormat::BC3_TYPELESS;
313 case Cogs::hash("BC3_UNORM"): return DataFormat::BC3_UNORM;
314 case Cogs::hash("BC3_UNORM_SRGB"): return DataFormat::BC3_UNORM_SRGB;
315 case Cogs::hash("BC4_TYPELESS"): return DataFormat::BC4_TYPELESS;
316 case Cogs::hash("BC4_UNORM"): return DataFormat::BC4_UNORM;
317 case Cogs::hash("BC4_SNORM"): return DataFormat::BC4_SNORM;
318 case Cogs::hash("BC5_TYPELESS"): return DataFormat::BC5_TYPELESS;
319 case Cogs::hash("BC5_UNORM"): return DataFormat::BC5_UNORM;
320 case Cogs::hash("BC5_SNORM"): return DataFormat::BC5_SNORM;
321
322 case Cogs::hash("R8G8B8_UNORM_SRGB"): return DataFormat::R8G8B8_UNORM_SRGB;
323 case Cogs::hash("R8G8B8A8_UNORM_SRGB"): return DataFormat::R8G8B8A8_UNORM_SRGB;
324
325 case Cogs::hash("R10G10B10A2_TYPELESS"): return DataFormat::R10G10B10A2_TYPELESS;
326 case Cogs::hash("R10G10B10A2_UNORM"): return DataFormat::R10G10B10A2_UNORM;
327 case Cogs::hash("R10G10B10A2_UINT"): return DataFormat::R10G10B10A2_UINT;
328 case Cogs::hash("R11G11B10_FLOAT"): return DataFormat::R11G11B10_FLOAT;
329 case Cogs::hash("R5G6B5_UNORM"): return DataFormat::R5G6B5_UNORM;
330 case Cogs::hash("R5G5B5A1_UNORM"): return DataFormat::R5G5B5A1_UNORM;
331 case Cogs::hash("R4G4B4A4_UNORM"): return DataFormat::R4G4B4A4_UNORM;
332 case Cogs::hash("R9G9B9E5_FLOAT"): return DataFormat::R9G9B9E5_FLOAT;
333
334 case Cogs::hash("MAT4X4_FLOAT"): return DataFormat::R10G10B10A2_UINT;
335
336 case Cogs::hash("X16_FLOAT"): return DataFormat::R16_FLOAT;
337 case Cogs::hash("X16G16_FLOAT"): return DataFormat::R16G16_FLOAT;
338 case Cogs::hash("X16Y16Z16_FLOAT"): return DataFormat::R16G16B16_FLOAT;
339 case Cogs::hash("X16Y16Z16W16_FLOAT"): return DataFormat::R16G16B16A16_FLOAT;
340
341 case Cogs::hash("X32_FLOAT"): return DataFormat::R32_FLOAT;
342 case Cogs::hash("X32G32_FLOAT"): return DataFormat::R32G32_FLOAT;
343 case Cogs::hash("X32Y32Z32_FLOAT"): return DataFormat::R32G32B32_FLOAT;
344 case Cogs::hash("X32Y32Z32W32_FLOAT"): return DataFormat::R32G32B32A32_FLOAT;
345
346 default:
347 return DataFormat::Unknown;
348 }
349}
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
constexpr size_t hash() noexcept
Simple getter function that returns the initial value for fnv1a hashing.
Definition: HashFunctions.h:62