LiteFX 0.4.1.2025
Computer Graphics Engine
Loading...
Searching...
No Matches
rendering_formatters.hpp
1#pragma once
2
3#include "rendering_api.hpp"
4
5using namespace LiteFX::Rendering;
6
7template <>
8struct LITEFX_RENDERING_API std::formatter<GraphicsAdapterType> : std::formatter<std::string_view> {
9 auto format(GraphicsAdapterType t, std::format_context& ctx) const {
10 string_view name = "Invalid";
11 switch (t) {
12 using enum GraphicsAdapterType;
13 case CPU: name = "CPU"; break;
14 case GPU: name = "GPU"; break;
15 case Other: name = "Other"; break;
16 case None: name = "None"; break;
17 }
18 return formatter<string_view>::format(name, ctx);
19 }
20};
21
22template <>
23struct LITEFX_RENDERING_API std::formatter<QueueType> : std::formatter<std::string_view> {
24 auto format(QueueType t, std::format_context& ctx) const {
25 Array<String> names;
26
27 if (t == QueueType::None)
28 names.emplace_back("None");
29 else if(LITEFX_FLAG_IS_SET(t, QueueType::Other))
30 names.emplace_back("Other");
31 else
32 {
33 if ((t & QueueType::Compute) == QueueType::Compute)
34 names.emplace_back("Compute");
35 if ((t & QueueType::Graphics) == QueueType::Graphics)
36 names.emplace_back("Graphics");
37 if ((t & QueueType::Transfer) == QueueType::Transfer)
38 names.emplace_back("Transfer");
39 }
40
41 String name = Join(names, " | ");
42 return formatter<string_view>::format(name, ctx);
43 }
44};
45
46template <>
47struct LITEFX_RENDERING_API std::formatter<QueuePriority> : std::formatter<std::string_view> {
48 auto format(QueuePriority t, std::format_context& ctx) const {
49 String name;
50
51 switch (t) {
52 using enum QueuePriority;
53 default:
54 case Normal: name = "Normal"; break;
55 case High: name = "High"; break;
56 case Realtime: name = "Realtime"; break;
57 }
58
59 return formatter<string_view>::format(name, ctx);
60 }
61};
62
63template <>
64struct LITEFX_RENDERING_API std::formatter<Format> : std::formatter<std::string_view> {
65 auto format(Format t, std::format_context& ctx) const {
66 string_view name = "Invalid";
67 switch (t) {
68 using enum Format;
69 case R4G4_UNORM: name = "R4G4_UNORM"; break;
70 case R4G4B4A4_UNORM: name = "R4G4B4A4_UNORM"; break;
71 case B4G4R4A4_UNORM: name = "B4G4R4A4_UNORM"; break;
72 case R5G6B5_UNORM: name = "R5G6B5_UNORM"; break;
73 case B5G6R5_UNORM: name = "B5G6R5_UNORM"; break;
74 case R5G5B5A1_UNORM: name = "R5G5B5A1_UNORM"; break;
75 case B5G5R5A1_UNORM: name = "B5G5R5A1_UNORM"; break;
76 case A1R5G5B5_UNORM: name = "A1R5G5B5_UNORM"; break;
77 case R8_UNORM: name = "R8_UNORM"; break;
78 case R8_SNORM: name = "R8_SNORM"; break;
79 case R8_USCALED: name = "R8_USCALED"; break;
80 case R8_SSCALED: name = "R8_SSCALED"; break;
81 case R8_UINT: name = "R8_UINT"; break;
82 case R8_SINT: name = "R8_SINT"; break;
83 case R8_SRGB: name = "R8_SRGB"; break;
84 case R8G8_UNORM: name = "R8G8_UNORM"; break;
85 case R8G8_SNORM: name = "R8G8_SNORM"; break;
86 case R8G8_USCALED: name = "R8G8_USCALED"; break;
87 case R8G8_SSCALED: name = "R8G8_SSCALED"; break;
88 case R8G8_UINT: name = "R8G8_UINT"; break;
89 case R8G8_SINT: name = "R8G8_SINT"; break;
90 case R8G8_SRGB: name = "R8G8_SRGB"; break;
91 case R8G8B8_UNORM: name = "R8G8B8_UNORM"; break;
92 case R8G8B8_SNORM: name = "R8G8B8_SNORM"; break;
93 case R8G8B8_USCALED: name = "R8G8B8_USCALED"; break;
94 case R8G8B8_SSCALED: name = "R8G8B8_SSCALED"; break;
95 case R8G8B8_UINT: name = "R8G8B8_UINT"; break;
96 case R8G8B8_SINT: name = "R8G8B8_SINT"; break;
97 case R8G8B8_SRGB: name = "R8G8B8_SRGB"; break;
98 case B8G8R8_UNORM: name = "B8G8R8_UNORM"; break;
99 case B8G8R8_SNORM: name = "B8G8R8_SNORM"; break;
100 case B8G8R8_USCALED: name = "B8G8R8_USCALED"; break;
101 case B8G8R8_SSCALED: name = "B8G8R8_SSCALED"; break;
102 case B8G8R8_UINT: name = "B8G8R8_UINT"; break;
103 case B8G8R8_SINT: name = "B8G8R8_SINT"; break;
104 case B8G8R8_SRGB: name = "B8G8R8_SRGB"; break;
105 case R8G8B8A8_UNORM: name = "R8G8B8A8_UNORM"; break;
106 case R8G8B8A8_SNORM: name = "R8G8B8A8_SNORM"; break;
107 case R8G8B8A8_USCALED: name = "R8G8B8A8_USCALED"; break;
108 case R8G8B8A8_SSCALED: name = "R8G8B8A8_SSCALED"; break;
109 case R8G8B8A8_UINT: name = "R8G8B8A8_UINT"; break;
110 case R8G8B8A8_SINT: name = "R8G8B8A8_SINT"; break;
111 case R8G8B8A8_SRGB: name = "R8G8B8A8_SRGB"; break;
112 case B8G8R8A8_UNORM: name = "B8G8R8A8_UNORM"; break;
113 case B8G8R8A8_SNORM: name = "B8G8R8A8_SNORM"; break;
114 case B8G8R8A8_USCALED: name = "B8G8R8A8_USCALED"; break;
115 case B8G8R8A8_SSCALED: name = "B8G8R8A8_SSCALED"; break;
116 case B8G8R8A8_UINT: name = "B8G8R8A8_UINT"; break;
117 case B8G8R8A8_SINT: name = "B8G8R8A8_SINT"; break;
118 case B8G8R8A8_SRGB: name = "B8G8R8A8_SRGB"; break;
119 case A8B8G8R8_UNORM: name = "A8B8G8R8_UNORM"; break;
120 case A8B8G8R8_SNORM: name = "A8B8G8R8_SNORM"; break;
121 case A8B8G8R8_USCALED: name = "A8B8G8R8_USCALED"; break;
122 case A8B8G8R8_SSCALED: name = "A8B8G8R8_SSCALED"; break;
123 case A8B8G8R8_UINT: name = "A8B8G8R8_UINT"; break;
124 case A8B8G8R8_SINT: name = "A8B8G8R8_SINT"; break;
125 case A8B8G8R8_SRGB: name = "A8B8G8R8_SRGB"; break;
126 case A2R10G10B10_UNORM: name = "A2R10G10B10_UNORM"; break;
127 case A2R10G10B10_SNORM: name = "A2R10G10B10_SNORM"; break;
128 case A2R10G10B10_USCALED: name = "A2R10G10B10_USCALED"; break;
129 case A2R10G10B10_SSCALED: name = "A2R10G10B10_SSCALED"; break;
130 case A2R10G10B10_UINT: name = "A2R10G10B10_UINT"; break;
131 case A2R10G10B10_SINT: name = "A2R10G10B10_SINT"; break;
132 case A2B10G10R10_UNORM: name = "A2B10G10R10_UNORM"; break;
133 case A2B10G10R10_SNORM: name = "A2B10G10R10_SNORM"; break;
134 case A2B10G10R10_USCALED: name = "A2B10G10R10_USCALED"; break;
135 case A2B10G10R10_SSCALED: name = "A2B10G10R10_SSCALED"; break;
136 case A2B10G10R10_UINT: name = "A2B10G10R10_UINT"; break;
137 case A2B10G10R10_SINT: name = "A2B10G10R10_SINT"; break;
138 case R16_UNORM: name = "R16_UNORM"; break;
139 case R16_SNORM: name = "R16_SNORM"; break;
140 case R16_USCALED: name = "R16_USCALED"; break;
141 case R16_SSCALED: name = "R16_SSCALED"; break;
142 case R16_UINT: name = "R16_UINT"; break;
143 case R16_SINT: name = "R16_SINT"; break;
144 case R16_SFLOAT: name = "R16_SFLOAT"; break;
145 case R16G16_UNORM: name = "R16G16_UNORM"; break;
146 case R16G16_SNORM: name = "R16G16_SNORM"; break;
147 case R16G16_USCALED: name = "R16G16_USCALED"; break;
148 case R16G16_SSCALED: name = "R16G16_SSCALED"; break;
149 case R16G16_UINT: name = "R16G16_UINT"; break;
150 case R16G16_SINT: name = "R16G16_SINT"; break;
151 case R16G16_SFLOAT: name = "R16G16_SFLOAT"; break;
152 case R16G16B16_UNORM: name = "R16G16B16_UNORM"; break;
153 case R16G16B16_SNORM: name = "R16G16B16_SNORM"; break;
154 case R16G16B16_USCALED: name = "R16G16B16_USCALED"; break;
155 case R16G16B16_SSCALED: name = "R16G16B16_SSCALED"; break;
156 case R16G16B16_UINT: name = "R16G16B16_UINT"; break;
157 case R16G16B16_SINT: name = "R16G16B16_SINT"; break;
158 case R16G16B16_SFLOAT: name = "R16G16B16_SFLOAT"; break;
159 case R16G16B16A16_UNORM: name = "R16G16B16A16_UNORM"; break;
160 case R16G16B16A16_SNORM: name = "R16G16B16A16_SNORM"; break;
161 case R16G16B16A16_USCALED: name = "R16G16B16A16_USCALED"; break;
162 case R16G16B16A16_SSCALED: name = "R16G16B16A16_SSCALED"; break;
163 case R16G16B16A16_UINT: name = "R16G16B16A16_UINT"; break;
164 case R16G16B16A16_SINT: name = "R16G16B16A16_SINT"; break;
165 case R16G16B16A16_SFLOAT: name = "R16G16B16A16_SFLOAT"; break;
166 case R32_UINT: name = "R32_UINT"; break;
167 case R32_SINT: name = "R32_SINT"; break;
168 case R32_SFLOAT: name = "R32_SFLOAT"; break;
169 case R32G32_UINT: name = "R32G32_UINT"; break;
170 case R32G32_SINT: name = "R32G32_SINT"; break;
171 case R32G32_SFLOAT: name = "R32G32_SFLOAT"; break;
172 case R32G32B32_UINT: name = "R32G32B32_UINT"; break;
173 case R32G32B32_SINT: name = "R32G32B32_SINT"; break;
174 case R32G32B32_SFLOAT: name = "R32G32B32_SFLOAT"; break;
175 case R32G32B32A32_UINT: name = "R32G32B32A32_UINT"; break;
176 case R32G32B32A32_SINT: name = "R32G32B32A32_SINT"; break;
177 case R32G32B32A32_SFLOAT: name = "R32G32B32A32_SFLOAT"; break;
178 case R64_UINT: name = "R64_UINT"; break;
179 case R64_SINT: name = "R64_SINT"; break;
180 case R64_SFLOAT: name = "R64_SFLOAT"; break;
181 case R64G64_UINT: name = "R64G64_UINT"; break;
182 case R64G64_SINT: name = "R64G64_SINT"; break;
183 case R64G64_SFLOAT: name = "R64G64_SFLOAT"; break;
184 case R64G64B64_UINT: name = "R64G64B64_UINT"; break;
185 case R64G64B64_SINT: name = "R64G64B64_SINT"; break;
186 case R64G64B64_SFLOAT: name = "R64G64B64_SFLOAT"; break;
187 case R64G64B64A64_UINT: name = "R64G64B64A64_UINT"; break;
188 case R64G64B64A64_SINT: name = "R64G64B64A64_SINT"; break;
189 case R64G64B64A64_SFLOAT: name = "R64G64B64A64_SFLOAT"; break;
190 case B10G11R11_UFLOAT: name = "B10G11R11_UFLOAT"; break;
191 case E5B9G9R9_UFLOAT: name = "E5B9G9R9_UFLOAT"; break;
192 case D16_UNORM: name = "D16_UNORM"; break;
193 case X8_D24_UNORM: name = "X8_D24_UNORM"; break;
194 case D32_SFLOAT: name = "D32_SFLOAT"; break;
195 case S8_UINT: name = "S8_UINT"; break;
196 case D16_UNORM_S8_UINT: name = "D16_UNORM_S8_UINT"; break;
197 case D24_UNORM_S8_UINT: name = "D24_UNORM_S8_UINT"; break;
198 case D32_SFLOAT_S8_UINT: name = "D32_SFLOAT_S8_UINT"; break;
199 case BC1_RGB_UNORM: name = "BC1_RGB_UNORM"; break;
200 case BC1_RGB_SRGB: name = "BC1_RGB_SRGB"; break;
201 case BC1_RGBA_UNORM: name = "BC1_RGBA_UNORM"; break;
202 case BC1_RGBA_SRGB: name = "BC1_RGBA_SRGB"; break;
203 case BC2_UNORM: name = "BC2_UNORM"; break;
204 case BC2_SRGB: name = "BC2_SRGB"; break;
205 case BC3_UNORM: name = "BC3_UNORM"; break;
206 case BC3_SRGB: name = "BC3_SRGB"; break;
207 case BC4_UNORM: name = "BC4_UNORM"; break;
208 case BC4_SNORM: name = "BC4_SNORM"; break;
209 case BC5_UNORM: name = "BC5_UNORM"; break;
210 case BC5_SNORM: name = "BC5_SNORM"; break;
211 case BC6H_UFLOAT: name = "BC6H_UFLOAT"; break;
212 case BC6H_SFLOAT: name = "BC6H_SFLOAT"; break;
213 case BC7_UNORM: name = "BC7_UNORM"; break;
214 case BC7_SRGB: name = "BC7_SRGB"; break;
215 case None: name = "None"; break;
216 case Other: name = "Other"; break;
217 }
218 return formatter<string_view>::format(name, ctx);
219 }
220};
221
222template <>
223struct LITEFX_RENDERING_API std::formatter<DescriptorType> : std::formatter<std::string_view> {
224 auto format(DescriptorType t, std::format_context& ctx) const {
225 string_view name = "Invalid";
226 switch (t) {
227 using enum DescriptorType;
228 case Sampler: name = "Sampler"; break;
229 case ConstantBuffer: name = "ContantBuffer"; break;
230 case StructuredBuffer: name = "StructuredBuffer"; break;
231 case RWStructuredBuffer: name = "RWStructuredBuffer"; break;
232 case Texture: name = "Texture"; break;
233 case RWTexture: name = "RWTexture"; break;
234 case Buffer: name = "Buffer"; break;
235 case RWBuffer: name = "RWBuffer"; break;
236 case ByteAddressBuffer: name = "ByteAddressBuffer"; break;
237 case RWByteAddressBuffer: name = "RWByteAddressBuffer"; break;
238 case InputAttachment: name = "Input Attachment"; break;
239 case AccelerationStructure: name = "Acceleration Structure"; break;
240 }
241 return formatter<string_view>::format(name, ctx);
242 }
243};
244
245template <>
246struct LITEFX_RENDERING_API std::formatter<BufferType> : std::formatter<std::string_view> {
247 auto format(BufferType t, std::format_context& ctx) const {
248 string_view name = "Invalid";
249 switch (t) {
250 using enum BufferType;
251 case Index: name = "Index"; break;
252 case Vertex: name = "Vertex"; break;
253 case Uniform: name = "Uniform"; break;
254 case Storage: name = "Storage"; break;
255 case Texel: name = "Texel"; break;
256 case AccelerationStructure: name = "Acceleration Structure"; break;
257 case ShaderBindingTable: name = "Shader Binding Table"; break;
258 case Indirect: name = "Indirect"; break;
259 case Other: name = "Other"; break;
260 }
261 return formatter<string_view>::format(name, ctx);
262 }
263};
264
265template <>
266struct LITEFX_RENDERING_API std::formatter<ResourceUsage> : std::formatter<std::string_view> {
267 auto format(ResourceUsage t, std::format_context& ctx) const {
268 Array<String> names;
269
270 if (t == ResourceUsage::None)
271 names.emplace_back("None");
272 else if (t == ResourceUsage::Default)
273 names.emplace_back("Default");
274 else
275 {
276 if ((t & ResourceUsage::AllowWrite) == ResourceUsage::AllowWrite)
277 names.emplace_back("AllowWrite");
278 if ((t & ResourceUsage::TransferSource) == ResourceUsage::TransferSource)
279 names.emplace_back("TransferSource");
280 if ((t & ResourceUsage::TransferDestination) == ResourceUsage::TransferDestination)
281 names.emplace_back("TransferDestination");
282 if ((t & ResourceUsage::AccelerationStructureBuildInput) == ResourceUsage::AccelerationStructureBuildInput)
283 names.emplace_back("AccelerationStructureBuildInput");
284 }
285
286 String name = Join(names, " | ");
287 return formatter<string_view>::format(name, ctx);
288 }
289};
290
291template <>
292struct LITEFX_RENDERING_API std::formatter<ResourceHeap> : std::formatter<std::string_view> {
293 auto format(ResourceHeap t, std::format_context& ctx) const {
294 string_view name = "Invalid";
295 switch (t) {
296 using enum ResourceHeap;
297 case Staging: name = "Staging"; break;
298 case Resource: name = "Resource"; break;
299 case Dynamic: name = "Dynamic"; break;
300 case Readback: name = "Readback"; break;
301 }
302 return formatter<string_view>::format(name, ctx);
303 }
304};
305
306template <>
307struct LITEFX_RENDERING_API std::formatter<IndexType> : std::formatter<std::string_view> {
308 auto format(IndexType t, std::format_context& ctx) const {
309 string_view name = "Invalid";
310 switch (t) {
311 using enum IndexType;
312 case UInt16: name = "UInt16"; break;
313 case UInt32: name = "UInt32"; break;
314 }
315 return formatter<string_view>::format(name, ctx);
316 }
317};
318
319template <>
320struct LITEFX_RENDERING_API std::formatter<LiteFX::Rendering::PrimitiveTopology> : std::formatter<std::string_view> {
321 auto format(LiteFX::Rendering::PrimitiveTopology t, std::format_context& ctx) const {
322 string_view name = "Invalid";
323 switch (t) {
324 using enum PrimitiveTopology;
325 case PointList: name = "PointList"; break;
326 case LineList: name = "LineList"; break;
327 case TriangleList: name = "TriangleList"; break;
328 case LineStrip: name = "LineStrip"; break;
329 case TriangleStrip: name = "TriangleStrip"; break;
330 }
331 return formatter<string_view>::format(name, ctx);
332 }
333};
334
335template <>
336struct LITEFX_RENDERING_API std::formatter<ShaderStage> : std::formatter<std::string_view> {
337 auto format(ShaderStage t, std::format_context& ctx) const {
338 Array<String> names;
339
340 if (t == ShaderStage::Other)
341 names.emplace_back("Other");
342 else if (t == ShaderStage::MeshPipeline)
343 names.emplace_back("Mesh Shading");
344 if (t == ShaderStage::RayTracingPipeline)
345 names.emplace_back("Ray Tracing");
346 else
347 {
348 if ((t & ShaderStage::Vertex) == ShaderStage::Vertex)
349 names.emplace_back("Vertex");
350 if ((t & ShaderStage::TessellationControl) == ShaderStage::TessellationControl)
351 names.emplace_back("Tessellation Control");
352 if ((t & ShaderStage::TessellationEvaluation) == ShaderStage::TessellationEvaluation)
353 names.emplace_back("Tessellation Evaluation");
354 if ((t & ShaderStage::Geometry) == ShaderStage::Geometry)
355 names.emplace_back("Geometry");
356 if ((t & ShaderStage::Fragment) == ShaderStage::Fragment)
357 names.emplace_back("Fragment");
358 if ((t & ShaderStage::Compute) == ShaderStage::Compute)
359 names.emplace_back("Compute");
360 if ((t & ShaderStage::Mesh) == ShaderStage::Mesh)
361 names.emplace_back("Mesh");
362 if ((t & ShaderStage::Task) == ShaderStage::Task)
363 names.emplace_back("Task");
364 if ((t & ShaderStage::RayGeneration) == ShaderStage::RayGeneration)
365 names.emplace_back("Ray Generation");
366 if ((t & ShaderStage::AnyHit) == ShaderStage::AnyHit)
367 names.emplace_back("Any Hit");
368 if ((t & ShaderStage::ClosestHit) == ShaderStage::ClosestHit)
369 names.emplace_back("Closest Hit");
370 if ((t & ShaderStage::Intersection) == ShaderStage::Intersection)
371 names.emplace_back("Intersection");
372 if ((t & ShaderStage::Miss) == ShaderStage::Miss)
373 names.emplace_back("Miss");
374 if ((t & ShaderStage::Callable) == ShaderStage::Callable)
375 names.emplace_back("Callable");
376 }
377
378 String name = Join(names, " | ");
379 return formatter<string_view>::format(name, ctx);
380 }
381};
382
383template <>
384struct LITEFX_RENDERING_API std::formatter<BufferFormat> : std::formatter<std::string_view> {
385 auto format(BufferFormat t, std::format_context& ctx) const {
386 Array<String> names;
387
388 // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
389 switch (::getBufferFormatChannels(t))
390 {
391 case 1:
392 names.emplace_back("X");
393 break;
394 case 2:
395 names.emplace_back("XY");
396 break;
397 case 3:
398 names.emplace_back("XYZ");
399 break;
400 case 4:
401 names.emplace_back("XYZW");
402 break;
403 default:
404 return formatter<string_view>::format("Invalid", ctx);
405 }
406
408 {
409 case 8:
410 names.emplace_back("8");
411 break;
412 case 16:
413 names.emplace_back("16");
414 break;
415 case 32:
416 names.emplace_back("32");
417 break;
418 case 64:
419 names.emplace_back("64");
420 break;
421 default:
422 return formatter<string_view>::format("Invalid", ctx);
423 }
424
425 switch (::getBufferFormatType(t))
426 {
427 case 0x01:
428 names.emplace_back("F");
429 break;
430 case 0x02:
431 names.emplace_back("I");
432 break;
433 case 0x04:
434 names.emplace_back("S");
435 break;
436 default:
437 return formatter<string_view>::format("Invalid", ctx);
438 }
439 // NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
440
441 String name = Join(names);
442 return formatter<string_view>::format(name, ctx);
443 }
444};
445
446template <>
447struct LITEFX_RENDERING_API std::formatter<PolygonMode> : std::formatter<std::string_view> {
448 auto format(PolygonMode t, std::format_context& ctx) const {
449 string_view name;
450
451 switch (t) {
452 using enum PolygonMode;
453 case Solid: name = "Solid"; break;
454 case Wireframe: name = "Wireframe"; break;
455 case Point: name = "Point"; break;
456 default: name = "Invalid"; break;
457 }
458
459 return formatter<string_view>::format(name, ctx);
460 }
461};
462
463template <>
464struct LITEFX_RENDERING_API std::formatter<CullMode> : std::formatter<std::string_view> {
465 auto format(CullMode t, std::format_context& ctx) const {
466 string_view name;
467
468 switch (t) {
469 using enum CullMode;
470 case FrontFaces: name = "FrontFaces"; break;
471 case BackFaces: name = "BackFaces"; break;
472 case Both: name = "Both"; break;
473 case Disabled: name = "Disabled"; break;
474 default: name = "Invalid"; break;
475 }
476
477 return formatter<string_view>::format(name, ctx);
478 }
479};
480
481template <>
482struct LITEFX_RENDERING_API std::formatter<CullOrder> : std::formatter<std::string_view> {
483 auto format(CullOrder t, std::format_context& ctx) const {
484 string_view name;
485
486 switch (t) {
487 using enum CullOrder;
488 case ClockWise: name = "ClockWise"; break;
489 case CounterClockWise: name = "CounterClockWise"; break;
490 default: name = "Invalid"; break;
491 }
492
493 return formatter<string_view>::format(name, ctx);
494 }
495};
496
497template <>
498struct LITEFX_RENDERING_API std::formatter<RenderTargetType> : std::formatter<std::string_view> {
499 auto format(RenderTargetType t, std::format_context& ctx) const {
500 string_view name;
501
502 switch (t) {
503 using enum RenderTargetType;
504 case Color: name = "Color"; break;
505 case DepthStencil: name = "DepthStencil"; break;
506 case Present: name = "Present"; break;
507 default: name = "Invalid"; break;
508 }
509
510 return formatter<string_view>::format(name, ctx);
511 }
512};
513
514template <>
515struct LITEFX_RENDERING_API std::formatter<MultiSamplingLevel> : std::formatter<std::string_view> {
516 auto format(MultiSamplingLevel t, std::format_context& ctx) const {
517 string_view name;
518
519 switch (t) {
520 using enum MultiSamplingLevel;
521 case x1: name = "1"; break;
522 case x2: name = "2"; break;
523 case x4: name = "4"; break;
524 case x8: name = "8"; break;
525 case x16: name = "16"; break;
526 case x32: name = "32"; break;
527 case x64: name = "64"; break;
528 default: name = "Invalid"; break;
529 }
530
531 return formatter<string_view>::format(name, ctx);
532 }
533};
534
535template <>
536struct LITEFX_RENDERING_API std::formatter<FilterMode> : std::formatter<std::string_view> {
537 auto format(FilterMode t, std::format_context& ctx) const {
538 string_view name;
539
540 switch (t) {
541 using enum FilterMode;
542 case Nearest: name = "Nearest"; break;
543 case Linear: name = "Linear"; break;
544 default: name = "Invalid"; break;
545 }
546
547 return formatter<string_view>::format(name, ctx);
548 }
549};
550
551template <>
552struct LITEFX_RENDERING_API std::formatter<MipMapMode> : std::formatter<std::string_view> {
553 auto format(MipMapMode t, std::format_context& ctx) const {
554 string_view name;
555
556 switch (t) {
557 using enum MipMapMode;
558 case Nearest: name = "Nearest"; break;
559 case Linear: name = "Linear"; break;
560 default: name = "Invalid"; break;
561 }
562
563 return formatter<string_view>::format(name, ctx);
564 }
565};
566
567template <>
568struct LITEFX_RENDERING_API std::formatter<BorderMode> : std::formatter<std::string_view> {
569 auto format(BorderMode t, std::format_context& ctx) const {
570 string_view name;
571
572 switch (t) {
573 using enum BorderMode;
574 case Repeat: name = "Repeat"; break;
575 case ClampToEdge: name = "ClampToEdge"; break;
576 case ClampToBorder: name = "ClampToBorder"; break;
577 case RepeatMirrored: name = "RepeatMirrored"; break;
578 case ClampToEdgeMirrored: name = "ClampToEdgeMirrored"; break;
579 default: name = "Invalid"; break;
580 }
581
582 return formatter<string_view>::format(name, ctx);
583 }
584};
585
586template <>
587struct LITEFX_RENDERING_API std::formatter<AttributeSemantic> : std::formatter<std::string_view> {
588 auto format(AttributeSemantic t, std::format_context& ctx) const {
589 string_view name;
590
591 switch (t) {
592 using enum AttributeSemantic;
593 case Binormal: name = "Binormal"; break;
594 case BlendIndices: name = "BlendIndices"; break;
595 case BlendWeight: name = "BlendWeight"; break;
596 case Color: name = "Color"; break;
597 case Normal: name = "Normal"; break;
598 case Position: name = "Position"; break;
599 case TransformedPosition: name = "TransformedPosition"; break;
600 case PointSize: name = "PointSize"; break;
601 case Tangent: name = "Tangent"; break;
602 case TextureCoordinate: name = "TextureCoordinate"; break;
603 default: name = "Unknown"; break;
604 }
605
606 return formatter<string_view>::format(name, ctx);
607 }
608};
609
610template <>
611struct LITEFX_RENDERING_API std::formatter<GeometryFlags> : std::formatter<std::string_view> {
612 auto format(GeometryFlags t, std::format_context& ctx) const {
613 Array<String> names;
614
615 if (t == GeometryFlags::None)
616 names.emplace_back("None");
617 else
618 {
619 if ((t & GeometryFlags::Opaque) == GeometryFlags::Opaque)
620 names.emplace_back("Opaque");
621 if ((t & GeometryFlags::OneShotAnyHit) == GeometryFlags::OneShotAnyHit)
622 names.emplace_back("OneShotAnyHit");
623 }
624
625 String name = Join(names, " | ");
626 return formatter<string_view>::format(name, ctx);
627 }
628};
629
630template <>
631struct LITEFX_RENDERING_API std::formatter<AccelerationStructureFlags> : std::formatter<std::string_view> {
632 auto format(AccelerationStructureFlags t, std::format_context& ctx) const {
633 Array<String> names;
634
635 if (t == AccelerationStructureFlags::None)
636 names.emplace_back("None");
637 else
638 {
639 if ((t & AccelerationStructureFlags::AllowUpdate) == AccelerationStructureFlags::AllowUpdate)
640 names.emplace_back("AllowUpdate");
641 if ((t & AccelerationStructureFlags::AllowCompaction) == AccelerationStructureFlags::AllowCompaction)
642 names.emplace_back("AllowCompaction");
643 if ((t & AccelerationStructureFlags::PreferFastTrace) == AccelerationStructureFlags::AllowCompaction)
644 names.emplace_back("PreferFastTrace");
645 if ((t & AccelerationStructureFlags::PreferFastBuild) == AccelerationStructureFlags::PreferFastBuild)
646 names.emplace_back("PreferFastBuild");
647 if ((t & AccelerationStructureFlags::MinimizeMemory) == AccelerationStructureFlags::MinimizeMemory)
648 names.emplace_back("MinimizeMemory");
649 }
650
651 String name = Join(names, " | ");
652 return formatter<string_view>::format(name, ctx);
653 }
654};
655
656template <>
657struct LITEFX_RENDERING_API std::formatter<InstanceFlags> : std::formatter<std::string_view> {
658 auto format(InstanceFlags t, std::format_context& ctx) const {
659 Array<String> names;
660
661 if (t == InstanceFlags::None)
662 names.emplace_back("None");
663 else
664 {
665 if ((t & InstanceFlags::DisableCull) == InstanceFlags::DisableCull)
666 names.emplace_back("DisableCull");
667 if ((t & InstanceFlags::FlipWinding) == InstanceFlags::FlipWinding)
668 names.emplace_back("FlipWinding");
669 if ((t & InstanceFlags::ForceOpaque) == InstanceFlags::ForceOpaque)
670 names.emplace_back("ForceOpaque");
671 if ((t & InstanceFlags::ForceNonOpaque) == InstanceFlags::ForceNonOpaque)
672 names.emplace_back("ForceNonOpaque");
673 }
674
675 String name = Join(names, " | ");
676 return formatter<string_view>::format(name, ctx);
677 }
678};
uint16_t UInt16
A type for an unsigned 16 bit integer.
Definition math.hpp:46
uint32_t UInt32
A type for an unsigned 32 bit integer.
Definition math.hpp:56
Definition dx12.hpp:11
BorderMode
Describes how to treat texture coordinates that are outside the domain [0..1].
Definition rendering_api.hpp:1184
@ RepeatMirrored
Mirror the texture.
@ Repeat
Repeat the texture.
@ ClampToEdge
Take the closest edge texel.
@ ClampToEdgeMirrored
Take the closest edge texel from the opposite site.
@ ClampToBorder
Return a pre-specified border color.
CullOrder
Describes the order or vertex winding, that is used to determine, whether a polygon is facing towards...
Definition rendering_api.hpp:1018
@ CounterClockWise
Vertices are evaluated in a counter clock-wise manner.
@ ClockWise
Vertices are evaluated in a clock-wise manner.
MipMapMode
Describes the filter operation between two mip-map levels.
Definition rendering_api.hpp:1169
CullMode
Describes which faces are culled by the Rasterizer stage.
Definition rendering_api.hpp:991
@ FrontFaces
The rasterizer will discard front-facing polygons.
@ Both
The rasterizer will discard front and back-facing polygons.
@ Disabled
The rasterizer will not discard any polygons.
@ BackFaces
The rasterizer will discard back-facing polygons.
ShaderStage
Describes the valid shader stages of a graphics pipeline.
Definition rendering_api.hpp:799
RenderTargetType
Describes the type of a render target.
Definition rendering_api.hpp:1033
@ DepthStencil
Represents a depth/stencil target.
@ Present
Represents a color target that should be presented.
constexpr UInt32 getBufferFormatChannelSize(BufferFormat format)
Returns the number of bytes used by a channel of a buffer format.
Definition rendering_api.hpp:1927
GraphicsAdapterType
Defines different types of graphics adapters.
Definition rendering_api.hpp:75
@ CPU
The adapter is a software driver.
@ GPU
The adapter is a dedicated GPU or integrated CPU adapter.
IndexType
Describes the element type of an index buffer.
Definition rendering_api.hpp:750
PrimitiveTopology
Describes the topology of a mesh primitive.
Definition rendering_api.hpp:765
@ PointList
A list of points where each vertex refers to an individual point.
@ TriangleStrip
A strip of triangles, where each vertex (except the first two) refers to the third vertex of the next...
@ LineList
A list of lines where each vertex pair refers to the start and end points of a line.
@ LineStrip
A strip of lines where each vertex (except the first one) refers to the end point for the next line s...
@ TriangleList
A list of triangles, where each triplet of vertices refers to a whole triangle.
PolygonMode
Describes the draw mode for polygons.
Definition rendering_api.hpp:970
@ Point
Polygons are drawn as points at the vertex positions.
@ Wireframe
Polygons are only drawn as wire-frames.
@ Solid
Polygons are drawn as solid surfaces.
BufferType
Describes the type of a IBuffer.
Definition rendering_api.hpp:540
@ ShaderBindingTable
Describes a shader binding table for ray-tracing.
@ Index
Describes an index buffer.
@ Storage
Describes a shader storage buffer object (Vulkan) or unordered access view (DirectX).
@ Texel
Describes a shader texel storage buffer object (Vulkan) or unordered access view (DirectX).
@ Vertex
Describes a vertex buffer.
@ Uniform
Describes an uniform buffer object (Vulkan) or constant buffer view (DirectX).
InstanceFlags
Controls how an instance within a ITopLevelAccelerationStructure behaves during ray-tracing.
Definition rendering_api.hpp:1857
AttributeSemantic
Describes the semantic of a buffer attribute.
Definition rendering_api.hpp:371
@ BlendIndices
The attribute contains blend indices.
@ PointSize
The attribute contains a point size.
@ Binormal
The attribute contains a bi-normal vector.
@ Position
The attribute contains a position vector.
@ Tangent
The attribute contains a tangent vector.
@ BlendWeight
The attribute contains blend weights.
@ TransformedPosition
The attribute contains a pre-transformed position vector.
@ Color
The attribute contains a color value.
@ TextureCoordinate
The attribute contains a texture coordinate.
constexpr UInt32 getBufferFormatType(BufferFormat format)
Returns the underlying data type of a buffer format.
Definition rendering_api.hpp:1935
ResourceUsage
Describes the intended usage for a resource.
Definition rendering_api.hpp:690
GeometryFlags
Controls how a geometry that is part of a bottom-level acceleration structure (BLAS) behaves during r...
Definition rendering_api.hpp:1794
DescriptorType
Describes the type of a IDescriptor.
Definition rendering_api.hpp:436
@ RWStructuredBuffer
A writable shader storage object in Vulkan. Maps to a read/write structured buffer in DirectX.
@ InputAttachment
The result of a render target from an earlier render pass. Maps to a SubpassInput in HLSL.
@ AccelerationStructure
Represents a ray-tracing acceleration structure.
@ Sampler
A sampler state of a texture or image.
@ ByteAddressBuffer
Represents an unformatted buffer.
@ RWByteAddressBuffer
Represents an unformatted writable buffer.
@ Buffer
Represents a read-only texel buffer (uniform texel buffer).
@ RWBuffer
Represents a writable texel buffer (storage texel buffer).
@ Texture
A read-only sampled image.
@ StructuredBuffer
A shader storage buffer object in Vulkan. Maps to a structured buffer in DirectX.
@ ConstantBuffer
A uniform buffer in Vulkan. Maps to a constant buffer in DirectX.
QueuePriority
Specifies the priority with which a queue is scheduled on the GPU.
Definition rendering_api.hpp:159
@ High
A high queue priority.
@ Normal
The default queue priority.
@ Realtime
The highest possible queue priority. Submitting work to this queue might block other queues.
QueueType
Represents the type of a CommandQueue.
Definition rendering_api.hpp:113
ResourceHeap
Defines where a resource (buffer or image) memory is located and from where it can be accessed.
Definition rendering_api.hpp:649
@ Staging
Creates a resource that can be mapped from the CPU in order to be transferred to the GPU later.
@ Dynamic
Creates a resource that can be mapped from the CPU and read by the GPU.
@ Resource
Creates a resource that can be read by the GPU.
@ Readback
Creates a buffer that can be written on the GPU and read by the CPU.
AccelerationStructureFlags
Controls how an acceleration structure should be built.
Definition rendering_api.hpp:1816
FilterMode
Describes the filter operation when accessing a pixel from a texture coordinate.
Definition rendering_api.hpp:1152
@ Linear
Linearly interpolate between the two closest texels with respect to the texture coordinate.
@ Nearest
Take the nearest texel with respect to the texture coordinate.
BufferFormat
Describes a buffer attribute format.
Definition rendering_api.hpp:339
constexpr UInt32 getBufferFormatChannels(BufferFormat format)
Returns the number of channels for a buffer format.
Definition rendering_api.hpp:1919
Format
Describes a texel format.
Definition rendering_api.hpp:182
MultiSamplingLevel
Describes the number of samples with which a IImage is sampled.
Definition rendering_api.hpp:1111
@ x32
Use 32 samples per pixel.
@ x16
Use 16 samples per pixel.
@ x1
The default number of samples. Multi-sampling will be deactivated, if this sampling level is used.
@ x2
Use 2 samples per pixel.
@ x64
Use 64 samples per pixel.
@ x4
Use 4 samples per pixel.
@ x8
Use 8 samples per pixel.
std::vector< T > Array
Represents a dynamic array.
Definition containers.hpp:73
constexpr auto Join(std::ranges::input_range auto &&elements, StringView delimiter=""sv)
Definition string.hpp:29
std::string String
Definition string.hpp:24
auto format(AccelerationStructureFlags t, std::format_context &ctx) const
Definition rendering_formatters.hpp:632
auto format(AttributeSemantic t, std::format_context &ctx) const
Definition rendering_formatters.hpp:588
auto format(BorderMode t, std::format_context &ctx) const
Definition rendering_formatters.hpp:569
auto format(BufferFormat t, std::format_context &ctx) const
Definition rendering_formatters.hpp:385
auto format(BufferType t, std::format_context &ctx) const
Definition rendering_formatters.hpp:247
auto format(CullMode t, std::format_context &ctx) const
Definition rendering_formatters.hpp:465
auto format(CullOrder t, std::format_context &ctx) const
Definition rendering_formatters.hpp:483
auto format(DescriptorType t, std::format_context &ctx) const
Definition rendering_formatters.hpp:224
auto format(FilterMode t, std::format_context &ctx) const
Definition rendering_formatters.hpp:537
auto format(Format t, std::format_context &ctx) const
Definition rendering_formatters.hpp:65
auto format(GeometryFlags t, std::format_context &ctx) const
Definition rendering_formatters.hpp:612
auto format(GraphicsAdapterType t, std::format_context &ctx) const
Definition rendering_formatters.hpp:9
auto format(IndexType t, std::format_context &ctx) const
Definition rendering_formatters.hpp:308
auto format(InstanceFlags t, std::format_context &ctx) const
Definition rendering_formatters.hpp:658
auto format(LiteFX::Rendering::PrimitiveTopology t, std::format_context &ctx) const
Definition rendering_formatters.hpp:321
auto format(MipMapMode t, std::format_context &ctx) const
Definition rendering_formatters.hpp:553
auto format(MultiSamplingLevel t, std::format_context &ctx) const
Definition rendering_formatters.hpp:516
auto format(PolygonMode t, std::format_context &ctx) const
Definition rendering_formatters.hpp:448
auto format(QueuePriority t, std::format_context &ctx) const
Definition rendering_formatters.hpp:48
auto format(QueueType t, std::format_context &ctx) const
Definition rendering_formatters.hpp:24
auto format(RenderTargetType t, std::format_context &ctx) const
Definition rendering_formatters.hpp:499
auto format(ResourceHeap t, std::format_context &ctx) const
Definition rendering_formatters.hpp:293
auto format(ResourceUsage t, std::format_context &ctx) const
Definition rendering_formatters.hpp:267
auto format(ShaderStage t, std::format_context &ctx) const
Definition rendering_formatters.hpp:337