LiteFX 0.5.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 case ResourceDescriptorHeap: name = "Resource Descriptor Heap"; break;
241 case SamplerDescriptorHeap: name = "Sampler Descriptor Heap"; break;
242 }
243 return formatter<string_view>::format(name, ctx);
244 }
245};
246
247template <>
248struct LITEFX_RENDERING_API std::formatter<DescriptorHeapType> : std::formatter<std::string_view> {
249 auto format(DescriptorHeapType t, std::format_context& ctx) const {
250 string_view name = "Invalid";
251 switch (t) {
252 using enum DescriptorHeapType;
253 case Sampler: name = "Sampler"; break;
254 case Resource: name = "Resource"; break;
255 case None: name = "None"; break;
256 }
257 return formatter<string_view>::format(name, ctx);
258 }
259};
260
261template <>
262struct LITEFX_RENDERING_API std::formatter<BufferType> : std::formatter<std::string_view> {
263 auto format(BufferType t, std::format_context& ctx) const {
264 string_view name = "Invalid";
265 switch (t) {
266 using enum BufferType;
267 case Index: name = "Index"; break;
268 case Vertex: name = "Vertex"; break;
269 case Uniform: name = "Uniform"; break;
270 case Storage: name = "Storage"; break;
271 case Texel: name = "Texel"; break;
272 case AccelerationStructure: name = "Acceleration Structure"; break;
273 case ShaderBindingTable: name = "Shader Binding Table"; break;
274 case Indirect: name = "Indirect"; break;
275 case Other: name = "Other"; break;
276 }
277 return formatter<string_view>::format(name, ctx);
278 }
279};
280
281template <>
282struct LITEFX_RENDERING_API std::formatter<ResourceUsage> : std::formatter<std::string_view> {
283 auto format(ResourceUsage t, std::format_context& ctx) const {
284 Array<String> names;
285
286 if (t == ResourceUsage::None)
287 names.emplace_back("None");
288 else if (t == ResourceUsage::Default)
289 names.emplace_back("Default");
290 else
291 {
292 if ((t & ResourceUsage::AllowWrite) == ResourceUsage::AllowWrite)
293 names.emplace_back("AllowWrite");
294 if ((t & ResourceUsage::TransferSource) == ResourceUsage::TransferSource)
295 names.emplace_back("TransferSource");
296 if ((t & ResourceUsage::TransferDestination) == ResourceUsage::TransferDestination)
297 names.emplace_back("TransferDestination");
298 if ((t & ResourceUsage::AccelerationStructureBuildInput) == ResourceUsage::AccelerationStructureBuildInput)
299 names.emplace_back("AccelerationStructureBuildInput");
300 }
301
302 String name = Join(names, " | ");
303 return formatter<string_view>::format(name, ctx);
304 }
305};
306
307template <>
308struct LITEFX_RENDERING_API std::formatter<ResourceHeap> : std::formatter<std::string_view> {
309 auto format(ResourceHeap t, std::format_context& ctx) const {
310 string_view name = "Invalid";
311 switch (t) {
312 using enum ResourceHeap;
313 case Staging: name = "Staging"; break;
314 case Resource: name = "Resource"; break;
315 case Dynamic: name = "Dynamic"; break;
316 case Readback: name = "Readback"; break;
317 case GPUUpload: name = "GPUUpload"; break;
318 }
319 return formatter<string_view>::format(name, ctx);
320 }
321};
322
323template <>
324struct LITEFX_RENDERING_API std::formatter<IndexType> : std::formatter<std::string_view> {
325 auto format(IndexType t, std::format_context& ctx) const {
326 string_view name = "Invalid";
327 switch (t) {
328 using enum IndexType;
329 case UInt16: name = "UInt16"; break;
330 case UInt32: name = "UInt32"; break;
331 }
332 return formatter<string_view>::format(name, ctx);
333 }
334};
335
336template <>
337struct LITEFX_RENDERING_API std::formatter<LiteFX::Rendering::PrimitiveTopology> : std::formatter<std::string_view> {
338 auto format(LiteFX::Rendering::PrimitiveTopology t, std::format_context& ctx) const {
339 string_view name = "Invalid";
340 switch (t) {
341 using enum PrimitiveTopology;
342 case PointList: name = "PointList"; break;
343 case LineList: name = "LineList"; break;
344 case TriangleList: name = "TriangleList"; break;
345 case LineStrip: name = "LineStrip"; break;
346 case TriangleStrip: name = "TriangleStrip"; break;
347 }
348 return formatter<string_view>::format(name, ctx);
349 }
350};
351
352template <>
353struct LITEFX_RENDERING_API std::formatter<ShaderStage> : std::formatter<std::string_view> {
354 auto format(ShaderStage t, std::format_context& ctx) const {
355 Array<String> names;
356
357 if (t == ShaderStage::Other)
358 names.emplace_back("Other");
359 else if (t == ShaderStage::MeshPipeline)
360 names.emplace_back("Mesh Shading");
361 if (t == ShaderStage::RayTracingPipeline)
362 names.emplace_back("Ray Tracing");
363 else
364 {
365 if ((t & ShaderStage::Vertex) == ShaderStage::Vertex)
366 names.emplace_back("Vertex");
367 if ((t & ShaderStage::TessellationControl) == ShaderStage::TessellationControl)
368 names.emplace_back("Tessellation Control");
369 if ((t & ShaderStage::TessellationEvaluation) == ShaderStage::TessellationEvaluation)
370 names.emplace_back("Tessellation Evaluation");
371 if ((t & ShaderStage::Geometry) == ShaderStage::Geometry)
372 names.emplace_back("Geometry");
373 if ((t & ShaderStage::Fragment) == ShaderStage::Fragment)
374 names.emplace_back("Fragment");
375 if ((t & ShaderStage::Compute) == ShaderStage::Compute)
376 names.emplace_back("Compute");
377 if ((t & ShaderStage::Mesh) == ShaderStage::Mesh)
378 names.emplace_back("Mesh");
379 if ((t & ShaderStage::Task) == ShaderStage::Task)
380 names.emplace_back("Task");
381 if ((t & ShaderStage::RayGeneration) == ShaderStage::RayGeneration)
382 names.emplace_back("Ray Generation");
383 if ((t & ShaderStage::AnyHit) == ShaderStage::AnyHit)
384 names.emplace_back("Any Hit");
385 if ((t & ShaderStage::ClosestHit) == ShaderStage::ClosestHit)
386 names.emplace_back("Closest Hit");
387 if ((t & ShaderStage::Intersection) == ShaderStage::Intersection)
388 names.emplace_back("Intersection");
389 if ((t & ShaderStage::Miss) == ShaderStage::Miss)
390 names.emplace_back("Miss");
391 if ((t & ShaderStage::Callable) == ShaderStage::Callable)
392 names.emplace_back("Callable");
393 }
394
395 String name = Join(names, " | ");
396 return formatter<string_view>::format(name, ctx);
397 }
398};
399
400template <>
401struct LITEFX_RENDERING_API std::formatter<BufferFormat> : std::formatter<std::string_view> {
402 auto format(BufferFormat t, std::format_context& ctx) const {
403 Array<String> names;
404
405 // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
406 switch (::getBufferFormatChannels(t))
407 {
408 case 1:
409 names.emplace_back("X");
410 break;
411 case 2:
412 names.emplace_back("XY");
413 break;
414 case 3:
415 names.emplace_back("XYZ");
416 break;
417 case 4:
418 names.emplace_back("XYZW");
419 break;
420 default:
421 return formatter<string_view>::format("Invalid", ctx);
422 }
423
425 {
426 case 8:
427 names.emplace_back("8");
428 break;
429 case 16:
430 names.emplace_back("16");
431 break;
432 case 32:
433 names.emplace_back("32");
434 break;
435 case 64:
436 names.emplace_back("64");
437 break;
438 default:
439 return formatter<string_view>::format("Invalid", ctx);
440 }
441
442 switch (::getBufferFormatType(t))
443 {
444 case 0x01:
445 names.emplace_back("F");
446 break;
447 case 0x02:
448 names.emplace_back("I");
449 break;
450 case 0x04:
451 names.emplace_back("S");
452 break;
453 default:
454 return formatter<string_view>::format("Invalid", ctx);
455 }
456 // NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
457
458 String name = Join(names);
459 return formatter<string_view>::format(name, ctx);
460 }
461};
462
463template <>
464struct LITEFX_RENDERING_API std::formatter<PolygonMode> : std::formatter<std::string_view> {
465 auto format(PolygonMode t, std::format_context& ctx) const {
466 string_view name;
467
468 switch (t) {
469 using enum PolygonMode;
470 case Solid: name = "Solid"; break;
471 case Wireframe: name = "Wireframe"; break;
472 case Point: name = "Point"; break;
473 default: name = "Invalid"; break;
474 }
475
476 return formatter<string_view>::format(name, ctx);
477 }
478};
479
480template <>
481struct LITEFX_RENDERING_API std::formatter<CullMode> : std::formatter<std::string_view> {
482 auto format(CullMode t, std::format_context& ctx) const {
483 string_view name;
484
485 switch (t) {
486 using enum CullMode;
487 case FrontFaces: name = "FrontFaces"; break;
488 case BackFaces: name = "BackFaces"; break;
489 case Both: name = "Both"; break;
490 case Disabled: name = "Disabled"; break;
491 default: name = "Invalid"; break;
492 }
493
494 return formatter<string_view>::format(name, ctx);
495 }
496};
497
498template <>
499struct LITEFX_RENDERING_API std::formatter<CullOrder> : std::formatter<std::string_view> {
500 auto format(CullOrder t, std::format_context& ctx) const {
501 string_view name;
502
503 switch (t) {
504 using enum CullOrder;
505 case ClockWise: name = "ClockWise"; break;
506 case CounterClockWise: name = "CounterClockWise"; 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<RenderTargetType> : std::formatter<std::string_view> {
516 auto format(RenderTargetType t, std::format_context& ctx) const {
517 string_view name;
518
519 switch (t) {
520 using enum RenderTargetType;
521 case Color: name = "Color"; break;
522 case DepthStencil: name = "DepthStencil"; break;
523 case Present: name = "Present"; break;
524 default: name = "Invalid"; break;
525 }
526
527 return formatter<string_view>::format(name, ctx);
528 }
529};
530
531template <>
532struct LITEFX_RENDERING_API std::formatter<MultiSamplingLevel> : std::formatter<std::string_view> {
533 auto format(MultiSamplingLevel t, std::format_context& ctx) const {
534 string_view name;
535
536 switch (t) {
537 using enum MultiSamplingLevel;
538 case x1: name = "1"; break;
539 case x2: name = "2"; break;
540 case x4: name = "4"; break;
541 case x8: name = "8"; break;
542 case x16: name = "16"; break;
543 case x32: name = "32"; break;
544 case x64: name = "64"; break;
545 default: name = "Invalid"; break;
546 }
547
548 return formatter<string_view>::format(name, ctx);
549 }
550};
551
552template <>
553struct LITEFX_RENDERING_API std::formatter<FilterMode> : std::formatter<std::string_view> {
554 auto format(FilterMode t, std::format_context& ctx) const {
555 string_view name;
556
557 switch (t) {
558 using enum FilterMode;
559 case Nearest: name = "Nearest"; break;
560 case Linear: name = "Linear"; break;
561 default: name = "Invalid"; break;
562 }
563
564 return formatter<string_view>::format(name, ctx);
565 }
566};
567
568template <>
569struct LITEFX_RENDERING_API std::formatter<MipMapMode> : std::formatter<std::string_view> {
570 auto format(MipMapMode t, std::format_context& ctx) const {
571 string_view name;
572
573 switch (t) {
574 using enum MipMapMode;
575 case Nearest: name = "Nearest"; break;
576 case Linear: name = "Linear"; break;
577 default: name = "Invalid"; break;
578 }
579
580 return formatter<string_view>::format(name, ctx);
581 }
582};
583
584template <>
585struct LITEFX_RENDERING_API std::formatter<BorderMode> : std::formatter<std::string_view> {
586 auto format(BorderMode t, std::format_context& ctx) const {
587 string_view name;
588
589 switch (t) {
590 using enum BorderMode;
591 case Repeat: name = "Repeat"; break;
592 case ClampToEdge: name = "ClampToEdge"; break;
593 case ClampToBorder: name = "ClampToBorder"; break;
594 case RepeatMirrored: name = "RepeatMirrored"; break;
595 case ClampToEdgeMirrored: name = "ClampToEdgeMirrored"; break;
596 default: name = "Invalid"; break;
597 }
598
599 return formatter<string_view>::format(name, ctx);
600 }
601};
602
603template <>
604struct LITEFX_RENDERING_API std::formatter<AttributeSemantic> : std::formatter<std::string_view> {
605 auto format(AttributeSemantic t, std::format_context& ctx) const {
606 string_view name;
607
608 switch (t) {
609 using enum AttributeSemantic;
610 case Binormal: name = "Binormal"; break;
611 case BlendIndices: name = "BlendIndices"; break;
612 case BlendWeight: name = "BlendWeight"; break;
613 case Color: name = "Color"; break;
614 case Normal: name = "Normal"; break;
615 case Position: name = "Position"; break;
616 case TransformedPosition: name = "TransformedPosition"; break;
617 case PointSize: name = "PointSize"; break;
618 case Tangent: name = "Tangent"; break;
619 case TextureCoordinate: name = "TextureCoordinate"; break;
620 case Arbitrary: name = "Arbitrary"; break;
621 default: name = "Unknown"; break;
622 }
623
624 return formatter<string_view>::format(name, ctx);
625 }
626};
627
628template <>
629struct LITEFX_RENDERING_API std::formatter<GeometryFlags> : std::formatter<std::string_view> {
630 auto format(GeometryFlags t, std::format_context& ctx) const {
631 Array<String> names;
632
633 if (t == GeometryFlags::None)
634 names.emplace_back("None");
635 else
636 {
637 if ((t & GeometryFlags::Opaque) == GeometryFlags::Opaque)
638 names.emplace_back("Opaque");
639 if ((t & GeometryFlags::OneShotAnyHit) == GeometryFlags::OneShotAnyHit)
640 names.emplace_back("OneShotAnyHit");
641 }
642
643 String name = Join(names, " | ");
644 return formatter<string_view>::format(name, ctx);
645 }
646};
647
648template <>
649struct LITEFX_RENDERING_API std::formatter<AccelerationStructureFlags> : std::formatter<std::string_view> {
650 auto format(AccelerationStructureFlags t, std::format_context& ctx) const {
651 Array<String> names;
652
653 if (t == AccelerationStructureFlags::None)
654 names.emplace_back("None");
655 else
656 {
657 if ((t & AccelerationStructureFlags::AllowUpdate) == AccelerationStructureFlags::AllowUpdate)
658 names.emplace_back("AllowUpdate");
659 if ((t & AccelerationStructureFlags::AllowCompaction) == AccelerationStructureFlags::AllowCompaction)
660 names.emplace_back("AllowCompaction");
661 if ((t & AccelerationStructureFlags::PreferFastTrace) == AccelerationStructureFlags::AllowCompaction)
662 names.emplace_back("PreferFastTrace");
663 if ((t & AccelerationStructureFlags::PreferFastBuild) == AccelerationStructureFlags::PreferFastBuild)
664 names.emplace_back("PreferFastBuild");
665 if ((t & AccelerationStructureFlags::MinimizeMemory) == AccelerationStructureFlags::MinimizeMemory)
666 names.emplace_back("MinimizeMemory");
667 }
668
669 String name = Join(names, " | ");
670 return formatter<string_view>::format(name, ctx);
671 }
672};
673
674template <>
675struct LITEFX_RENDERING_API std::formatter<InstanceFlags> : std::formatter<std::string_view> {
676 auto format(InstanceFlags t, std::format_context& ctx) const {
677 Array<String> names;
678
679 if (t == InstanceFlags::None)
680 names.emplace_back("None");
681 else
682 {
683 if ((t & InstanceFlags::DisableCull) == InstanceFlags::DisableCull)
684 names.emplace_back("DisableCull");
685 if ((t & InstanceFlags::FlipWinding) == InstanceFlags::FlipWinding)
686 names.emplace_back("FlipWinding");
687 if ((t & InstanceFlags::ForceOpaque) == InstanceFlags::ForceOpaque)
688 names.emplace_back("ForceOpaque");
689 if ((t & InstanceFlags::ForceNonOpaque) == InstanceFlags::ForceNonOpaque)
690 names.emplace_back("ForceNonOpaque");
691 }
692
693 String name = Join(names, " | ");
694 return formatter<string_view>::format(name, ctx);
695 }
696};
uint16_t UInt16
A type for an unsigned 16 bit integer.
Definition math.hpp:51
uint32_t UInt32
A type for an unsigned 32 bit integer.
Definition math.hpp:61
Definition dx12.hpp:11
BorderMode
Describes how to treat texture coordinates that are outside the domain [0..1].
Definition rendering_api.hpp:1356
@ 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:1190
@ CounterClockWise
Vertices are evaluated in a counter clock-wise manner.
@ ClockWise
Vertices are evaluated in a clock-wise manner.
DescriptorHeapType
The target heap type for a descriptor.
Definition rendering_api.hpp:580
@ Resource
Binds all non-sampler resource views.
MipMapMode
Describes the filter operation between two mip-map levels.
Definition rendering_api.hpp:1341
CullMode
Describes which faces are culled by the Rasterizer stage.
Definition rendering_api.hpp:1163
@ 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:971
RenderTargetType
Describes the type of a render target.
Definition rendering_api.hpp:1205
@ 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:2099
GraphicsAdapterType
Defines different types of graphics adapters.
Definition rendering_api.hpp:76
@ 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:906
PrimitiveTopology
Describes the topology of a mesh primitive.
Definition rendering_api.hpp:937
@ 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:1142
@ 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:601
@ 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:2029
AttributeSemantic
Describes the semantic of a buffer attribute.
Definition rendering_api.hpp:372
@ BlendIndices
The attribute contains blend indices.
@ PointSize
The attribute contains a point size.
@ Binormal
The attribute contains a bi-normal vector.
@ Arbitrary
The attribute contains arbitrary data, that does not have any semantic associated with it.
@ 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:2107
ResourceUsage
Describes the intended usage for a resource.
Definition rendering_api.hpp:761
GeometryFlags
Controls how a geometry that is part of a bottom-level acceleration structure (BLAS) behaves during r...
Definition rendering_api.hpp:1966
@ Linear
A linear allocation algorithm, that allocates memory blocks sequentially.
DescriptorType
Describes the type of a IDescriptor.
Definition rendering_api.hpp:442
@ RWStructuredBuffer
A writable shader storage object in Vulkan. Maps to a read/write structured buffer in DirectX.
@ SamplerDescriptorHeap
A special descriptor type that allows indexed access to the a portion of the global sampler heap.
@ 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.
@ ResourceDescriptorHeap
Special descriptor type, that can bind all resources besides constant buffers, acceleration structure...
@ 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:160
@ 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:114
ResourceHeap
Defines where a resource (buffer or image) memory is located and from where it can be accessed.
Definition rendering_api.hpp:710
@ 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.
@ Readback
Creates a buffer that can be written on the GPU and read by the CPU.
@ GPUUpload
Creates a buffer that is directly allocated in GPU memory, but that can be efficiently written from t...
AccelerationStructureFlags
Controls how an acceleration structure should be built.
Definition rendering_api.hpp:1988
FilterMode
Describes the filter operation when accessing a pixel from a texture coordinate.
Definition rendering_api.hpp:1324
@ Nearest
Take the nearest texel with respect to the texture coordinate.
BufferFormat
Describes a buffer attribute format.
Definition rendering_api.hpp:340
constexpr UInt32 getBufferFormatChannels(BufferFormat format)
Returns the number of channels for a buffer format.
Definition rendering_api.hpp:2091
Format
Describes a texel format.
Definition rendering_api.hpp:183
MultiSamplingLevel
Describes the number of samples with which a IImage is sampled.
Definition rendering_api.hpp:1283
@ 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:650
auto format(AttributeSemantic t, std::format_context &ctx) const
Definition rendering_formatters.hpp:605
auto format(BorderMode t, std::format_context &ctx) const
Definition rendering_formatters.hpp:586
auto format(BufferFormat t, std::format_context &ctx) const
Definition rendering_formatters.hpp:402
auto format(BufferType t, std::format_context &ctx) const
Definition rendering_formatters.hpp:263
auto format(CullMode t, std::format_context &ctx) const
Definition rendering_formatters.hpp:482
auto format(CullOrder t, std::format_context &ctx) const
Definition rendering_formatters.hpp:500
auto format(DescriptorHeapType t, std::format_context &ctx) const
Definition rendering_formatters.hpp:249
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:554
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:630
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:325
auto format(InstanceFlags t, std::format_context &ctx) const
Definition rendering_formatters.hpp:676
auto format(LiteFX::Rendering::PrimitiveTopology t, std::format_context &ctx) const
Definition rendering_formatters.hpp:338
auto format(MipMapMode t, std::format_context &ctx) const
Definition rendering_formatters.hpp:570
auto format(MultiSamplingLevel t, std::format_context &ctx) const
Definition rendering_formatters.hpp:533
auto format(PolygonMode t, std::format_context &ctx) const
Definition rendering_formatters.hpp:465
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:516
auto format(ResourceHeap t, std::format_context &ctx) const
Definition rendering_formatters.hpp:309
auto format(ResourceUsage t, std::format_context &ctx) const
Definition rendering_formatters.hpp:283
auto format(ShaderStage t, std::format_context &ctx) const
Definition rendering_formatters.hpp:354