webgpu/dawn/include/dawn/webgpu_cpp_print.h
1
2#ifndef WEBGPU_CPP_PRINT_H_
3#define WEBGPU_CPP_PRINT_H_
4
5#include "dawn/webgpu_cpp.h"
6
7#include <iomanip>
8#include <ios>
9#include <ostream>
10#include <type_traits>
11
12namespace wgpu {
13
14 template <typename CharT, typename Traits>
15 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, AdapterType value) {
16 switch (value) {
17 case AdapterType::DiscreteGPU:
18 o << "AdapterType::DiscreteGPU";
19 break;
20 case AdapterType::IntegratedGPU:
21 o << "AdapterType::IntegratedGPU";
22 break;
23 case AdapterType::CPU:
24 o << "AdapterType::CPU";
25 break;
26 case AdapterType::Unknown:
27 o << "AdapterType::Unknown";
28 break;
29 default:
30 o << "AdapterType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<AdapterType>::type>(value);
31 }
32 return o;
33 }
34 template <typename CharT, typename Traits>
35 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, AddressMode value) {
36 switch (value) {
37 case AddressMode::Repeat:
38 o << "AddressMode::Repeat";
39 break;
40 case AddressMode::MirrorRepeat:
41 o << "AddressMode::MirrorRepeat";
42 break;
43 case AddressMode::ClampToEdge:
44 o << "AddressMode::ClampToEdge";
45 break;
46 default:
47 o << "AddressMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<AddressMode>::type>(value);
48 }
49 return o;
50 }
51 template <typename CharT, typename Traits>
52 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, AlphaMode value) {
53 switch (value) {
54 case AlphaMode::Premultiplied:
55 o << "AlphaMode::Premultiplied";
56 break;
57 case AlphaMode::Unpremultiplied:
58 o << "AlphaMode::Unpremultiplied";
59 break;
60 case AlphaMode::Opaque:
61 o << "AlphaMode::Opaque";
62 break;
63 default:
64 o << "AlphaMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<AlphaMode>::type>(value);
65 }
66 return o;
67 }
68 template <typename CharT, typename Traits>
69 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, BackendType value) {
70 switch (value) {
71 case BackendType::Undefined:
72 o << "BackendType::Undefined";
73 break;
74 case BackendType::Null:
75 o << "BackendType::Null";
76 break;
77 case BackendType::WebGPU:
78 o << "BackendType::WebGPU";
79 break;
80 case BackendType::D3D11:
81 o << "BackendType::D3D11";
82 break;
83 case BackendType::D3D12:
84 o << "BackendType::D3D12";
85 break;
86 case BackendType::Metal:
87 o << "BackendType::Metal";
88 break;
89 case BackendType::Vulkan:
90 o << "BackendType::Vulkan";
91 break;
92 case BackendType::OpenGL:
93 o << "BackendType::OpenGL";
94 break;
95 case BackendType::OpenGLES:
96 o << "BackendType::OpenGLES";
97 break;
98 default:
99 o << "BackendType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<BackendType>::type>(value);
100 }
101 return o;
102 }
103 template <typename CharT, typename Traits>
104 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, BlendFactor value) {
105 switch (value) {
106 case BlendFactor::Zero:
107 o << "BlendFactor::Zero";
108 break;
109 case BlendFactor::One:
110 o << "BlendFactor::One";
111 break;
112 case BlendFactor::Src:
113 o << "BlendFactor::Src";
114 break;
115 case BlendFactor::OneMinusSrc:
116 o << "BlendFactor::OneMinusSrc";
117 break;
118 case BlendFactor::SrcAlpha:
119 o << "BlendFactor::SrcAlpha";
120 break;
121 case BlendFactor::OneMinusSrcAlpha:
122 o << "BlendFactor::OneMinusSrcAlpha";
123 break;
124 case BlendFactor::Dst:
125 o << "BlendFactor::Dst";
126 break;
127 case BlendFactor::OneMinusDst:
128 o << "BlendFactor::OneMinusDst";
129 break;
130 case BlendFactor::DstAlpha:
131 o << "BlendFactor::DstAlpha";
132 break;
133 case BlendFactor::OneMinusDstAlpha:
134 o << "BlendFactor::OneMinusDstAlpha";
135 break;
136 case BlendFactor::SrcAlphaSaturated:
137 o << "BlendFactor::SrcAlphaSaturated";
138 break;
139 case BlendFactor::Constant:
140 o << "BlendFactor::Constant";
141 break;
142 case BlendFactor::OneMinusConstant:
143 o << "BlendFactor::OneMinusConstant";
144 break;
145 case BlendFactor::Src1:
146 o << "BlendFactor::Src1";
147 break;
148 case BlendFactor::OneMinusSrc1:
149 o << "BlendFactor::OneMinusSrc1";
150 break;
151 case BlendFactor::Src1Alpha:
152 o << "BlendFactor::Src1Alpha";
153 break;
154 case BlendFactor::OneMinusSrc1Alpha:
155 o << "BlendFactor::OneMinusSrc1Alpha";
156 break;
157 default:
158 o << "BlendFactor::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<BlendFactor>::type>(value);
159 }
160 return o;
161 }
162 template <typename CharT, typename Traits>
163 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, BlendOperation value) {
164 switch (value) {
165 case BlendOperation::Add:
166 o << "BlendOperation::Add";
167 break;
168 case BlendOperation::Subtract:
169 o << "BlendOperation::Subtract";
170 break;
171 case BlendOperation::ReverseSubtract:
172 o << "BlendOperation::ReverseSubtract";
173 break;
174 case BlendOperation::Min:
175 o << "BlendOperation::Min";
176 break;
177 case BlendOperation::Max:
178 o << "BlendOperation::Max";
179 break;
180 default:
181 o << "BlendOperation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<BlendOperation>::type>(value);
182 }
183 return o;
184 }
185 template <typename CharT, typename Traits>
186 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, BufferBindingType value) {
187 switch (value) {
188 case BufferBindingType::Undefined:
189 o << "BufferBindingType::Undefined";
190 break;
191 case BufferBindingType::Uniform:
192 o << "BufferBindingType::Uniform";
193 break;
194 case BufferBindingType::Storage:
195 o << "BufferBindingType::Storage";
196 break;
197 case BufferBindingType::ReadOnlyStorage:
198 o << "BufferBindingType::ReadOnlyStorage";
199 break;
200 default:
201 o << "BufferBindingType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<BufferBindingType>::type>(value);
202 }
203 return o;
204 }
205 template <typename CharT, typename Traits>
206 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, BufferMapAsyncStatus value) {
207 switch (value) {
208 case BufferMapAsyncStatus::Success:
209 o << "BufferMapAsyncStatus::Success";
210 break;
211 case BufferMapAsyncStatus::ValidationError:
212 o << "BufferMapAsyncStatus::ValidationError";
213 break;
214 case BufferMapAsyncStatus::Unknown:
215 o << "BufferMapAsyncStatus::Unknown";
216 break;
217 case BufferMapAsyncStatus::DeviceLost:
218 o << "BufferMapAsyncStatus::DeviceLost";
219 break;
220 case BufferMapAsyncStatus::DestroyedBeforeCallback:
221 o << "BufferMapAsyncStatus::DestroyedBeforeCallback";
222 break;
223 case BufferMapAsyncStatus::UnmappedBeforeCallback:
224 o << "BufferMapAsyncStatus::UnmappedBeforeCallback";
225 break;
226 case BufferMapAsyncStatus::MappingAlreadyPending:
227 o << "BufferMapAsyncStatus::MappingAlreadyPending";
228 break;
229 case BufferMapAsyncStatus::OffsetOutOfRange:
230 o << "BufferMapAsyncStatus::OffsetOutOfRange";
231 break;
232 case BufferMapAsyncStatus::SizeOutOfRange:
233 o << "BufferMapAsyncStatus::SizeOutOfRange";
234 break;
235 default:
236 o << "BufferMapAsyncStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<BufferMapAsyncStatus>::type>(value);
237 }
238 return o;
239 }
240 template <typename CharT, typename Traits>
241 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, BufferMapState value) {
242 switch (value) {
243 case BufferMapState::Unmapped:
244 o << "BufferMapState::Unmapped";
245 break;
246 case BufferMapState::Pending:
247 o << "BufferMapState::Pending";
248 break;
249 case BufferMapState::Mapped:
250 o << "BufferMapState::Mapped";
251 break;
252 default:
253 o << "BufferMapState::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<BufferMapState>::type>(value);
254 }
255 return o;
256 }
257 template <typename CharT, typename Traits>
258 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, CompareFunction value) {
259 switch (value) {
260 case CompareFunction::Undefined:
261 o << "CompareFunction::Undefined";
262 break;
263 case CompareFunction::Never:
264 o << "CompareFunction::Never";
265 break;
266 case CompareFunction::Less:
267 o << "CompareFunction::Less";
268 break;
269 case CompareFunction::LessEqual:
270 o << "CompareFunction::LessEqual";
271 break;
272 case CompareFunction::Greater:
273 o << "CompareFunction::Greater";
274 break;
275 case CompareFunction::GreaterEqual:
276 o << "CompareFunction::GreaterEqual";
277 break;
278 case CompareFunction::Equal:
279 o << "CompareFunction::Equal";
280 break;
281 case CompareFunction::NotEqual:
282 o << "CompareFunction::NotEqual";
283 break;
284 case CompareFunction::Always:
285 o << "CompareFunction::Always";
286 break;
287 default:
288 o << "CompareFunction::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<CompareFunction>::type>(value);
289 }
290 return o;
291 }
292 template <typename CharT, typename Traits>
293 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, CompilationInfoRequestStatus value) {
294 switch (value) {
295 case CompilationInfoRequestStatus::Success:
296 o << "CompilationInfoRequestStatus::Success";
297 break;
298 case CompilationInfoRequestStatus::Error:
299 o << "CompilationInfoRequestStatus::Error";
300 break;
301 case CompilationInfoRequestStatus::DeviceLost:
302 o << "CompilationInfoRequestStatus::DeviceLost";
303 break;
304 case CompilationInfoRequestStatus::Unknown:
305 o << "CompilationInfoRequestStatus::Unknown";
306 break;
307 default:
308 o << "CompilationInfoRequestStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<CompilationInfoRequestStatus>::type>(value);
309 }
310 return o;
311 }
312 template <typename CharT, typename Traits>
313 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, CompilationMessageType value) {
314 switch (value) {
315 case CompilationMessageType::Error:
316 o << "CompilationMessageType::Error";
317 break;
318 case CompilationMessageType::Warning:
319 o << "CompilationMessageType::Warning";
320 break;
321 case CompilationMessageType::Info:
322 o << "CompilationMessageType::Info";
323 break;
324 default:
325 o << "CompilationMessageType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<CompilationMessageType>::type>(value);
326 }
327 return o;
328 }
329 template <typename CharT, typename Traits>
330 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, ComputePassTimestampLocation value) {
331 switch (value) {
332 case ComputePassTimestampLocation::Beginning:
333 o << "ComputePassTimestampLocation::Beginning";
334 break;
335 case ComputePassTimestampLocation::End:
336 o << "ComputePassTimestampLocation::End";
337 break;
338 default:
339 o << "ComputePassTimestampLocation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<ComputePassTimestampLocation>::type>(value);
340 }
341 return o;
342 }
343 template <typename CharT, typename Traits>
344 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, CreatePipelineAsyncStatus value) {
345 switch (value) {
346 case CreatePipelineAsyncStatus::Success:
347 o << "CreatePipelineAsyncStatus::Success";
348 break;
349 case CreatePipelineAsyncStatus::ValidationError:
350 o << "CreatePipelineAsyncStatus::ValidationError";
351 break;
352 case CreatePipelineAsyncStatus::InternalError:
353 o << "CreatePipelineAsyncStatus::InternalError";
354 break;
355 case CreatePipelineAsyncStatus::DeviceLost:
356 o << "CreatePipelineAsyncStatus::DeviceLost";
357 break;
358 case CreatePipelineAsyncStatus::DeviceDestroyed:
359 o << "CreatePipelineAsyncStatus::DeviceDestroyed";
360 break;
361 case CreatePipelineAsyncStatus::Unknown:
362 o << "CreatePipelineAsyncStatus::Unknown";
363 break;
364 default:
365 o << "CreatePipelineAsyncStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<CreatePipelineAsyncStatus>::type>(value);
366 }
367 return o;
368 }
369 template <typename CharT, typename Traits>
370 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, CullMode value) {
371 switch (value) {
372 case CullMode::None:
373 o << "CullMode::None";
374 break;
375 case CullMode::Front:
376 o << "CullMode::Front";
377 break;
378 case CullMode::Back:
379 o << "CullMode::Back";
380 break;
381 default:
382 o << "CullMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<CullMode>::type>(value);
383 }
384 return o;
385 }
386 template <typename CharT, typename Traits>
387 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, DeviceLostReason value) {
388 switch (value) {
389 case DeviceLostReason::Undefined:
390 o << "DeviceLostReason::Undefined";
391 break;
392 case DeviceLostReason::Destroyed:
393 o << "DeviceLostReason::Destroyed";
394 break;
395 default:
396 o << "DeviceLostReason::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<DeviceLostReason>::type>(value);
397 }
398 return o;
399 }
400 template <typename CharT, typename Traits>
401 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, ErrorFilter value) {
402 switch (value) {
403 case ErrorFilter::Validation:
404 o << "ErrorFilter::Validation";
405 break;
406 case ErrorFilter::OutOfMemory:
407 o << "ErrorFilter::OutOfMemory";
408 break;
409 case ErrorFilter::Internal:
410 o << "ErrorFilter::Internal";
411 break;
412 default:
413 o << "ErrorFilter::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<ErrorFilter>::type>(value);
414 }
415 return o;
416 }
417 template <typename CharT, typename Traits>
418 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, ErrorType value) {
419 switch (value) {
420 case ErrorType::NoError:
421 o << "ErrorType::NoError";
422 break;
423 case ErrorType::Validation:
424 o << "ErrorType::Validation";
425 break;
426 case ErrorType::OutOfMemory:
427 o << "ErrorType::OutOfMemory";
428 break;
429 case ErrorType::Internal:
430 o << "ErrorType::Internal";
431 break;
432 case ErrorType::Unknown:
433 o << "ErrorType::Unknown";
434 break;
435 case ErrorType::DeviceLost:
436 o << "ErrorType::DeviceLost";
437 break;
438 default:
439 o << "ErrorType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<ErrorType>::type>(value);
440 }
441 return o;
442 }
443 template <typename CharT, typename Traits>
444 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, ExternalTextureRotation value) {
445 switch (value) {
446 case ExternalTextureRotation::Rotate0Degrees:
447 o << "ExternalTextureRotation::Rotate0Degrees";
448 break;
449 case ExternalTextureRotation::Rotate90Degrees:
450 o << "ExternalTextureRotation::Rotate90Degrees";
451 break;
452 case ExternalTextureRotation::Rotate180Degrees:
453 o << "ExternalTextureRotation::Rotate180Degrees";
454 break;
455 case ExternalTextureRotation::Rotate270Degrees:
456 o << "ExternalTextureRotation::Rotate270Degrees";
457 break;
458 default:
459 o << "ExternalTextureRotation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<ExternalTextureRotation>::type>(value);
460 }
461 return o;
462 }
463 template <typename CharT, typename Traits>
464 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, FeatureName value) {
465 switch (value) {
466 case FeatureName::Undefined:
467 o << "FeatureName::Undefined";
468 break;
469 case FeatureName::DepthClipControl:
470 o << "FeatureName::DepthClipControl";
471 break;
472 case FeatureName::Depth32FloatStencil8:
473 o << "FeatureName::Depth32FloatStencil8";
474 break;
475 case FeatureName::TimestampQuery:
476 o << "FeatureName::TimestampQuery";
477 break;
478 case FeatureName::PipelineStatisticsQuery:
479 o << "FeatureName::PipelineStatisticsQuery";
480 break;
481 case FeatureName::TextureCompressionBC:
482 o << "FeatureName::TextureCompressionBC";
483 break;
484 case FeatureName::TextureCompressionETC2:
485 o << "FeatureName::TextureCompressionETC2";
486 break;
487 case FeatureName::TextureCompressionASTC:
488 o << "FeatureName::TextureCompressionASTC";
489 break;
490 case FeatureName::IndirectFirstInstance:
491 o << "FeatureName::IndirectFirstInstance";
492 break;
493 case FeatureName::ShaderF16:
494 o << "FeatureName::ShaderF16";
495 break;
496 case FeatureName::RG11B10UfloatRenderable:
497 o << "FeatureName::RG11B10UfloatRenderable";
498 break;
499 case FeatureName::BGRA8UnormStorage:
500 o << "FeatureName::BGRA8UnormStorage";
501 break;
502 case FeatureName::Float32Filterable:
503 o << "FeatureName::Float32Filterable";
504 break;
505 case FeatureName::DawnInternalUsages:
506 o << "FeatureName::DawnInternalUsages";
507 break;
508 case FeatureName::DawnMultiPlanarFormats:
509 o << "FeatureName::DawnMultiPlanarFormats";
510 break;
511 case FeatureName::DawnNative:
512 o << "FeatureName::DawnNative";
513 break;
514 case FeatureName::ChromiumExperimentalDp4a:
515 o << "FeatureName::ChromiumExperimentalDp4a";
516 break;
517 case FeatureName::TimestampQueryInsidePasses:
518 o << "FeatureName::TimestampQueryInsidePasses";
519 break;
520 case FeatureName::ImplicitDeviceSynchronization:
521 o << "FeatureName::ImplicitDeviceSynchronization";
522 break;
523 case FeatureName::SurfaceCapabilities:
524 o << "FeatureName::SurfaceCapabilities";
525 break;
526 case FeatureName::TransientAttachments:
527 o << "FeatureName::TransientAttachments";
528 break;
529 case FeatureName::MSAARenderToSingleSampled:
530 o << "FeatureName::MSAARenderToSingleSampled";
531 break;
532 case FeatureName::DualSourceBlending:
533 o << "FeatureName::DualSourceBlending";
534 break;
535 case FeatureName::D3D11MultithreadProtected:
536 o << "FeatureName::D3D11MultithreadProtected";
537 break;
538 case FeatureName::ANGLETextureSharing:
539 o << "FeatureName::ANGLETextureSharing";
540 break;
541 case FeatureName::SharedTextureMemoryVkDedicatedAllocation:
542 o << "FeatureName::SharedTextureMemoryVkDedicatedAllocation";
543 break;
544 case FeatureName::SharedTextureMemoryAHardwareBuffer:
545 o << "FeatureName::SharedTextureMemoryAHardwareBuffer";
546 break;
547 case FeatureName::SharedTextureMemoryDmaBuf:
548 o << "FeatureName::SharedTextureMemoryDmaBuf";
549 break;
550 case FeatureName::SharedTextureMemoryOpaqueFD:
551 o << "FeatureName::SharedTextureMemoryOpaqueFD";
552 break;
553 case FeatureName::SharedTextureMemoryZirconHandle:
554 o << "FeatureName::SharedTextureMemoryZirconHandle";
555 break;
556 case FeatureName::SharedTextureMemoryDXGISharedHandle:
557 o << "FeatureName::SharedTextureMemoryDXGISharedHandle";
558 break;
559 case FeatureName::SharedTextureMemoryD3D11Texture2D:
560 o << "FeatureName::SharedTextureMemoryD3D11Texture2D";
561 break;
562 case FeatureName::SharedTextureMemoryIOSurface:
563 o << "FeatureName::SharedTextureMemoryIOSurface";
564 break;
565 case FeatureName::SharedTextureMemoryEGLImage:
566 o << "FeatureName::SharedTextureMemoryEGLImage";
567 break;
568 case FeatureName::SharedFenceVkSemaphoreOpaqueFD:
569 o << "FeatureName::SharedFenceVkSemaphoreOpaqueFD";
570 break;
571 case FeatureName::SharedFenceVkSemaphoreSyncFD:
572 o << "FeatureName::SharedFenceVkSemaphoreSyncFD";
573 break;
574 case FeatureName::SharedFenceVkSemaphoreZirconHandle:
575 o << "FeatureName::SharedFenceVkSemaphoreZirconHandle";
576 break;
577 case FeatureName::SharedFenceDXGISharedHandle:
578 o << "FeatureName::SharedFenceDXGISharedHandle";
579 break;
580 case FeatureName::SharedFenceMTLSharedEvent:
581 o << "FeatureName::SharedFenceMTLSharedEvent";
582 break;
583 default:
584 o << "FeatureName::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<FeatureName>::type>(value);
585 }
586 return o;
587 }
588 template <typename CharT, typename Traits>
589 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, FilterMode value) {
590 switch (value) {
591 case FilterMode::Nearest:
592 o << "FilterMode::Nearest";
593 break;
594 case FilterMode::Linear:
595 o << "FilterMode::Linear";
596 break;
597 default:
598 o << "FilterMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<FilterMode>::type>(value);
599 }
600 return o;
601 }
602 template <typename CharT, typename Traits>
603 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, FrontFace value) {
604 switch (value) {
605 case FrontFace::CCW:
606 o << "FrontFace::CCW";
607 break;
608 case FrontFace::CW:
609 o << "FrontFace::CW";
610 break;
611 default:
612 o << "FrontFace::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<FrontFace>::type>(value);
613 }
614 return o;
615 }
616 template <typename CharT, typename Traits>
617 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, IndexFormat value) {
618 switch (value) {
619 case IndexFormat::Undefined:
620 o << "IndexFormat::Undefined";
621 break;
622 case IndexFormat::Uint16:
623 o << "IndexFormat::Uint16";
624 break;
625 case IndexFormat::Uint32:
626 o << "IndexFormat::Uint32";
627 break;
628 default:
629 o << "IndexFormat::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<IndexFormat>::type>(value);
630 }
631 return o;
632 }
633 template <typename CharT, typename Traits>
634 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, LoadOp value) {
635 switch (value) {
636 case LoadOp::Undefined:
637 o << "LoadOp::Undefined";
638 break;
639 case LoadOp::Clear:
640 o << "LoadOp::Clear";
641 break;
642 case LoadOp::Load:
643 o << "LoadOp::Load";
644 break;
645 default:
646 o << "LoadOp::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<LoadOp>::type>(value);
647 }
648 return o;
649 }
650 template <typename CharT, typename Traits>
651 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, LoggingType value) {
652 switch (value) {
653 case LoggingType::Verbose:
654 o << "LoggingType::Verbose";
655 break;
656 case LoggingType::Info:
657 o << "LoggingType::Info";
658 break;
659 case LoggingType::Warning:
660 o << "LoggingType::Warning";
661 break;
662 case LoggingType::Error:
663 o << "LoggingType::Error";
664 break;
665 default:
666 o << "LoggingType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<LoggingType>::type>(value);
667 }
668 return o;
669 }
670 template <typename CharT, typename Traits>
671 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, MipmapFilterMode value) {
672 switch (value) {
673 case MipmapFilterMode::Nearest:
674 o << "MipmapFilterMode::Nearest";
675 break;
676 case MipmapFilterMode::Linear:
677 o << "MipmapFilterMode::Linear";
678 break;
679 default:
680 o << "MipmapFilterMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<MipmapFilterMode>::type>(value);
681 }
682 return o;
683 }
684 template <typename CharT, typename Traits>
685 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, PipelineStatisticName value) {
686 switch (value) {
687 case PipelineStatisticName::VertexShaderInvocations:
688 o << "PipelineStatisticName::VertexShaderInvocations";
689 break;
690 case PipelineStatisticName::ClipperInvocations:
691 o << "PipelineStatisticName::ClipperInvocations";
692 break;
693 case PipelineStatisticName::ClipperPrimitivesOut:
694 o << "PipelineStatisticName::ClipperPrimitivesOut";
695 break;
696 case PipelineStatisticName::FragmentShaderInvocations:
697 o << "PipelineStatisticName::FragmentShaderInvocations";
698 break;
699 case PipelineStatisticName::ComputeShaderInvocations:
700 o << "PipelineStatisticName::ComputeShaderInvocations";
701 break;
702 default:
703 o << "PipelineStatisticName::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<PipelineStatisticName>::type>(value);
704 }
705 return o;
706 }
707 template <typename CharT, typename Traits>
708 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, PowerPreference value) {
709 switch (value) {
710 case PowerPreference::Undefined:
711 o << "PowerPreference::Undefined";
712 break;
713 case PowerPreference::LowPower:
714 o << "PowerPreference::LowPower";
715 break;
716 case PowerPreference::HighPerformance:
717 o << "PowerPreference::HighPerformance";
718 break;
719 default:
720 o << "PowerPreference::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<PowerPreference>::type>(value);
721 }
722 return o;
723 }
724 template <typename CharT, typename Traits>
725 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, PresentMode value) {
726 switch (value) {
727 case PresentMode::Immediate:
728 o << "PresentMode::Immediate";
729 break;
730 case PresentMode::Mailbox:
731 o << "PresentMode::Mailbox";
732 break;
733 case PresentMode::Fifo:
734 o << "PresentMode::Fifo";
735 break;
736 default:
737 o << "PresentMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<PresentMode>::type>(value);
738 }
739 return o;
740 }
741 template <typename CharT, typename Traits>
742 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, PrimitiveTopology value) {
743 switch (value) {
744 case PrimitiveTopology::PointList:
745 o << "PrimitiveTopology::PointList";
746 break;
747 case PrimitiveTopology::LineList:
748 o << "PrimitiveTopology::LineList";
749 break;
750 case PrimitiveTopology::LineStrip:
751 o << "PrimitiveTopology::LineStrip";
752 break;
753 case PrimitiveTopology::TriangleList:
754 o << "PrimitiveTopology::TriangleList";
755 break;
756 case PrimitiveTopology::TriangleStrip:
757 o << "PrimitiveTopology::TriangleStrip";
758 break;
759 default:
760 o << "PrimitiveTopology::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<PrimitiveTopology>::type>(value);
761 }
762 return o;
763 }
764 template <typename CharT, typename Traits>
765 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, QueryType value) {
766 switch (value) {
767 case QueryType::Occlusion:
768 o << "QueryType::Occlusion";
769 break;
770 case QueryType::PipelineStatistics:
771 o << "QueryType::PipelineStatistics";
772 break;
773 case QueryType::Timestamp:
774 o << "QueryType::Timestamp";
775 break;
776 default:
777 o << "QueryType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<QueryType>::type>(value);
778 }
779 return o;
780 }
781 template <typename CharT, typename Traits>
782 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, QueueWorkDoneStatus value) {
783 switch (value) {
784 case QueueWorkDoneStatus::Success:
785 o << "QueueWorkDoneStatus::Success";
786 break;
787 case QueueWorkDoneStatus::Error:
788 o << "QueueWorkDoneStatus::Error";
789 break;
790 case QueueWorkDoneStatus::Unknown:
791 o << "QueueWorkDoneStatus::Unknown";
792 break;
793 case QueueWorkDoneStatus::DeviceLost:
794 o << "QueueWorkDoneStatus::DeviceLost";
795 break;
796 default:
797 o << "QueueWorkDoneStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<QueueWorkDoneStatus>::type>(value);
798 }
799 return o;
800 }
801 template <typename CharT, typename Traits>
802 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, RenderPassTimestampLocation value) {
803 switch (value) {
804 case RenderPassTimestampLocation::Beginning:
805 o << "RenderPassTimestampLocation::Beginning";
806 break;
807 case RenderPassTimestampLocation::End:
808 o << "RenderPassTimestampLocation::End";
809 break;
810 default:
811 o << "RenderPassTimestampLocation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<RenderPassTimestampLocation>::type>(value);
812 }
813 return o;
814 }
815 template <typename CharT, typename Traits>
816 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, RequestAdapterStatus value) {
817 switch (value) {
818 case RequestAdapterStatus::Success:
819 o << "RequestAdapterStatus::Success";
820 break;
821 case RequestAdapterStatus::Unavailable:
822 o << "RequestAdapterStatus::Unavailable";
823 break;
824 case RequestAdapterStatus::Error:
825 o << "RequestAdapterStatus::Error";
826 break;
827 case RequestAdapterStatus::Unknown:
828 o << "RequestAdapterStatus::Unknown";
829 break;
830 default:
831 o << "RequestAdapterStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<RequestAdapterStatus>::type>(value);
832 }
833 return o;
834 }
835 template <typename CharT, typename Traits>
836 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, RequestDeviceStatus value) {
837 switch (value) {
838 case RequestDeviceStatus::Success:
839 o << "RequestDeviceStatus::Success";
840 break;
841 case RequestDeviceStatus::Error:
842 o << "RequestDeviceStatus::Error";
843 break;
844 case RequestDeviceStatus::Unknown:
845 o << "RequestDeviceStatus::Unknown";
846 break;
847 default:
848 o << "RequestDeviceStatus::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<RequestDeviceStatus>::type>(value);
849 }
850 return o;
851 }
852 template <typename CharT, typename Traits>
853 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, SType value) {
854 switch (value) {
855 case SType::Invalid:
856 o << "SType::Invalid";
857 break;
858 case SType::SurfaceDescriptorFromMetalLayer:
859 o << "SType::SurfaceDescriptorFromMetalLayer";
860 break;
861 case SType::SurfaceDescriptorFromWindowsHWND:
862 o << "SType::SurfaceDescriptorFromWindowsHWND";
863 break;
864 case SType::SurfaceDescriptorFromXlibWindow:
865 o << "SType::SurfaceDescriptorFromXlibWindow";
866 break;
867 case SType::SurfaceDescriptorFromCanvasHTMLSelector:
868 o << "SType::SurfaceDescriptorFromCanvasHTMLSelector";
869 break;
870 case SType::ShaderModuleSPIRVDescriptor:
871 o << "SType::ShaderModuleSPIRVDescriptor";
872 break;
873 case SType::ShaderModuleWGSLDescriptor:
874 o << "SType::ShaderModuleWGSLDescriptor";
875 break;
876 case SType::PrimitiveDepthClipControl:
877 o << "SType::PrimitiveDepthClipControl";
878 break;
879 case SType::SurfaceDescriptorFromWaylandSurface:
880 o << "SType::SurfaceDescriptorFromWaylandSurface";
881 break;
882 case SType::SurfaceDescriptorFromAndroidNativeWindow:
883 o << "SType::SurfaceDescriptorFromAndroidNativeWindow";
884 break;
885 case SType::SurfaceDescriptorFromWindowsCoreWindow:
886 o << "SType::SurfaceDescriptorFromWindowsCoreWindow";
887 break;
888 case SType::ExternalTextureBindingEntry:
889 o << "SType::ExternalTextureBindingEntry";
890 break;
891 case SType::ExternalTextureBindingLayout:
892 o << "SType::ExternalTextureBindingLayout";
893 break;
894 case SType::SurfaceDescriptorFromWindowsSwapChainPanel:
895 o << "SType::SurfaceDescriptorFromWindowsSwapChainPanel";
896 break;
897 case SType::RenderPassDescriptorMaxDrawCount:
898 o << "SType::RenderPassDescriptorMaxDrawCount";
899 break;
900 case SType::DawnTextureInternalUsageDescriptor:
901 o << "SType::DawnTextureInternalUsageDescriptor";
902 break;
903 case SType::DawnEncoderInternalUsageDescriptor:
904 o << "SType::DawnEncoderInternalUsageDescriptor";
905 break;
906 case SType::DawnInstanceDescriptor:
907 o << "SType::DawnInstanceDescriptor";
908 break;
909 case SType::DawnCacheDeviceDescriptor:
910 o << "SType::DawnCacheDeviceDescriptor";
911 break;
912 case SType::DawnAdapterPropertiesPowerPreference:
913 o << "SType::DawnAdapterPropertiesPowerPreference";
914 break;
915 case SType::DawnBufferDescriptorErrorInfoFromWireClient:
916 o << "SType::DawnBufferDescriptorErrorInfoFromWireClient";
917 break;
918 case SType::DawnTogglesDescriptor:
919 o << "SType::DawnTogglesDescriptor";
920 break;
921 case SType::DawnShaderModuleSPIRVOptionsDescriptor:
922 o << "SType::DawnShaderModuleSPIRVOptionsDescriptor";
923 break;
924 case SType::RequestAdapterOptionsLUID:
925 o << "SType::RequestAdapterOptionsLUID";
926 break;
927 case SType::RequestAdapterOptionsGetGLProc:
928 o << "SType::RequestAdapterOptionsGetGLProc";
929 break;
930 case SType::DawnMultisampleStateRenderToSingleSampled:
931 o << "SType::DawnMultisampleStateRenderToSingleSampled";
932 break;
933 case SType::DawnRenderPassColorAttachmentRenderToSingleSampled:
934 o << "SType::DawnRenderPassColorAttachmentRenderToSingleSampled";
935 break;
936 case SType::SharedTextureMemoryVkImageDescriptor:
937 o << "SType::SharedTextureMemoryVkImageDescriptor";
938 break;
939 case SType::SharedTextureMemoryVkDedicatedAllocationDescriptor:
940 o << "SType::SharedTextureMemoryVkDedicatedAllocationDescriptor";
941 break;
942 case SType::SharedTextureMemoryAHardwareBufferDescriptor:
943 o << "SType::SharedTextureMemoryAHardwareBufferDescriptor";
944 break;
945 case SType::SharedTextureMemoryDmaBufDescriptor:
946 o << "SType::SharedTextureMemoryDmaBufDescriptor";
947 break;
948 case SType::SharedTextureMemoryOpaqueFDDescriptor:
949 o << "SType::SharedTextureMemoryOpaqueFDDescriptor";
950 break;
951 case SType::SharedTextureMemoryZirconHandleDescriptor:
952 o << "SType::SharedTextureMemoryZirconHandleDescriptor";
953 break;
954 case SType::SharedTextureMemoryDXGISharedHandleDescriptor:
955 o << "SType::SharedTextureMemoryDXGISharedHandleDescriptor";
956 break;
957 case SType::SharedTextureMemoryD3D11Texture2DDescriptor:
958 o << "SType::SharedTextureMemoryD3D11Texture2DDescriptor";
959 break;
960 case SType::SharedTextureMemoryIOSurfaceDescriptor:
961 o << "SType::SharedTextureMemoryIOSurfaceDescriptor";
962 break;
963 case SType::SharedTextureMemoryEGLImageDescriptor:
964 o << "SType::SharedTextureMemoryEGLImageDescriptor";
965 break;
966 case SType::SharedTextureMemoryInitializedBeginState:
967 o << "SType::SharedTextureMemoryInitializedBeginState";
968 break;
969 case SType::SharedTextureMemoryInitializedEndState:
970 o << "SType::SharedTextureMemoryInitializedEndState";
971 break;
972 case SType::SharedTextureMemoryVkImageLayoutBeginState:
973 o << "SType::SharedTextureMemoryVkImageLayoutBeginState";
974 break;
975 case SType::SharedTextureMemoryVkImageLayoutEndState:
976 o << "SType::SharedTextureMemoryVkImageLayoutEndState";
977 break;
978 case SType::SharedFenceVkSemaphoreOpaqueFDDescriptor:
979 o << "SType::SharedFenceVkSemaphoreOpaqueFDDescriptor";
980 break;
981 case SType::SharedFenceVkSemaphoreOpaqueFDExportInfo:
982 o << "SType::SharedFenceVkSemaphoreOpaqueFDExportInfo";
983 break;
984 case SType::SharedFenceVkSemaphoreSyncFDDescriptor:
985 o << "SType::SharedFenceVkSemaphoreSyncFDDescriptor";
986 break;
987 case SType::SharedFenceVkSemaphoreSyncFDExportInfo:
988 o << "SType::SharedFenceVkSemaphoreSyncFDExportInfo";
989 break;
990 case SType::SharedFenceVkSemaphoreZirconHandleDescriptor:
991 o << "SType::SharedFenceVkSemaphoreZirconHandleDescriptor";
992 break;
993 case SType::SharedFenceVkSemaphoreZirconHandleExportInfo:
994 o << "SType::SharedFenceVkSemaphoreZirconHandleExportInfo";
995 break;
996 case SType::SharedFenceDXGISharedHandleDescriptor:
997 o << "SType::SharedFenceDXGISharedHandleDescriptor";
998 break;
999 case SType::SharedFenceDXGISharedHandleExportInfo:
1000 o << "SType::SharedFenceDXGISharedHandleExportInfo";
1001 break;
1002 case SType::SharedFenceMTLSharedEventDescriptor:
1003 o << "SType::SharedFenceMTLSharedEventDescriptor";
1004 break;
1005 case SType::SharedFenceMTLSharedEventExportInfo:
1006 o << "SType::SharedFenceMTLSharedEventExportInfo";
1007 break;
1008 default:
1009 o << "SType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<SType>::type>(value);
1010 }
1011 return o;
1012 }
1013 template <typename CharT, typename Traits>
1014 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, SamplerBindingType value) {
1015 switch (value) {
1016 case SamplerBindingType::Undefined:
1017 o << "SamplerBindingType::Undefined";
1018 break;
1019 case SamplerBindingType::Filtering:
1020 o << "SamplerBindingType::Filtering";
1021 break;
1022 case SamplerBindingType::NonFiltering:
1023 o << "SamplerBindingType::NonFiltering";
1024 break;
1025 case SamplerBindingType::Comparison:
1026 o << "SamplerBindingType::Comparison";
1027 break;
1028 default:
1029 o << "SamplerBindingType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<SamplerBindingType>::type>(value);
1030 }
1031 return o;
1032 }
1033 template <typename CharT, typename Traits>
1034 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, SharedFenceType value) {
1035 switch (value) {
1036 case SharedFenceType::Undefined:
1037 o << "SharedFenceType::Undefined";
1038 break;
1039 case SharedFenceType::VkSemaphoreOpaqueFD:
1040 o << "SharedFenceType::VkSemaphoreOpaqueFD";
1041 break;
1042 case SharedFenceType::VkSemaphoreSyncFD:
1043 o << "SharedFenceType::VkSemaphoreSyncFD";
1044 break;
1045 case SharedFenceType::VkSemaphoreZirconHandle:
1046 o << "SharedFenceType::VkSemaphoreZirconHandle";
1047 break;
1048 case SharedFenceType::DXGISharedHandle:
1049 o << "SharedFenceType::DXGISharedHandle";
1050 break;
1051 case SharedFenceType::MTLSharedEvent:
1052 o << "SharedFenceType::MTLSharedEvent";
1053 break;
1054 default:
1055 o << "SharedFenceType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<SharedFenceType>::type>(value);
1056 }
1057 return o;
1058 }
1059 template <typename CharT, typename Traits>
1060 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, StencilOperation value) {
1061 switch (value) {
1062 case StencilOperation::Keep:
1063 o << "StencilOperation::Keep";
1064 break;
1065 case StencilOperation::Zero:
1066 o << "StencilOperation::Zero";
1067 break;
1068 case StencilOperation::Replace:
1069 o << "StencilOperation::Replace";
1070 break;
1071 case StencilOperation::Invert:
1072 o << "StencilOperation::Invert";
1073 break;
1074 case StencilOperation::IncrementClamp:
1075 o << "StencilOperation::IncrementClamp";
1076 break;
1077 case StencilOperation::DecrementClamp:
1078 o << "StencilOperation::DecrementClamp";
1079 break;
1080 case StencilOperation::IncrementWrap:
1081 o << "StencilOperation::IncrementWrap";
1082 break;
1083 case StencilOperation::DecrementWrap:
1084 o << "StencilOperation::DecrementWrap";
1085 break;
1086 default:
1087 o << "StencilOperation::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<StencilOperation>::type>(value);
1088 }
1089 return o;
1090 }
1091 template <typename CharT, typename Traits>
1092 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, StorageTextureAccess value) {
1093 switch (value) {
1094 case StorageTextureAccess::Undefined:
1095 o << "StorageTextureAccess::Undefined";
1096 break;
1097 case StorageTextureAccess::WriteOnly:
1098 o << "StorageTextureAccess::WriteOnly";
1099 break;
1100 default:
1101 o << "StorageTextureAccess::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<StorageTextureAccess>::type>(value);
1102 }
1103 return o;
1104 }
1105 template <typename CharT, typename Traits>
1106 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, StoreOp value) {
1107 switch (value) {
1108 case StoreOp::Undefined:
1109 o << "StoreOp::Undefined";
1110 break;
1111 case StoreOp::Store:
1112 o << "StoreOp::Store";
1113 break;
1114 case StoreOp::Discard:
1115 o << "StoreOp::Discard";
1116 break;
1117 default:
1118 o << "StoreOp::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<StoreOp>::type>(value);
1119 }
1120 return o;
1121 }
1122 template <typename CharT, typename Traits>
1123 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, TextureAspect value) {
1124 switch (value) {
1125 case TextureAspect::All:
1126 o << "TextureAspect::All";
1127 break;
1128 case TextureAspect::StencilOnly:
1129 o << "TextureAspect::StencilOnly";
1130 break;
1131 case TextureAspect::DepthOnly:
1132 o << "TextureAspect::DepthOnly";
1133 break;
1134 case TextureAspect::Plane0Only:
1135 o << "TextureAspect::Plane0Only";
1136 break;
1137 case TextureAspect::Plane1Only:
1138 o << "TextureAspect::Plane1Only";
1139 break;
1140 default:
1141 o << "TextureAspect::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<TextureAspect>::type>(value);
1142 }
1143 return o;
1144 }
1145 template <typename CharT, typename Traits>
1146 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, TextureDimension value) {
1147 switch (value) {
1148 case TextureDimension::e1D:
1149 o << "TextureDimension::e1D";
1150 break;
1151 case TextureDimension::e2D:
1152 o << "TextureDimension::e2D";
1153 break;
1154 case TextureDimension::e3D:
1155 o << "TextureDimension::e3D";
1156 break;
1157 default:
1158 o << "TextureDimension::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<TextureDimension>::type>(value);
1159 }
1160 return o;
1161 }
1162 template <typename CharT, typename Traits>
1163 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, TextureFormat value) {
1164 switch (value) {
1165 case TextureFormat::Undefined:
1166 o << "TextureFormat::Undefined";
1167 break;
1168 case TextureFormat::R8Unorm:
1169 o << "TextureFormat::R8Unorm";
1170 break;
1171 case TextureFormat::R8Snorm:
1172 o << "TextureFormat::R8Snorm";
1173 break;
1174 case TextureFormat::R8Uint:
1175 o << "TextureFormat::R8Uint";
1176 break;
1177 case TextureFormat::R8Sint:
1178 o << "TextureFormat::R8Sint";
1179 break;
1180 case TextureFormat::R16Uint:
1181 o << "TextureFormat::R16Uint";
1182 break;
1183 case TextureFormat::R16Sint:
1184 o << "TextureFormat::R16Sint";
1185 break;
1186 case TextureFormat::R16Float:
1187 o << "TextureFormat::R16Float";
1188 break;
1189 case TextureFormat::RG8Unorm:
1190 o << "TextureFormat::RG8Unorm";
1191 break;
1192 case TextureFormat::RG8Snorm:
1193 o << "TextureFormat::RG8Snorm";
1194 break;
1195 case TextureFormat::RG8Uint:
1196 o << "TextureFormat::RG8Uint";
1197 break;
1198 case TextureFormat::RG8Sint:
1199 o << "TextureFormat::RG8Sint";
1200 break;
1201 case TextureFormat::R32Float:
1202 o << "TextureFormat::R32Float";
1203 break;
1204 case TextureFormat::R32Uint:
1205 o << "TextureFormat::R32Uint";
1206 break;
1207 case TextureFormat::R32Sint:
1208 o << "TextureFormat::R32Sint";
1209 break;
1210 case TextureFormat::RG16Uint:
1211 o << "TextureFormat::RG16Uint";
1212 break;
1213 case TextureFormat::RG16Sint:
1214 o << "TextureFormat::RG16Sint";
1215 break;
1216 case TextureFormat::RG16Float:
1217 o << "TextureFormat::RG16Float";
1218 break;
1219 case TextureFormat::RGBA8Unorm:
1220 o << "TextureFormat::RGBA8Unorm";
1221 break;
1222 case TextureFormat::RGBA8UnormSrgb:
1223 o << "TextureFormat::RGBA8UnormSrgb";
1224 break;
1225 case TextureFormat::RGBA8Snorm:
1226 o << "TextureFormat::RGBA8Snorm";
1227 break;
1228 case TextureFormat::RGBA8Uint:
1229 o << "TextureFormat::RGBA8Uint";
1230 break;
1231 case TextureFormat::RGBA8Sint:
1232 o << "TextureFormat::RGBA8Sint";
1233 break;
1234 case TextureFormat::BGRA8Unorm:
1235 o << "TextureFormat::BGRA8Unorm";
1236 break;
1237 case TextureFormat::BGRA8UnormSrgb:
1238 o << "TextureFormat::BGRA8UnormSrgb";
1239 break;
1240 case TextureFormat::RGB10A2Unorm:
1241 o << "TextureFormat::RGB10A2Unorm";
1242 break;
1243 case TextureFormat::RG11B10Ufloat:
1244 o << "TextureFormat::RG11B10Ufloat";
1245 break;
1246 case TextureFormat::RGB9E5Ufloat:
1247 o << "TextureFormat::RGB9E5Ufloat";
1248 break;
1249 case TextureFormat::RG32Float:
1250 o << "TextureFormat::RG32Float";
1251 break;
1252 case TextureFormat::RG32Uint:
1253 o << "TextureFormat::RG32Uint";
1254 break;
1255 case TextureFormat::RG32Sint:
1256 o << "TextureFormat::RG32Sint";
1257 break;
1258 case TextureFormat::RGBA16Uint:
1259 o << "TextureFormat::RGBA16Uint";
1260 break;
1261 case TextureFormat::RGBA16Sint:
1262 o << "TextureFormat::RGBA16Sint";
1263 break;
1264 case TextureFormat::RGBA16Float:
1265 o << "TextureFormat::RGBA16Float";
1266 break;
1267 case TextureFormat::RGBA32Float:
1268 o << "TextureFormat::RGBA32Float";
1269 break;
1270 case TextureFormat::RGBA32Uint:
1271 o << "TextureFormat::RGBA32Uint";
1272 break;
1273 case TextureFormat::RGBA32Sint:
1274 o << "TextureFormat::RGBA32Sint";
1275 break;
1276 case TextureFormat::Stencil8:
1277 o << "TextureFormat::Stencil8";
1278 break;
1279 case TextureFormat::Depth16Unorm:
1280 o << "TextureFormat::Depth16Unorm";
1281 break;
1282 case TextureFormat::Depth24Plus:
1283 o << "TextureFormat::Depth24Plus";
1284 break;
1285 case TextureFormat::Depth24PlusStencil8:
1286 o << "TextureFormat::Depth24PlusStencil8";
1287 break;
1288 case TextureFormat::Depth32Float:
1289 o << "TextureFormat::Depth32Float";
1290 break;
1291 case TextureFormat::Depth32FloatStencil8:
1292 o << "TextureFormat::Depth32FloatStencil8";
1293 break;
1294 case TextureFormat::BC1RGBAUnorm:
1295 o << "TextureFormat::BC1RGBAUnorm";
1296 break;
1297 case TextureFormat::BC1RGBAUnormSrgb:
1298 o << "TextureFormat::BC1RGBAUnormSrgb";
1299 break;
1300 case TextureFormat::BC2RGBAUnorm:
1301 o << "TextureFormat::BC2RGBAUnorm";
1302 break;
1303 case TextureFormat::BC2RGBAUnormSrgb:
1304 o << "TextureFormat::BC2RGBAUnormSrgb";
1305 break;
1306 case TextureFormat::BC3RGBAUnorm:
1307 o << "TextureFormat::BC3RGBAUnorm";
1308 break;
1309 case TextureFormat::BC3RGBAUnormSrgb:
1310 o << "TextureFormat::BC3RGBAUnormSrgb";
1311 break;
1312 case TextureFormat::BC4RUnorm:
1313 o << "TextureFormat::BC4RUnorm";
1314 break;
1315 case TextureFormat::BC4RSnorm:
1316 o << "TextureFormat::BC4RSnorm";
1317 break;
1318 case TextureFormat::BC5RGUnorm:
1319 o << "TextureFormat::BC5RGUnorm";
1320 break;
1321 case TextureFormat::BC5RGSnorm:
1322 o << "TextureFormat::BC5RGSnorm";
1323 break;
1324 case TextureFormat::BC6HRGBUfloat:
1325 o << "TextureFormat::BC6HRGBUfloat";
1326 break;
1327 case TextureFormat::BC6HRGBFloat:
1328 o << "TextureFormat::BC6HRGBFloat";
1329 break;
1330 case TextureFormat::BC7RGBAUnorm:
1331 o << "TextureFormat::BC7RGBAUnorm";
1332 break;
1333 case TextureFormat::BC7RGBAUnormSrgb:
1334 o << "TextureFormat::BC7RGBAUnormSrgb";
1335 break;
1336 case TextureFormat::ETC2RGB8Unorm:
1337 o << "TextureFormat::ETC2RGB8Unorm";
1338 break;
1339 case TextureFormat::ETC2RGB8UnormSrgb:
1340 o << "TextureFormat::ETC2RGB8UnormSrgb";
1341 break;
1342 case TextureFormat::ETC2RGB8A1Unorm:
1343 o << "TextureFormat::ETC2RGB8A1Unorm";
1344 break;
1345 case TextureFormat::ETC2RGB8A1UnormSrgb:
1346 o << "TextureFormat::ETC2RGB8A1UnormSrgb";
1347 break;
1348 case TextureFormat::ETC2RGBA8Unorm:
1349 o << "TextureFormat::ETC2RGBA8Unorm";
1350 break;
1351 case TextureFormat::ETC2RGBA8UnormSrgb:
1352 o << "TextureFormat::ETC2RGBA8UnormSrgb";
1353 break;
1354 case TextureFormat::EACR11Unorm:
1355 o << "TextureFormat::EACR11Unorm";
1356 break;
1357 case TextureFormat::EACR11Snorm:
1358 o << "TextureFormat::EACR11Snorm";
1359 break;
1360 case TextureFormat::EACRG11Unorm:
1361 o << "TextureFormat::EACRG11Unorm";
1362 break;
1363 case TextureFormat::EACRG11Snorm:
1364 o << "TextureFormat::EACRG11Snorm";
1365 break;
1366 case TextureFormat::ASTC4x4Unorm:
1367 o << "TextureFormat::ASTC4x4Unorm";
1368 break;
1369 case TextureFormat::ASTC4x4UnormSrgb:
1370 o << "TextureFormat::ASTC4x4UnormSrgb";
1371 break;
1372 case TextureFormat::ASTC5x4Unorm:
1373 o << "TextureFormat::ASTC5x4Unorm";
1374 break;
1375 case TextureFormat::ASTC5x4UnormSrgb:
1376 o << "TextureFormat::ASTC5x4UnormSrgb";
1377 break;
1378 case TextureFormat::ASTC5x5Unorm:
1379 o << "TextureFormat::ASTC5x5Unorm";
1380 break;
1381 case TextureFormat::ASTC5x5UnormSrgb:
1382 o << "TextureFormat::ASTC5x5UnormSrgb";
1383 break;
1384 case TextureFormat::ASTC6x5Unorm:
1385 o << "TextureFormat::ASTC6x5Unorm";
1386 break;
1387 case TextureFormat::ASTC6x5UnormSrgb:
1388 o << "TextureFormat::ASTC6x5UnormSrgb";
1389 break;
1390 case TextureFormat::ASTC6x6Unorm:
1391 o << "TextureFormat::ASTC6x6Unorm";
1392 break;
1393 case TextureFormat::ASTC6x6UnormSrgb:
1394 o << "TextureFormat::ASTC6x6UnormSrgb";
1395 break;
1396 case TextureFormat::ASTC8x5Unorm:
1397 o << "TextureFormat::ASTC8x5Unorm";
1398 break;
1399 case TextureFormat::ASTC8x5UnormSrgb:
1400 o << "TextureFormat::ASTC8x5UnormSrgb";
1401 break;
1402 case TextureFormat::ASTC8x6Unorm:
1403 o << "TextureFormat::ASTC8x6Unorm";
1404 break;
1405 case TextureFormat::ASTC8x6UnormSrgb:
1406 o << "TextureFormat::ASTC8x6UnormSrgb";
1407 break;
1408 case TextureFormat::ASTC8x8Unorm:
1409 o << "TextureFormat::ASTC8x8Unorm";
1410 break;
1411 case TextureFormat::ASTC8x8UnormSrgb:
1412 o << "TextureFormat::ASTC8x8UnormSrgb";
1413 break;
1414 case TextureFormat::ASTC10x5Unorm:
1415 o << "TextureFormat::ASTC10x5Unorm";
1416 break;
1417 case TextureFormat::ASTC10x5UnormSrgb:
1418 o << "TextureFormat::ASTC10x5UnormSrgb";
1419 break;
1420 case TextureFormat::ASTC10x6Unorm:
1421 o << "TextureFormat::ASTC10x6Unorm";
1422 break;
1423 case TextureFormat::ASTC10x6UnormSrgb:
1424 o << "TextureFormat::ASTC10x6UnormSrgb";
1425 break;
1426 case TextureFormat::ASTC10x8Unorm:
1427 o << "TextureFormat::ASTC10x8Unorm";
1428 break;
1429 case TextureFormat::ASTC10x8UnormSrgb:
1430 o << "TextureFormat::ASTC10x8UnormSrgb";
1431 break;
1432 case TextureFormat::ASTC10x10Unorm:
1433 o << "TextureFormat::ASTC10x10Unorm";
1434 break;
1435 case TextureFormat::ASTC10x10UnormSrgb:
1436 o << "TextureFormat::ASTC10x10UnormSrgb";
1437 break;
1438 case TextureFormat::ASTC12x10Unorm:
1439 o << "TextureFormat::ASTC12x10Unorm";
1440 break;
1441 case TextureFormat::ASTC12x10UnormSrgb:
1442 o << "TextureFormat::ASTC12x10UnormSrgb";
1443 break;
1444 case TextureFormat::ASTC12x12Unorm:
1445 o << "TextureFormat::ASTC12x12Unorm";
1446 break;
1447 case TextureFormat::ASTC12x12UnormSrgb:
1448 o << "TextureFormat::ASTC12x12UnormSrgb";
1449 break;
1450 case TextureFormat::R8BG8Biplanar420Unorm:
1451 o << "TextureFormat::R8BG8Biplanar420Unorm";
1452 break;
1453 default:
1454 o << "TextureFormat::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<TextureFormat>::type>(value);
1455 }
1456 return o;
1457 }
1458 template <typename CharT, typename Traits>
1459 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, TextureSampleType value) {
1460 switch (value) {
1461 case TextureSampleType::Undefined:
1462 o << "TextureSampleType::Undefined";
1463 break;
1464 case TextureSampleType::Float:
1465 o << "TextureSampleType::Float";
1466 break;
1467 case TextureSampleType::UnfilterableFloat:
1468 o << "TextureSampleType::UnfilterableFloat";
1469 break;
1470 case TextureSampleType::Depth:
1471 o << "TextureSampleType::Depth";
1472 break;
1473 case TextureSampleType::Sint:
1474 o << "TextureSampleType::Sint";
1475 break;
1476 case TextureSampleType::Uint:
1477 o << "TextureSampleType::Uint";
1478 break;
1479 default:
1480 o << "TextureSampleType::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<TextureSampleType>::type>(value);
1481 }
1482 return o;
1483 }
1484 template <typename CharT, typename Traits>
1485 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, TextureViewDimension value) {
1486 switch (value) {
1487 case TextureViewDimension::Undefined:
1488 o << "TextureViewDimension::Undefined";
1489 break;
1490 case TextureViewDimension::e1D:
1491 o << "TextureViewDimension::e1D";
1492 break;
1493 case TextureViewDimension::e2D:
1494 o << "TextureViewDimension::e2D";
1495 break;
1496 case TextureViewDimension::e2DArray:
1497 o << "TextureViewDimension::e2DArray";
1498 break;
1499 case TextureViewDimension::Cube:
1500 o << "TextureViewDimension::Cube";
1501 break;
1502 case TextureViewDimension::CubeArray:
1503 o << "TextureViewDimension::CubeArray";
1504 break;
1505 case TextureViewDimension::e3D:
1506 o << "TextureViewDimension::e3D";
1507 break;
1508 default:
1509 o << "TextureViewDimension::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<TextureViewDimension>::type>(value);
1510 }
1511 return o;
1512 }
1513 template <typename CharT, typename Traits>
1514 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, VertexFormat value) {
1515 switch (value) {
1516 case VertexFormat::Undefined:
1517 o << "VertexFormat::Undefined";
1518 break;
1519 case VertexFormat::Uint8x2:
1520 o << "VertexFormat::Uint8x2";
1521 break;
1522 case VertexFormat::Uint8x4:
1523 o << "VertexFormat::Uint8x4";
1524 break;
1525 case VertexFormat::Sint8x2:
1526 o << "VertexFormat::Sint8x2";
1527 break;
1528 case VertexFormat::Sint8x4:
1529 o << "VertexFormat::Sint8x4";
1530 break;
1531 case VertexFormat::Unorm8x2:
1532 o << "VertexFormat::Unorm8x2";
1533 break;
1534 case VertexFormat::Unorm8x4:
1535 o << "VertexFormat::Unorm8x4";
1536 break;
1537 case VertexFormat::Snorm8x2:
1538 o << "VertexFormat::Snorm8x2";
1539 break;
1540 case VertexFormat::Snorm8x4:
1541 o << "VertexFormat::Snorm8x4";
1542 break;
1543 case VertexFormat::Uint16x2:
1544 o << "VertexFormat::Uint16x2";
1545 break;
1546 case VertexFormat::Uint16x4:
1547 o << "VertexFormat::Uint16x4";
1548 break;
1549 case VertexFormat::Sint16x2:
1550 o << "VertexFormat::Sint16x2";
1551 break;
1552 case VertexFormat::Sint16x4:
1553 o << "VertexFormat::Sint16x4";
1554 break;
1555 case VertexFormat::Unorm16x2:
1556 o << "VertexFormat::Unorm16x2";
1557 break;
1558 case VertexFormat::Unorm16x4:
1559 o << "VertexFormat::Unorm16x4";
1560 break;
1561 case VertexFormat::Snorm16x2:
1562 o << "VertexFormat::Snorm16x2";
1563 break;
1564 case VertexFormat::Snorm16x4:
1565 o << "VertexFormat::Snorm16x4";
1566 break;
1567 case VertexFormat::Float16x2:
1568 o << "VertexFormat::Float16x2";
1569 break;
1570 case VertexFormat::Float16x4:
1571 o << "VertexFormat::Float16x4";
1572 break;
1573 case VertexFormat::Float32:
1574 o << "VertexFormat::Float32";
1575 break;
1576 case VertexFormat::Float32x2:
1577 o << "VertexFormat::Float32x2";
1578 break;
1579 case VertexFormat::Float32x3:
1580 o << "VertexFormat::Float32x3";
1581 break;
1582 case VertexFormat::Float32x4:
1583 o << "VertexFormat::Float32x4";
1584 break;
1585 case VertexFormat::Uint32:
1586 o << "VertexFormat::Uint32";
1587 break;
1588 case VertexFormat::Uint32x2:
1589 o << "VertexFormat::Uint32x2";
1590 break;
1591 case VertexFormat::Uint32x3:
1592 o << "VertexFormat::Uint32x3";
1593 break;
1594 case VertexFormat::Uint32x4:
1595 o << "VertexFormat::Uint32x4";
1596 break;
1597 case VertexFormat::Sint32:
1598 o << "VertexFormat::Sint32";
1599 break;
1600 case VertexFormat::Sint32x2:
1601 o << "VertexFormat::Sint32x2";
1602 break;
1603 case VertexFormat::Sint32x3:
1604 o << "VertexFormat::Sint32x3";
1605 break;
1606 case VertexFormat::Sint32x4:
1607 o << "VertexFormat::Sint32x4";
1608 break;
1609 default:
1610 o << "VertexFormat::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<VertexFormat>::type>(value);
1611 }
1612 return o;
1613 }
1614 template <typename CharT, typename Traits>
1615 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, VertexStepMode value) {
1616 switch (value) {
1617 case VertexStepMode::Vertex:
1618 o << "VertexStepMode::Vertex";
1619 break;
1620 case VertexStepMode::Instance:
1621 o << "VertexStepMode::Instance";
1622 break;
1623 case VertexStepMode::VertexBufferNotUsed:
1624 o << "VertexStepMode::VertexBufferNotUsed";
1625 break;
1626 default:
1627 o << "VertexStepMode::" << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<VertexStepMode>::type>(value);
1628 }
1629 return o;
1630 }
1631
1632 template <typename CharT, typename Traits>
1633 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, BufferUsage value) {
1634 o << "BufferUsage::";
1635 if (!static_cast<bool>(value)) {
1636 // 0 is often explicitly declared as None.
1637 o << "None";
1638 return o;
1639 }
1640
1641 bool moreThanOneBit = !HasZeroOrOneBits(value);
1642 if (moreThanOneBit) {
1643 o << "(";
1644 }
1645
1646 bool first = true;
1647 if (value & BufferUsage::MapRead) {
1648 if (!first) {
1649 o << "|";
1650 }
1651 first = false;
1652 o << "MapRead";
1653 value &= ~BufferUsage::MapRead;
1654 }
1655 if (value & BufferUsage::MapWrite) {
1656 if (!first) {
1657 o << "|";
1658 }
1659 first = false;
1660 o << "MapWrite";
1661 value &= ~BufferUsage::MapWrite;
1662 }
1663 if (value & BufferUsage::CopySrc) {
1664 if (!first) {
1665 o << "|";
1666 }
1667 first = false;
1668 o << "CopySrc";
1669 value &= ~BufferUsage::CopySrc;
1670 }
1671 if (value & BufferUsage::CopyDst) {
1672 if (!first) {
1673 o << "|";
1674 }
1675 first = false;
1676 o << "CopyDst";
1677 value &= ~BufferUsage::CopyDst;
1678 }
1679 if (value & BufferUsage::Index) {
1680 if (!first) {
1681 o << "|";
1682 }
1683 first = false;
1684 o << "Index";
1685 value &= ~BufferUsage::Index;
1686 }
1687 if (value & BufferUsage::Vertex) {
1688 if (!first) {
1689 o << "|";
1690 }
1691 first = false;
1692 o << "Vertex";
1693 value &= ~BufferUsage::Vertex;
1694 }
1695 if (value & BufferUsage::Uniform) {
1696 if (!first) {
1697 o << "|";
1698 }
1699 first = false;
1700 o << "Uniform";
1701 value &= ~BufferUsage::Uniform;
1702 }
1703 if (value & BufferUsage::Storage) {
1704 if (!first) {
1705 o << "|";
1706 }
1707 first = false;
1708 o << "Storage";
1709 value &= ~BufferUsage::Storage;
1710 }
1711 if (value & BufferUsage::Indirect) {
1712 if (!first) {
1713 o << "|";
1714 }
1715 first = false;
1716 o << "Indirect";
1717 value &= ~BufferUsage::Indirect;
1718 }
1719 if (value & BufferUsage::QueryResolve) {
1720 if (!first) {
1721 o << "|";
1722 }
1723 first = false;
1724 o << "QueryResolve";
1725 value &= ~BufferUsage::QueryResolve;
1726 }
1727
1728 if (static_cast<bool>(value)) {
1729 if (!first) {
1730 o << "|";
1731 }
1732 o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<BufferUsage>::type>(value);
1733 }
1734
1735 if (moreThanOneBit) {
1736 o << ")";
1737 }
1738 return o;
1739 }
1740 template <typename CharT, typename Traits>
1741 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, ColorWriteMask value) {
1742 o << "ColorWriteMask::";
1743 if (!static_cast<bool>(value)) {
1744 // 0 is often explicitly declared as None.
1745 o << "None";
1746 return o;
1747 }
1748
1749 bool moreThanOneBit = !HasZeroOrOneBits(value);
1750 if (moreThanOneBit) {
1751 o << "(";
1752 }
1753
1754 bool first = true;
1755 if (value & ColorWriteMask::Red) {
1756 if (!first) {
1757 o << "|";
1758 }
1759 first = false;
1760 o << "Red";
1761 value &= ~ColorWriteMask::Red;
1762 }
1763 if (value & ColorWriteMask::Green) {
1764 if (!first) {
1765 o << "|";
1766 }
1767 first = false;
1768 o << "Green";
1769 value &= ~ColorWriteMask::Green;
1770 }
1771 if (value & ColorWriteMask::Blue) {
1772 if (!first) {
1773 o << "|";
1774 }
1775 first = false;
1776 o << "Blue";
1777 value &= ~ColorWriteMask::Blue;
1778 }
1779 if (value & ColorWriteMask::Alpha) {
1780 if (!first) {
1781 o << "|";
1782 }
1783 first = false;
1784 o << "Alpha";
1785 value &= ~ColorWriteMask::Alpha;
1786 }
1787 if (value & ColorWriteMask::All) {
1788 if (!first) {
1789 o << "|";
1790 }
1791 first = false;
1792 o << "All";
1793 value &= ~ColorWriteMask::All;
1794 }
1795
1796 if (static_cast<bool>(value)) {
1797 if (!first) {
1798 o << "|";
1799 }
1800 o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<ColorWriteMask>::type>(value);
1801 }
1802
1803 if (moreThanOneBit) {
1804 o << ")";
1805 }
1806 return o;
1807 }
1808 template <typename CharT, typename Traits>
1809 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, MapMode value) {
1810 o << "MapMode::";
1811 if (!static_cast<bool>(value)) {
1812 // 0 is often explicitly declared as None.
1813 o << "None";
1814 return o;
1815 }
1816
1817 bool moreThanOneBit = !HasZeroOrOneBits(value);
1818 if (moreThanOneBit) {
1819 o << "(";
1820 }
1821
1822 bool first = true;
1823 if (value & MapMode::Read) {
1824 if (!first) {
1825 o << "|";
1826 }
1827 first = false;
1828 o << "Read";
1829 value &= ~MapMode::Read;
1830 }
1831 if (value & MapMode::Write) {
1832 if (!first) {
1833 o << "|";
1834 }
1835 first = false;
1836 o << "Write";
1837 value &= ~MapMode::Write;
1838 }
1839
1840 if (static_cast<bool>(value)) {
1841 if (!first) {
1842 o << "|";
1843 }
1844 o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<MapMode>::type>(value);
1845 }
1846
1847 if (moreThanOneBit) {
1848 o << ")";
1849 }
1850 return o;
1851 }
1852 template <typename CharT, typename Traits>
1853 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, ShaderStage value) {
1854 o << "ShaderStage::";
1855 if (!static_cast<bool>(value)) {
1856 // 0 is often explicitly declared as None.
1857 o << "None";
1858 return o;
1859 }
1860
1861 bool moreThanOneBit = !HasZeroOrOneBits(value);
1862 if (moreThanOneBit) {
1863 o << "(";
1864 }
1865
1866 bool first = true;
1867 if (value & ShaderStage::Vertex) {
1868 if (!first) {
1869 o << "|";
1870 }
1871 first = false;
1872 o << "Vertex";
1873 value &= ~ShaderStage::Vertex;
1874 }
1875 if (value & ShaderStage::Fragment) {
1876 if (!first) {
1877 o << "|";
1878 }
1879 first = false;
1880 o << "Fragment";
1881 value &= ~ShaderStage::Fragment;
1882 }
1883 if (value & ShaderStage::Compute) {
1884 if (!first) {
1885 o << "|";
1886 }
1887 first = false;
1888 o << "Compute";
1889 value &= ~ShaderStage::Compute;
1890 }
1891
1892 if (static_cast<bool>(value)) {
1893 if (!first) {
1894 o << "|";
1895 }
1896 o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<ShaderStage>::type>(value);
1897 }
1898
1899 if (moreThanOneBit) {
1900 o << ")";
1901 }
1902 return o;
1903 }
1904 template <typename CharT, typename Traits>
1905 std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& o, TextureUsage value) {
1906 o << "TextureUsage::";
1907 if (!static_cast<bool>(value)) {
1908 // 0 is often explicitly declared as None.
1909 o << "None";
1910 return o;
1911 }
1912
1913 bool moreThanOneBit = !HasZeroOrOneBits(value);
1914 if (moreThanOneBit) {
1915 o << "(";
1916 }
1917
1918 bool first = true;
1919 if (value & TextureUsage::CopySrc) {
1920 if (!first) {
1921 o << "|";
1922 }
1923 first = false;
1924 o << "CopySrc";
1925 value &= ~TextureUsage::CopySrc;
1926 }
1927 if (value & TextureUsage::CopyDst) {
1928 if (!first) {
1929 o << "|";
1930 }
1931 first = false;
1932 o << "CopyDst";
1933 value &= ~TextureUsage::CopyDst;
1934 }
1935 if (value & TextureUsage::TextureBinding) {
1936 if (!first) {
1937 o << "|";
1938 }
1939 first = false;
1940 o << "TextureBinding";
1941 value &= ~TextureUsage::TextureBinding;
1942 }
1943 if (value & TextureUsage::StorageBinding) {
1944 if (!first) {
1945 o << "|";
1946 }
1947 first = false;
1948 o << "StorageBinding";
1949 value &= ~TextureUsage::StorageBinding;
1950 }
1951 if (value & TextureUsage::RenderAttachment) {
1952 if (!first) {
1953 o << "|";
1954 }
1955 first = false;
1956 o << "RenderAttachment";
1957 value &= ~TextureUsage::RenderAttachment;
1958 }
1959 if (value & TextureUsage::TransientAttachment) {
1960 if (!first) {
1961 o << "|";
1962 }
1963 first = false;
1964 o << "TransientAttachment";
1965 value &= ~TextureUsage::TransientAttachment;
1966 }
1967
1968 if (static_cast<bool>(value)) {
1969 if (!first) {
1970 o << "|";
1971 }
1972 o << std::showbase << std::hex << std::setfill('0') << std::setw(4) << static_cast<typename std::underlying_type<TextureUsage>::type>(value);
1973 }
1974
1975 if (moreThanOneBit) {
1976 o << ")";
1977 }
1978 return o;
1979 }
1980
1981} // namespace wgpu
1982
1983#endif // WEBGPU_CPP_PRINT_H_