1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by gen_packed_gl_enums.py using data from packed_cl_enums.json.
3 //
4 // Copyright 2017 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // PackedCLEnums_autogen.cpp:
9 //   Implements ANGLE-specific enums classes for CLenums and functions operating
10 //   on them.
11 
12 #include "common/PackedCLEnums_autogen.h"
13 #include "common/debug.h"
14 
15 namespace cl
16 {
17 
18 template <>
FromCLenum(CLenum from)19 AddressingMode FromCLenum<AddressingMode>(CLenum from)
20 {
21     switch (from)
22     {
23         case CL_ADDRESS_NONE:
24             return AddressingMode::None;
25         case CL_ADDRESS_CLAMP_TO_EDGE:
26             return AddressingMode::ClampToEdge;
27         case CL_ADDRESS_CLAMP:
28             return AddressingMode::Clamp;
29         case CL_ADDRESS_REPEAT:
30             return AddressingMode::Repeat;
31         case CL_ADDRESS_MIRRORED_REPEAT:
32             return AddressingMode::MirroredRepeat;
33         default:
34             return AddressingMode::InvalidEnum;
35     }
36 }
37 
ToCLenum(AddressingMode from)38 CLenum ToCLenum(AddressingMode from)
39 {
40     switch (from)
41     {
42         case AddressingMode::None:
43             return CL_ADDRESS_NONE;
44         case AddressingMode::ClampToEdge:
45             return CL_ADDRESS_CLAMP_TO_EDGE;
46         case AddressingMode::Clamp:
47             return CL_ADDRESS_CLAMP;
48         case AddressingMode::Repeat:
49             return CL_ADDRESS_REPEAT;
50         case AddressingMode::MirroredRepeat:
51             return CL_ADDRESS_MIRRORED_REPEAT;
52         default:
53             UNREACHABLE();
54             return 0;
55     }
56 }
57 
operator <<(std::ostream & os,AddressingMode value)58 std::ostream &operator<<(std::ostream &os, AddressingMode value)
59 {
60     switch (value)
61     {
62         case AddressingMode::None:
63             os << "CL_ADDRESS_NONE";
64             break;
65         case AddressingMode::ClampToEdge:
66             os << "CL_ADDRESS_CLAMP_TO_EDGE";
67             break;
68         case AddressingMode::Clamp:
69             os << "CL_ADDRESS_CLAMP";
70             break;
71         case AddressingMode::Repeat:
72             os << "CL_ADDRESS_REPEAT";
73             break;
74         case AddressingMode::MirroredRepeat:
75             os << "CL_ADDRESS_MIRRORED_REPEAT";
76             break;
77         default:
78             os << "GL_INVALID_ENUM";
79             break;
80     }
81     return os;
82 }
83 
84 template <>
FromCLenum(CLenum from)85 CommandQueueInfo FromCLenum<CommandQueueInfo>(CLenum from)
86 {
87     switch (from)
88     {
89         case CL_QUEUE_CONTEXT:
90             return CommandQueueInfo::Context;
91         case CL_QUEUE_DEVICE:
92             return CommandQueueInfo::Device;
93         case CL_QUEUE_REFERENCE_COUNT:
94             return CommandQueueInfo::ReferenceCount;
95         case CL_QUEUE_PROPERTIES:
96             return CommandQueueInfo::Properties;
97         case CL_QUEUE_SIZE:
98             return CommandQueueInfo::Size;
99         case CL_QUEUE_DEVICE_DEFAULT:
100             return CommandQueueInfo::DeviceDefault;
101         case CL_QUEUE_PROPERTIES_ARRAY:
102             return CommandQueueInfo::PropertiesArray;
103         default:
104             return CommandQueueInfo::InvalidEnum;
105     }
106 }
107 
ToCLenum(CommandQueueInfo from)108 CLenum ToCLenum(CommandQueueInfo from)
109 {
110     switch (from)
111     {
112         case CommandQueueInfo::Context:
113             return CL_QUEUE_CONTEXT;
114         case CommandQueueInfo::Device:
115             return CL_QUEUE_DEVICE;
116         case CommandQueueInfo::ReferenceCount:
117             return CL_QUEUE_REFERENCE_COUNT;
118         case CommandQueueInfo::Properties:
119             return CL_QUEUE_PROPERTIES;
120         case CommandQueueInfo::Size:
121             return CL_QUEUE_SIZE;
122         case CommandQueueInfo::DeviceDefault:
123             return CL_QUEUE_DEVICE_DEFAULT;
124         case CommandQueueInfo::PropertiesArray:
125             return CL_QUEUE_PROPERTIES_ARRAY;
126         default:
127             UNREACHABLE();
128             return 0;
129     }
130 }
131 
operator <<(std::ostream & os,CommandQueueInfo value)132 std::ostream &operator<<(std::ostream &os, CommandQueueInfo value)
133 {
134     switch (value)
135     {
136         case CommandQueueInfo::Context:
137             os << "CL_QUEUE_CONTEXT";
138             break;
139         case CommandQueueInfo::Device:
140             os << "CL_QUEUE_DEVICE";
141             break;
142         case CommandQueueInfo::ReferenceCount:
143             os << "CL_QUEUE_REFERENCE_COUNT";
144             break;
145         case CommandQueueInfo::Properties:
146             os << "CL_QUEUE_PROPERTIES";
147             break;
148         case CommandQueueInfo::Size:
149             os << "CL_QUEUE_SIZE";
150             break;
151         case CommandQueueInfo::DeviceDefault:
152             os << "CL_QUEUE_DEVICE_DEFAULT";
153             break;
154         case CommandQueueInfo::PropertiesArray:
155             os << "CL_QUEUE_PROPERTIES_ARRAY";
156             break;
157         default:
158             os << "GL_INVALID_ENUM";
159             break;
160     }
161     return os;
162 }
163 
164 template <>
FromCLenum(CLenum from)165 ContextInfo FromCLenum<ContextInfo>(CLenum from)
166 {
167     switch (from)
168     {
169         case CL_CONTEXT_REFERENCE_COUNT:
170             return ContextInfo::ReferenceCount;
171         case CL_CONTEXT_DEVICES:
172             return ContextInfo::Devices;
173         case CL_CONTEXT_PROPERTIES:
174             return ContextInfo::Properties;
175         case CL_CONTEXT_NUM_DEVICES:
176             return ContextInfo::NumDevices;
177         default:
178             return ContextInfo::InvalidEnum;
179     }
180 }
181 
ToCLenum(ContextInfo from)182 CLenum ToCLenum(ContextInfo from)
183 {
184     switch (from)
185     {
186         case ContextInfo::ReferenceCount:
187             return CL_CONTEXT_REFERENCE_COUNT;
188         case ContextInfo::Devices:
189             return CL_CONTEXT_DEVICES;
190         case ContextInfo::Properties:
191             return CL_CONTEXT_PROPERTIES;
192         case ContextInfo::NumDevices:
193             return CL_CONTEXT_NUM_DEVICES;
194         default:
195             UNREACHABLE();
196             return 0;
197     }
198 }
199 
operator <<(std::ostream & os,ContextInfo value)200 std::ostream &operator<<(std::ostream &os, ContextInfo value)
201 {
202     switch (value)
203     {
204         case ContextInfo::ReferenceCount:
205             os << "CL_CONTEXT_REFERENCE_COUNT";
206             break;
207         case ContextInfo::Devices:
208             os << "CL_CONTEXT_DEVICES";
209             break;
210         case ContextInfo::Properties:
211             os << "CL_CONTEXT_PROPERTIES";
212             break;
213         case ContextInfo::NumDevices:
214             os << "CL_CONTEXT_NUM_DEVICES";
215             break;
216         default:
217             os << "GL_INVALID_ENUM";
218             break;
219     }
220     return os;
221 }
222 
223 template <>
FromCLenum(CLenum from)224 DeviceInfo FromCLenum<DeviceInfo>(CLenum from)
225 {
226     switch (from)
227     {
228         case CL_DEVICE_TYPE:
229             return DeviceInfo::Type;
230         case CL_DEVICE_VENDOR_ID:
231             return DeviceInfo::VendorID;
232         case CL_DEVICE_MAX_COMPUTE_UNITS:
233             return DeviceInfo::MaxComputeUnits;
234         case CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS:
235             return DeviceInfo::MaxWorkItemDimensions;
236         case CL_DEVICE_MAX_WORK_GROUP_SIZE:
237             return DeviceInfo::MaxWorkGroupSize;
238         case CL_DEVICE_MAX_WORK_ITEM_SIZES:
239             return DeviceInfo::MaxWorkItemSizes;
240         case CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR:
241             return DeviceInfo::PreferredVectorWidthChar;
242         case CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT:
243             return DeviceInfo::PreferredVectorWidthShort;
244         case CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT:
245             return DeviceInfo::PreferredVectorWidthInt;
246         case CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG:
247             return DeviceInfo::PreferredVectorWidthLong;
248         case CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT:
249             return DeviceInfo::PreferredVectorWidthFloat;
250         case CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE:
251             return DeviceInfo::PreferredVectorWidthDouble;
252         case CL_DEVICE_MAX_CLOCK_FREQUENCY:
253             return DeviceInfo::MaxClockFrequency;
254         case CL_DEVICE_ADDRESS_BITS:
255             return DeviceInfo::AddressBits;
256         case CL_DEVICE_MAX_READ_IMAGE_ARGS:
257             return DeviceInfo::MaxReadImageArgs;
258         case CL_DEVICE_MAX_WRITE_IMAGE_ARGS:
259             return DeviceInfo::MaxWriteImageArgs;
260         case CL_DEVICE_MAX_MEM_ALLOC_SIZE:
261             return DeviceInfo::MaxMemAllocSize;
262         case CL_DEVICE_IMAGE2D_MAX_WIDTH:
263             return DeviceInfo::Image2D_MaxWidth;
264         case CL_DEVICE_IMAGE2D_MAX_HEIGHT:
265             return DeviceInfo::Image2D_MaxHeight;
266         case CL_DEVICE_IMAGE3D_MAX_WIDTH:
267             return DeviceInfo::Image3D_MaxWidth;
268         case CL_DEVICE_IMAGE3D_MAX_HEIGHT:
269             return DeviceInfo::Image3D_MaxHeight;
270         case CL_DEVICE_IMAGE3D_MAX_DEPTH:
271             return DeviceInfo::Image3D_MaxDepth;
272         case CL_DEVICE_IMAGE_SUPPORT:
273             return DeviceInfo::ImageSupport;
274         case CL_DEVICE_MAX_PARAMETER_SIZE:
275             return DeviceInfo::MaxParameterSize;
276         case CL_DEVICE_MAX_SAMPLERS:
277             return DeviceInfo::MaxSamplers;
278         case CL_DEVICE_MEM_BASE_ADDR_ALIGN:
279             return DeviceInfo::MemBaseAddrAlign;
280         case CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE:
281             return DeviceInfo::MinDataTypeAlignSize;
282         case CL_DEVICE_SINGLE_FP_CONFIG:
283             return DeviceInfo::SingleFpConfig;
284         case CL_DEVICE_GLOBAL_MEM_CACHE_TYPE:
285             return DeviceInfo::GlobalMemCacheType;
286         case CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE:
287             return DeviceInfo::GlobalMemCachelineSize;
288         case CL_DEVICE_GLOBAL_MEM_CACHE_SIZE:
289             return DeviceInfo::GlobalMemCacheSize;
290         case CL_DEVICE_GLOBAL_MEM_SIZE:
291             return DeviceInfo::GlobalMemSize;
292         case CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE:
293             return DeviceInfo::MaxConstantBufferSize;
294         case CL_DEVICE_MAX_CONSTANT_ARGS:
295             return DeviceInfo::MaxConstantArgs;
296         case CL_DEVICE_LOCAL_MEM_TYPE:
297             return DeviceInfo::LocalMemType;
298         case CL_DEVICE_LOCAL_MEM_SIZE:
299             return DeviceInfo::LocalMemSize;
300         case CL_DEVICE_ERROR_CORRECTION_SUPPORT:
301             return DeviceInfo::ErrorCorrectionSupport;
302         case CL_DEVICE_PROFILING_TIMER_RESOLUTION:
303             return DeviceInfo::ProfilingTimerResolution;
304         case CL_DEVICE_ENDIAN_LITTLE:
305             return DeviceInfo::EndianLittle;
306         case CL_DEVICE_AVAILABLE:
307             return DeviceInfo::Available;
308         case CL_DEVICE_COMPILER_AVAILABLE:
309             return DeviceInfo::CompilerAvailable;
310         case CL_DEVICE_EXECUTION_CAPABILITIES:
311             return DeviceInfo::ExecutionCapabilities;
312         case CL_DEVICE_QUEUE_ON_HOST_PROPERTIES:
313             return DeviceInfo::QueueOnHostProperties;
314         case CL_DEVICE_NAME:
315             return DeviceInfo::Name;
316         case CL_DEVICE_VENDOR:
317             return DeviceInfo::Vendor;
318         case CL_DRIVER_VERSION:
319             return DeviceInfo::DriverVersion;
320         case CL_DEVICE_PROFILE:
321             return DeviceInfo::Profile;
322         case CL_DEVICE_VERSION:
323             return DeviceInfo::Version;
324         case CL_DEVICE_EXTENSIONS:
325             return DeviceInfo::Extensions;
326         case CL_DEVICE_PLATFORM:
327             return DeviceInfo::Platform;
328         case CL_DEVICE_DOUBLE_FP_CONFIG:
329             return DeviceInfo::DoubleFpConfig;
330         case CL_DEVICE_HALF_FP_CONFIG:
331             return DeviceInfo::HalfFpConfig;
332         case CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF:
333             return DeviceInfo::PreferredVectorWidthHalf;
334         case CL_DEVICE_HOST_UNIFIED_MEMORY:
335             return DeviceInfo::HostUnifiedMemory;
336         case CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR:
337             return DeviceInfo::NativeVectorWidthChar;
338         case CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT:
339             return DeviceInfo::NativeVectorWidthShort;
340         case CL_DEVICE_NATIVE_VECTOR_WIDTH_INT:
341             return DeviceInfo::NativeVectorWidthInt;
342         case CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG:
343             return DeviceInfo::NativeVectorWidthLong;
344         case CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT:
345             return DeviceInfo::NativeVectorWidthFloat;
346         case CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE:
347             return DeviceInfo::NativeVectorWidthDouble;
348         case CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF:
349             return DeviceInfo::NativeVectorWidthHalf;
350         case CL_DEVICE_OPENCL_C_VERSION:
351             return DeviceInfo::OpenCL_C_Version;
352         case CL_DEVICE_LINKER_AVAILABLE:
353             return DeviceInfo::LinkerAvailable;
354         case CL_DEVICE_BUILT_IN_KERNELS:
355             return DeviceInfo::BuiltInKernels;
356         case CL_DEVICE_IMAGE_MAX_BUFFER_SIZE:
357             return DeviceInfo::ImageMaxBufferSize;
358         case CL_DEVICE_IMAGE_MAX_ARRAY_SIZE:
359             return DeviceInfo::ImageMaxArraySize;
360         case CL_DEVICE_PARENT_DEVICE:
361             return DeviceInfo::ParentDevice;
362         case CL_DEVICE_PARTITION_MAX_SUB_DEVICES:
363             return DeviceInfo::PartitionMaxSubDevices;
364         case CL_DEVICE_PARTITION_PROPERTIES:
365             return DeviceInfo::PartitionProperties;
366         case CL_DEVICE_PARTITION_AFFINITY_DOMAIN:
367             return DeviceInfo::PartitionAffinityDomain;
368         case CL_DEVICE_PARTITION_TYPE:
369             return DeviceInfo::PartitionType;
370         case CL_DEVICE_REFERENCE_COUNT:
371             return DeviceInfo::ReferenceCount;
372         case CL_DEVICE_PREFERRED_INTEROP_USER_SYNC:
373             return DeviceInfo::PreferredInteropUserSync;
374         case CL_DEVICE_PRINTF_BUFFER_SIZE:
375             return DeviceInfo::PrintfBufferSize;
376         case CL_DEVICE_IMAGE_PITCH_ALIGNMENT:
377             return DeviceInfo::ImagePitchAlignment;
378         case CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT:
379             return DeviceInfo::ImageBaseAddressAlignment;
380         case CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS:
381             return DeviceInfo::MaxReadWriteImageArgs;
382         case CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE:
383             return DeviceInfo::MaxGlobalVariableSize;
384         case CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES:
385             return DeviceInfo::QueueOnDeviceProperties;
386         case CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE:
387             return DeviceInfo::QueueOnDevicePreferredSize;
388         case CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE:
389             return DeviceInfo::QueueOnDeviceMaxSize;
390         case CL_DEVICE_MAX_ON_DEVICE_QUEUES:
391             return DeviceInfo::MaxOnDeviceQueues;
392         case CL_DEVICE_MAX_ON_DEVICE_EVENTS:
393             return DeviceInfo::MaxOnDeviceEvents;
394         case CL_DEVICE_SVM_CAPABILITIES:
395             return DeviceInfo::SVM_Capabilities;
396         case CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE:
397             return DeviceInfo::GlobalVariablePreferredTotalSize;
398         case CL_DEVICE_MAX_PIPE_ARGS:
399             return DeviceInfo::MaxPipeArgs;
400         case CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS:
401             return DeviceInfo::PipeMaxActiveReservations;
402         case CL_DEVICE_PIPE_MAX_PACKET_SIZE:
403             return DeviceInfo::PipeMaxPacketSize;
404         case CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT:
405             return DeviceInfo::PreferredPlatformAtomicAlignment;
406         case CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT:
407             return DeviceInfo::PreferredGlobalAtomicAlignment;
408         case CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT:
409             return DeviceInfo::PreferredLocalAtomicAlignment;
410         case CL_DEVICE_IL_VERSION:
411             return DeviceInfo::IL_Version;
412         case CL_DEVICE_MAX_NUM_SUB_GROUPS:
413             return DeviceInfo::MaxNumSubGroups;
414         case CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS:
415             return DeviceInfo::SubGroupIndependentForwardProgress;
416         case CL_DEVICE_NUMERIC_VERSION:
417             return DeviceInfo::NumericVersion;
418         case CL_DEVICE_EXTENSIONS_WITH_VERSION:
419             return DeviceInfo::ExtensionsWithVersion;
420         case CL_DEVICE_ILS_WITH_VERSION:
421             return DeviceInfo::ILsWithVersion;
422         case CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION:
423             return DeviceInfo::BuiltInKernelsWithVersion;
424         case CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES:
425             return DeviceInfo::AtomicMemoryCapabilities;
426         case CL_DEVICE_ATOMIC_FENCE_CAPABILITIES:
427             return DeviceInfo::AtomicFenceCapabilities;
428         case CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT:
429             return DeviceInfo::NonUniformWorkGroupSupport;
430         case CL_DEVICE_OPENCL_C_ALL_VERSIONS:
431             return DeviceInfo::OpenCL_C_AllVersions;
432         case CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE:
433             return DeviceInfo::PreferredWorkGroupSizeMultiple;
434         case CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT:
435             return DeviceInfo::WorkGroupCollectiveFunctionsSupport;
436         case CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT:
437             return DeviceInfo::GenericAddressSpaceSupport;
438         case CL_DEVICE_OPENCL_C_FEATURES:
439             return DeviceInfo::OpenCL_C_Features;
440         case CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES:
441             return DeviceInfo::DeviceEnqueueCapabilities;
442         case CL_DEVICE_PIPE_SUPPORT:
443             return DeviceInfo::PipeSupport;
444         case CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED:
445             return DeviceInfo::LatestConformanceVersionPassed;
446         default:
447             return DeviceInfo::InvalidEnum;
448     }
449 }
450 
ToCLenum(DeviceInfo from)451 CLenum ToCLenum(DeviceInfo from)
452 {
453     switch (from)
454     {
455         case DeviceInfo::Type:
456             return CL_DEVICE_TYPE;
457         case DeviceInfo::VendorID:
458             return CL_DEVICE_VENDOR_ID;
459         case DeviceInfo::MaxComputeUnits:
460             return CL_DEVICE_MAX_COMPUTE_UNITS;
461         case DeviceInfo::MaxWorkItemDimensions:
462             return CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS;
463         case DeviceInfo::MaxWorkGroupSize:
464             return CL_DEVICE_MAX_WORK_GROUP_SIZE;
465         case DeviceInfo::MaxWorkItemSizes:
466             return CL_DEVICE_MAX_WORK_ITEM_SIZES;
467         case DeviceInfo::PreferredVectorWidthChar:
468             return CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR;
469         case DeviceInfo::PreferredVectorWidthShort:
470             return CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT;
471         case DeviceInfo::PreferredVectorWidthInt:
472             return CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT;
473         case DeviceInfo::PreferredVectorWidthLong:
474             return CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG;
475         case DeviceInfo::PreferredVectorWidthFloat:
476             return CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT;
477         case DeviceInfo::PreferredVectorWidthDouble:
478             return CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE;
479         case DeviceInfo::MaxClockFrequency:
480             return CL_DEVICE_MAX_CLOCK_FREQUENCY;
481         case DeviceInfo::AddressBits:
482             return CL_DEVICE_ADDRESS_BITS;
483         case DeviceInfo::MaxReadImageArgs:
484             return CL_DEVICE_MAX_READ_IMAGE_ARGS;
485         case DeviceInfo::MaxWriteImageArgs:
486             return CL_DEVICE_MAX_WRITE_IMAGE_ARGS;
487         case DeviceInfo::MaxMemAllocSize:
488             return CL_DEVICE_MAX_MEM_ALLOC_SIZE;
489         case DeviceInfo::Image2D_MaxWidth:
490             return CL_DEVICE_IMAGE2D_MAX_WIDTH;
491         case DeviceInfo::Image2D_MaxHeight:
492             return CL_DEVICE_IMAGE2D_MAX_HEIGHT;
493         case DeviceInfo::Image3D_MaxWidth:
494             return CL_DEVICE_IMAGE3D_MAX_WIDTH;
495         case DeviceInfo::Image3D_MaxHeight:
496             return CL_DEVICE_IMAGE3D_MAX_HEIGHT;
497         case DeviceInfo::Image3D_MaxDepth:
498             return CL_DEVICE_IMAGE3D_MAX_DEPTH;
499         case DeviceInfo::ImageSupport:
500             return CL_DEVICE_IMAGE_SUPPORT;
501         case DeviceInfo::MaxParameterSize:
502             return CL_DEVICE_MAX_PARAMETER_SIZE;
503         case DeviceInfo::MaxSamplers:
504             return CL_DEVICE_MAX_SAMPLERS;
505         case DeviceInfo::MemBaseAddrAlign:
506             return CL_DEVICE_MEM_BASE_ADDR_ALIGN;
507         case DeviceInfo::MinDataTypeAlignSize:
508             return CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE;
509         case DeviceInfo::SingleFpConfig:
510             return CL_DEVICE_SINGLE_FP_CONFIG;
511         case DeviceInfo::GlobalMemCacheType:
512             return CL_DEVICE_GLOBAL_MEM_CACHE_TYPE;
513         case DeviceInfo::GlobalMemCachelineSize:
514             return CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE;
515         case DeviceInfo::GlobalMemCacheSize:
516             return CL_DEVICE_GLOBAL_MEM_CACHE_SIZE;
517         case DeviceInfo::GlobalMemSize:
518             return CL_DEVICE_GLOBAL_MEM_SIZE;
519         case DeviceInfo::MaxConstantBufferSize:
520             return CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE;
521         case DeviceInfo::MaxConstantArgs:
522             return CL_DEVICE_MAX_CONSTANT_ARGS;
523         case DeviceInfo::LocalMemType:
524             return CL_DEVICE_LOCAL_MEM_TYPE;
525         case DeviceInfo::LocalMemSize:
526             return CL_DEVICE_LOCAL_MEM_SIZE;
527         case DeviceInfo::ErrorCorrectionSupport:
528             return CL_DEVICE_ERROR_CORRECTION_SUPPORT;
529         case DeviceInfo::ProfilingTimerResolution:
530             return CL_DEVICE_PROFILING_TIMER_RESOLUTION;
531         case DeviceInfo::EndianLittle:
532             return CL_DEVICE_ENDIAN_LITTLE;
533         case DeviceInfo::Available:
534             return CL_DEVICE_AVAILABLE;
535         case DeviceInfo::CompilerAvailable:
536             return CL_DEVICE_COMPILER_AVAILABLE;
537         case DeviceInfo::ExecutionCapabilities:
538             return CL_DEVICE_EXECUTION_CAPABILITIES;
539         case DeviceInfo::QueueOnHostProperties:
540             return CL_DEVICE_QUEUE_ON_HOST_PROPERTIES;
541         case DeviceInfo::Name:
542             return CL_DEVICE_NAME;
543         case DeviceInfo::Vendor:
544             return CL_DEVICE_VENDOR;
545         case DeviceInfo::DriverVersion:
546             return CL_DRIVER_VERSION;
547         case DeviceInfo::Profile:
548             return CL_DEVICE_PROFILE;
549         case DeviceInfo::Version:
550             return CL_DEVICE_VERSION;
551         case DeviceInfo::Extensions:
552             return CL_DEVICE_EXTENSIONS;
553         case DeviceInfo::Platform:
554             return CL_DEVICE_PLATFORM;
555         case DeviceInfo::DoubleFpConfig:
556             return CL_DEVICE_DOUBLE_FP_CONFIG;
557         case DeviceInfo::HalfFpConfig:
558             return CL_DEVICE_HALF_FP_CONFIG;
559         case DeviceInfo::PreferredVectorWidthHalf:
560             return CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF;
561         case DeviceInfo::HostUnifiedMemory:
562             return CL_DEVICE_HOST_UNIFIED_MEMORY;
563         case DeviceInfo::NativeVectorWidthChar:
564             return CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR;
565         case DeviceInfo::NativeVectorWidthShort:
566             return CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT;
567         case DeviceInfo::NativeVectorWidthInt:
568             return CL_DEVICE_NATIVE_VECTOR_WIDTH_INT;
569         case DeviceInfo::NativeVectorWidthLong:
570             return CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG;
571         case DeviceInfo::NativeVectorWidthFloat:
572             return CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT;
573         case DeviceInfo::NativeVectorWidthDouble:
574             return CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE;
575         case DeviceInfo::NativeVectorWidthHalf:
576             return CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF;
577         case DeviceInfo::OpenCL_C_Version:
578             return CL_DEVICE_OPENCL_C_VERSION;
579         case DeviceInfo::LinkerAvailable:
580             return CL_DEVICE_LINKER_AVAILABLE;
581         case DeviceInfo::BuiltInKernels:
582             return CL_DEVICE_BUILT_IN_KERNELS;
583         case DeviceInfo::ImageMaxBufferSize:
584             return CL_DEVICE_IMAGE_MAX_BUFFER_SIZE;
585         case DeviceInfo::ImageMaxArraySize:
586             return CL_DEVICE_IMAGE_MAX_ARRAY_SIZE;
587         case DeviceInfo::ParentDevice:
588             return CL_DEVICE_PARENT_DEVICE;
589         case DeviceInfo::PartitionMaxSubDevices:
590             return CL_DEVICE_PARTITION_MAX_SUB_DEVICES;
591         case DeviceInfo::PartitionProperties:
592             return CL_DEVICE_PARTITION_PROPERTIES;
593         case DeviceInfo::PartitionAffinityDomain:
594             return CL_DEVICE_PARTITION_AFFINITY_DOMAIN;
595         case DeviceInfo::PartitionType:
596             return CL_DEVICE_PARTITION_TYPE;
597         case DeviceInfo::ReferenceCount:
598             return CL_DEVICE_REFERENCE_COUNT;
599         case DeviceInfo::PreferredInteropUserSync:
600             return CL_DEVICE_PREFERRED_INTEROP_USER_SYNC;
601         case DeviceInfo::PrintfBufferSize:
602             return CL_DEVICE_PRINTF_BUFFER_SIZE;
603         case DeviceInfo::ImagePitchAlignment:
604             return CL_DEVICE_IMAGE_PITCH_ALIGNMENT;
605         case DeviceInfo::ImageBaseAddressAlignment:
606             return CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT;
607         case DeviceInfo::MaxReadWriteImageArgs:
608             return CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS;
609         case DeviceInfo::MaxGlobalVariableSize:
610             return CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE;
611         case DeviceInfo::QueueOnDeviceProperties:
612             return CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES;
613         case DeviceInfo::QueueOnDevicePreferredSize:
614             return CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE;
615         case DeviceInfo::QueueOnDeviceMaxSize:
616             return CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE;
617         case DeviceInfo::MaxOnDeviceQueues:
618             return CL_DEVICE_MAX_ON_DEVICE_QUEUES;
619         case DeviceInfo::MaxOnDeviceEvents:
620             return CL_DEVICE_MAX_ON_DEVICE_EVENTS;
621         case DeviceInfo::SVM_Capabilities:
622             return CL_DEVICE_SVM_CAPABILITIES;
623         case DeviceInfo::GlobalVariablePreferredTotalSize:
624             return CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE;
625         case DeviceInfo::MaxPipeArgs:
626             return CL_DEVICE_MAX_PIPE_ARGS;
627         case DeviceInfo::PipeMaxActiveReservations:
628             return CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS;
629         case DeviceInfo::PipeMaxPacketSize:
630             return CL_DEVICE_PIPE_MAX_PACKET_SIZE;
631         case DeviceInfo::PreferredPlatformAtomicAlignment:
632             return CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT;
633         case DeviceInfo::PreferredGlobalAtomicAlignment:
634             return CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT;
635         case DeviceInfo::PreferredLocalAtomicAlignment:
636             return CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT;
637         case DeviceInfo::IL_Version:
638             return CL_DEVICE_IL_VERSION;
639         case DeviceInfo::MaxNumSubGroups:
640             return CL_DEVICE_MAX_NUM_SUB_GROUPS;
641         case DeviceInfo::SubGroupIndependentForwardProgress:
642             return CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS;
643         case DeviceInfo::NumericVersion:
644             return CL_DEVICE_NUMERIC_VERSION;
645         case DeviceInfo::ExtensionsWithVersion:
646             return CL_DEVICE_EXTENSIONS_WITH_VERSION;
647         case DeviceInfo::ILsWithVersion:
648             return CL_DEVICE_ILS_WITH_VERSION;
649         case DeviceInfo::BuiltInKernelsWithVersion:
650             return CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION;
651         case DeviceInfo::AtomicMemoryCapabilities:
652             return CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES;
653         case DeviceInfo::AtomicFenceCapabilities:
654             return CL_DEVICE_ATOMIC_FENCE_CAPABILITIES;
655         case DeviceInfo::NonUniformWorkGroupSupport:
656             return CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT;
657         case DeviceInfo::OpenCL_C_AllVersions:
658             return CL_DEVICE_OPENCL_C_ALL_VERSIONS;
659         case DeviceInfo::PreferredWorkGroupSizeMultiple:
660             return CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE;
661         case DeviceInfo::WorkGroupCollectiveFunctionsSupport:
662             return CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT;
663         case DeviceInfo::GenericAddressSpaceSupport:
664             return CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT;
665         case DeviceInfo::OpenCL_C_Features:
666             return CL_DEVICE_OPENCL_C_FEATURES;
667         case DeviceInfo::DeviceEnqueueCapabilities:
668             return CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES;
669         case DeviceInfo::PipeSupport:
670             return CL_DEVICE_PIPE_SUPPORT;
671         case DeviceInfo::LatestConformanceVersionPassed:
672             return CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED;
673         default:
674             UNREACHABLE();
675             return 0;
676     }
677 }
678 
operator <<(std::ostream & os,DeviceInfo value)679 std::ostream &operator<<(std::ostream &os, DeviceInfo value)
680 {
681     switch (value)
682     {
683         case DeviceInfo::Type:
684             os << "CL_DEVICE_TYPE";
685             break;
686         case DeviceInfo::VendorID:
687             os << "CL_DEVICE_VENDOR_ID";
688             break;
689         case DeviceInfo::MaxComputeUnits:
690             os << "CL_DEVICE_MAX_COMPUTE_UNITS";
691             break;
692         case DeviceInfo::MaxWorkItemDimensions:
693             os << "CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS";
694             break;
695         case DeviceInfo::MaxWorkGroupSize:
696             os << "CL_DEVICE_MAX_WORK_GROUP_SIZE";
697             break;
698         case DeviceInfo::MaxWorkItemSizes:
699             os << "CL_DEVICE_MAX_WORK_ITEM_SIZES";
700             break;
701         case DeviceInfo::PreferredVectorWidthChar:
702             os << "CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR";
703             break;
704         case DeviceInfo::PreferredVectorWidthShort:
705             os << "CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT";
706             break;
707         case DeviceInfo::PreferredVectorWidthInt:
708             os << "CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT";
709             break;
710         case DeviceInfo::PreferredVectorWidthLong:
711             os << "CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG";
712             break;
713         case DeviceInfo::PreferredVectorWidthFloat:
714             os << "CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT";
715             break;
716         case DeviceInfo::PreferredVectorWidthDouble:
717             os << "CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE";
718             break;
719         case DeviceInfo::MaxClockFrequency:
720             os << "CL_DEVICE_MAX_CLOCK_FREQUENCY";
721             break;
722         case DeviceInfo::AddressBits:
723             os << "CL_DEVICE_ADDRESS_BITS";
724             break;
725         case DeviceInfo::MaxReadImageArgs:
726             os << "CL_DEVICE_MAX_READ_IMAGE_ARGS";
727             break;
728         case DeviceInfo::MaxWriteImageArgs:
729             os << "CL_DEVICE_MAX_WRITE_IMAGE_ARGS";
730             break;
731         case DeviceInfo::MaxMemAllocSize:
732             os << "CL_DEVICE_MAX_MEM_ALLOC_SIZE";
733             break;
734         case DeviceInfo::Image2D_MaxWidth:
735             os << "CL_DEVICE_IMAGE2D_MAX_WIDTH";
736             break;
737         case DeviceInfo::Image2D_MaxHeight:
738             os << "CL_DEVICE_IMAGE2D_MAX_HEIGHT";
739             break;
740         case DeviceInfo::Image3D_MaxWidth:
741             os << "CL_DEVICE_IMAGE3D_MAX_WIDTH";
742             break;
743         case DeviceInfo::Image3D_MaxHeight:
744             os << "CL_DEVICE_IMAGE3D_MAX_HEIGHT";
745             break;
746         case DeviceInfo::Image3D_MaxDepth:
747             os << "CL_DEVICE_IMAGE3D_MAX_DEPTH";
748             break;
749         case DeviceInfo::ImageSupport:
750             os << "CL_DEVICE_IMAGE_SUPPORT";
751             break;
752         case DeviceInfo::MaxParameterSize:
753             os << "CL_DEVICE_MAX_PARAMETER_SIZE";
754             break;
755         case DeviceInfo::MaxSamplers:
756             os << "CL_DEVICE_MAX_SAMPLERS";
757             break;
758         case DeviceInfo::MemBaseAddrAlign:
759             os << "CL_DEVICE_MEM_BASE_ADDR_ALIGN";
760             break;
761         case DeviceInfo::MinDataTypeAlignSize:
762             os << "CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE";
763             break;
764         case DeviceInfo::SingleFpConfig:
765             os << "CL_DEVICE_SINGLE_FP_CONFIG";
766             break;
767         case DeviceInfo::GlobalMemCacheType:
768             os << "CL_DEVICE_GLOBAL_MEM_CACHE_TYPE";
769             break;
770         case DeviceInfo::GlobalMemCachelineSize:
771             os << "CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE";
772             break;
773         case DeviceInfo::GlobalMemCacheSize:
774             os << "CL_DEVICE_GLOBAL_MEM_CACHE_SIZE";
775             break;
776         case DeviceInfo::GlobalMemSize:
777             os << "CL_DEVICE_GLOBAL_MEM_SIZE";
778             break;
779         case DeviceInfo::MaxConstantBufferSize:
780             os << "CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE";
781             break;
782         case DeviceInfo::MaxConstantArgs:
783             os << "CL_DEVICE_MAX_CONSTANT_ARGS";
784             break;
785         case DeviceInfo::LocalMemType:
786             os << "CL_DEVICE_LOCAL_MEM_TYPE";
787             break;
788         case DeviceInfo::LocalMemSize:
789             os << "CL_DEVICE_LOCAL_MEM_SIZE";
790             break;
791         case DeviceInfo::ErrorCorrectionSupport:
792             os << "CL_DEVICE_ERROR_CORRECTION_SUPPORT";
793             break;
794         case DeviceInfo::ProfilingTimerResolution:
795             os << "CL_DEVICE_PROFILING_TIMER_RESOLUTION";
796             break;
797         case DeviceInfo::EndianLittle:
798             os << "CL_DEVICE_ENDIAN_LITTLE";
799             break;
800         case DeviceInfo::Available:
801             os << "CL_DEVICE_AVAILABLE";
802             break;
803         case DeviceInfo::CompilerAvailable:
804             os << "CL_DEVICE_COMPILER_AVAILABLE";
805             break;
806         case DeviceInfo::ExecutionCapabilities:
807             os << "CL_DEVICE_EXECUTION_CAPABILITIES";
808             break;
809         case DeviceInfo::QueueOnHostProperties:
810             os << "CL_DEVICE_QUEUE_ON_HOST_PROPERTIES";
811             break;
812         case DeviceInfo::Name:
813             os << "CL_DEVICE_NAME";
814             break;
815         case DeviceInfo::Vendor:
816             os << "CL_DEVICE_VENDOR";
817             break;
818         case DeviceInfo::DriverVersion:
819             os << "CL_DRIVER_VERSION";
820             break;
821         case DeviceInfo::Profile:
822             os << "CL_DEVICE_PROFILE";
823             break;
824         case DeviceInfo::Version:
825             os << "CL_DEVICE_VERSION";
826             break;
827         case DeviceInfo::Extensions:
828             os << "CL_DEVICE_EXTENSIONS";
829             break;
830         case DeviceInfo::Platform:
831             os << "CL_DEVICE_PLATFORM";
832             break;
833         case DeviceInfo::DoubleFpConfig:
834             os << "CL_DEVICE_DOUBLE_FP_CONFIG";
835             break;
836         case DeviceInfo::HalfFpConfig:
837             os << "CL_DEVICE_HALF_FP_CONFIG";
838             break;
839         case DeviceInfo::PreferredVectorWidthHalf:
840             os << "CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF";
841             break;
842         case DeviceInfo::HostUnifiedMemory:
843             os << "CL_DEVICE_HOST_UNIFIED_MEMORY";
844             break;
845         case DeviceInfo::NativeVectorWidthChar:
846             os << "CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR";
847             break;
848         case DeviceInfo::NativeVectorWidthShort:
849             os << "CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT";
850             break;
851         case DeviceInfo::NativeVectorWidthInt:
852             os << "CL_DEVICE_NATIVE_VECTOR_WIDTH_INT";
853             break;
854         case DeviceInfo::NativeVectorWidthLong:
855             os << "CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG";
856             break;
857         case DeviceInfo::NativeVectorWidthFloat:
858             os << "CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT";
859             break;
860         case DeviceInfo::NativeVectorWidthDouble:
861             os << "CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE";
862             break;
863         case DeviceInfo::NativeVectorWidthHalf:
864             os << "CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF";
865             break;
866         case DeviceInfo::OpenCL_C_Version:
867             os << "CL_DEVICE_OPENCL_C_VERSION";
868             break;
869         case DeviceInfo::LinkerAvailable:
870             os << "CL_DEVICE_LINKER_AVAILABLE";
871             break;
872         case DeviceInfo::BuiltInKernels:
873             os << "CL_DEVICE_BUILT_IN_KERNELS";
874             break;
875         case DeviceInfo::ImageMaxBufferSize:
876             os << "CL_DEVICE_IMAGE_MAX_BUFFER_SIZE";
877             break;
878         case DeviceInfo::ImageMaxArraySize:
879             os << "CL_DEVICE_IMAGE_MAX_ARRAY_SIZE";
880             break;
881         case DeviceInfo::ParentDevice:
882             os << "CL_DEVICE_PARENT_DEVICE";
883             break;
884         case DeviceInfo::PartitionMaxSubDevices:
885             os << "CL_DEVICE_PARTITION_MAX_SUB_DEVICES";
886             break;
887         case DeviceInfo::PartitionProperties:
888             os << "CL_DEVICE_PARTITION_PROPERTIES";
889             break;
890         case DeviceInfo::PartitionAffinityDomain:
891             os << "CL_DEVICE_PARTITION_AFFINITY_DOMAIN";
892             break;
893         case DeviceInfo::PartitionType:
894             os << "CL_DEVICE_PARTITION_TYPE";
895             break;
896         case DeviceInfo::ReferenceCount:
897             os << "CL_DEVICE_REFERENCE_COUNT";
898             break;
899         case DeviceInfo::PreferredInteropUserSync:
900             os << "CL_DEVICE_PREFERRED_INTEROP_USER_SYNC";
901             break;
902         case DeviceInfo::PrintfBufferSize:
903             os << "CL_DEVICE_PRINTF_BUFFER_SIZE";
904             break;
905         case DeviceInfo::ImagePitchAlignment:
906             os << "CL_DEVICE_IMAGE_PITCH_ALIGNMENT";
907             break;
908         case DeviceInfo::ImageBaseAddressAlignment:
909             os << "CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT";
910             break;
911         case DeviceInfo::MaxReadWriteImageArgs:
912             os << "CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS";
913             break;
914         case DeviceInfo::MaxGlobalVariableSize:
915             os << "CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE";
916             break;
917         case DeviceInfo::QueueOnDeviceProperties:
918             os << "CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES";
919             break;
920         case DeviceInfo::QueueOnDevicePreferredSize:
921             os << "CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE";
922             break;
923         case DeviceInfo::QueueOnDeviceMaxSize:
924             os << "CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE";
925             break;
926         case DeviceInfo::MaxOnDeviceQueues:
927             os << "CL_DEVICE_MAX_ON_DEVICE_QUEUES";
928             break;
929         case DeviceInfo::MaxOnDeviceEvents:
930             os << "CL_DEVICE_MAX_ON_DEVICE_EVENTS";
931             break;
932         case DeviceInfo::SVM_Capabilities:
933             os << "CL_DEVICE_SVM_CAPABILITIES";
934             break;
935         case DeviceInfo::GlobalVariablePreferredTotalSize:
936             os << "CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE";
937             break;
938         case DeviceInfo::MaxPipeArgs:
939             os << "CL_DEVICE_MAX_PIPE_ARGS";
940             break;
941         case DeviceInfo::PipeMaxActiveReservations:
942             os << "CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS";
943             break;
944         case DeviceInfo::PipeMaxPacketSize:
945             os << "CL_DEVICE_PIPE_MAX_PACKET_SIZE";
946             break;
947         case DeviceInfo::PreferredPlatformAtomicAlignment:
948             os << "CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT";
949             break;
950         case DeviceInfo::PreferredGlobalAtomicAlignment:
951             os << "CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT";
952             break;
953         case DeviceInfo::PreferredLocalAtomicAlignment:
954             os << "CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT";
955             break;
956         case DeviceInfo::IL_Version:
957             os << "CL_DEVICE_IL_VERSION";
958             break;
959         case DeviceInfo::MaxNumSubGroups:
960             os << "CL_DEVICE_MAX_NUM_SUB_GROUPS";
961             break;
962         case DeviceInfo::SubGroupIndependentForwardProgress:
963             os << "CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS";
964             break;
965         case DeviceInfo::NumericVersion:
966             os << "CL_DEVICE_NUMERIC_VERSION";
967             break;
968         case DeviceInfo::ExtensionsWithVersion:
969             os << "CL_DEVICE_EXTENSIONS_WITH_VERSION";
970             break;
971         case DeviceInfo::ILsWithVersion:
972             os << "CL_DEVICE_ILS_WITH_VERSION";
973             break;
974         case DeviceInfo::BuiltInKernelsWithVersion:
975             os << "CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION";
976             break;
977         case DeviceInfo::AtomicMemoryCapabilities:
978             os << "CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES";
979             break;
980         case DeviceInfo::AtomicFenceCapabilities:
981             os << "CL_DEVICE_ATOMIC_FENCE_CAPABILITIES";
982             break;
983         case DeviceInfo::NonUniformWorkGroupSupport:
984             os << "CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT";
985             break;
986         case DeviceInfo::OpenCL_C_AllVersions:
987             os << "CL_DEVICE_OPENCL_C_ALL_VERSIONS";
988             break;
989         case DeviceInfo::PreferredWorkGroupSizeMultiple:
990             os << "CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE";
991             break;
992         case DeviceInfo::WorkGroupCollectiveFunctionsSupport:
993             os << "CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT";
994             break;
995         case DeviceInfo::GenericAddressSpaceSupport:
996             os << "CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT";
997             break;
998         case DeviceInfo::OpenCL_C_Features:
999             os << "CL_DEVICE_OPENCL_C_FEATURES";
1000             break;
1001         case DeviceInfo::DeviceEnqueueCapabilities:
1002             os << "CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES";
1003             break;
1004         case DeviceInfo::PipeSupport:
1005             os << "CL_DEVICE_PIPE_SUPPORT";
1006             break;
1007         case DeviceInfo::LatestConformanceVersionPassed:
1008             os << "CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED";
1009             break;
1010         default:
1011             os << "GL_INVALID_ENUM";
1012             break;
1013     }
1014     return os;
1015 }
1016 
1017 template <>
FromCLenum(CLenum from)1018 EventInfo FromCLenum<EventInfo>(CLenum from)
1019 {
1020     switch (from)
1021     {
1022         case CL_EVENT_COMMAND_QUEUE:
1023             return EventInfo::CommandQueue;
1024         case CL_EVENT_COMMAND_TYPE:
1025             return EventInfo::CommandType;
1026         case CL_EVENT_REFERENCE_COUNT:
1027             return EventInfo::ReferenceCount;
1028         case CL_EVENT_COMMAND_EXECUTION_STATUS:
1029             return EventInfo::CommandExecutionStatus;
1030         case CL_EVENT_CONTEXT:
1031             return EventInfo::Context;
1032         default:
1033             return EventInfo::InvalidEnum;
1034     }
1035 }
1036 
ToCLenum(EventInfo from)1037 CLenum ToCLenum(EventInfo from)
1038 {
1039     switch (from)
1040     {
1041         case EventInfo::CommandQueue:
1042             return CL_EVENT_COMMAND_QUEUE;
1043         case EventInfo::CommandType:
1044             return CL_EVENT_COMMAND_TYPE;
1045         case EventInfo::ReferenceCount:
1046             return CL_EVENT_REFERENCE_COUNT;
1047         case EventInfo::CommandExecutionStatus:
1048             return CL_EVENT_COMMAND_EXECUTION_STATUS;
1049         case EventInfo::Context:
1050             return CL_EVENT_CONTEXT;
1051         default:
1052             UNREACHABLE();
1053             return 0;
1054     }
1055 }
1056 
operator <<(std::ostream & os,EventInfo value)1057 std::ostream &operator<<(std::ostream &os, EventInfo value)
1058 {
1059     switch (value)
1060     {
1061         case EventInfo::CommandQueue:
1062             os << "CL_EVENT_COMMAND_QUEUE";
1063             break;
1064         case EventInfo::CommandType:
1065             os << "CL_EVENT_COMMAND_TYPE";
1066             break;
1067         case EventInfo::ReferenceCount:
1068             os << "CL_EVENT_REFERENCE_COUNT";
1069             break;
1070         case EventInfo::CommandExecutionStatus:
1071             os << "CL_EVENT_COMMAND_EXECUTION_STATUS";
1072             break;
1073         case EventInfo::Context:
1074             os << "CL_EVENT_CONTEXT";
1075             break;
1076         default:
1077             os << "GL_INVALID_ENUM";
1078             break;
1079     }
1080     return os;
1081 }
1082 
1083 template <>
FromCLenum(CLenum from)1084 FilterMode FromCLenum<FilterMode>(CLenum from)
1085 {
1086     switch (from)
1087     {
1088         case CL_FILTER_NEAREST:
1089             return FilterMode::Nearest;
1090         case CL_FILTER_LINEAR:
1091             return FilterMode::Linear;
1092         default:
1093             return FilterMode::InvalidEnum;
1094     }
1095 }
1096 
ToCLenum(FilterMode from)1097 CLenum ToCLenum(FilterMode from)
1098 {
1099     switch (from)
1100     {
1101         case FilterMode::Nearest:
1102             return CL_FILTER_NEAREST;
1103         case FilterMode::Linear:
1104             return CL_FILTER_LINEAR;
1105         default:
1106             UNREACHABLE();
1107             return 0;
1108     }
1109 }
1110 
operator <<(std::ostream & os,FilterMode value)1111 std::ostream &operator<<(std::ostream &os, FilterMode value)
1112 {
1113     switch (value)
1114     {
1115         case FilterMode::Nearest:
1116             os << "CL_FILTER_NEAREST";
1117             break;
1118         case FilterMode::Linear:
1119             os << "CL_FILTER_LINEAR";
1120             break;
1121         default:
1122             os << "GL_INVALID_ENUM";
1123             break;
1124     }
1125     return os;
1126 }
1127 
1128 template <>
FromCLenum(CLenum from)1129 ImageInfo FromCLenum<ImageInfo>(CLenum from)
1130 {
1131     switch (from)
1132     {
1133         case CL_IMAGE_FORMAT:
1134             return ImageInfo::Format;
1135         case CL_IMAGE_ELEMENT_SIZE:
1136             return ImageInfo::ElementSize;
1137         case CL_IMAGE_ROW_PITCH:
1138             return ImageInfo::RowPitch;
1139         case CL_IMAGE_SLICE_PITCH:
1140             return ImageInfo::SlicePitch;
1141         case CL_IMAGE_WIDTH:
1142             return ImageInfo::Width;
1143         case CL_IMAGE_HEIGHT:
1144             return ImageInfo::Height;
1145         case CL_IMAGE_DEPTH:
1146             return ImageInfo::Depth;
1147         case CL_IMAGE_ARRAY_SIZE:
1148             return ImageInfo::ArraySize;
1149         case CL_IMAGE_BUFFER:
1150             return ImageInfo::Buffer;
1151         case CL_IMAGE_NUM_MIP_LEVELS:
1152             return ImageInfo::NumMipLevels;
1153         case CL_IMAGE_NUM_SAMPLES:
1154             return ImageInfo::NumSamples;
1155         default:
1156             return ImageInfo::InvalidEnum;
1157     }
1158 }
1159 
ToCLenum(ImageInfo from)1160 CLenum ToCLenum(ImageInfo from)
1161 {
1162     switch (from)
1163     {
1164         case ImageInfo::Format:
1165             return CL_IMAGE_FORMAT;
1166         case ImageInfo::ElementSize:
1167             return CL_IMAGE_ELEMENT_SIZE;
1168         case ImageInfo::RowPitch:
1169             return CL_IMAGE_ROW_PITCH;
1170         case ImageInfo::SlicePitch:
1171             return CL_IMAGE_SLICE_PITCH;
1172         case ImageInfo::Width:
1173             return CL_IMAGE_WIDTH;
1174         case ImageInfo::Height:
1175             return CL_IMAGE_HEIGHT;
1176         case ImageInfo::Depth:
1177             return CL_IMAGE_DEPTH;
1178         case ImageInfo::ArraySize:
1179             return CL_IMAGE_ARRAY_SIZE;
1180         case ImageInfo::Buffer:
1181             return CL_IMAGE_BUFFER;
1182         case ImageInfo::NumMipLevels:
1183             return CL_IMAGE_NUM_MIP_LEVELS;
1184         case ImageInfo::NumSamples:
1185             return CL_IMAGE_NUM_SAMPLES;
1186         default:
1187             UNREACHABLE();
1188             return 0;
1189     }
1190 }
1191 
operator <<(std::ostream & os,ImageInfo value)1192 std::ostream &operator<<(std::ostream &os, ImageInfo value)
1193 {
1194     switch (value)
1195     {
1196         case ImageInfo::Format:
1197             os << "CL_IMAGE_FORMAT";
1198             break;
1199         case ImageInfo::ElementSize:
1200             os << "CL_IMAGE_ELEMENT_SIZE";
1201             break;
1202         case ImageInfo::RowPitch:
1203             os << "CL_IMAGE_ROW_PITCH";
1204             break;
1205         case ImageInfo::SlicePitch:
1206             os << "CL_IMAGE_SLICE_PITCH";
1207             break;
1208         case ImageInfo::Width:
1209             os << "CL_IMAGE_WIDTH";
1210             break;
1211         case ImageInfo::Height:
1212             os << "CL_IMAGE_HEIGHT";
1213             break;
1214         case ImageInfo::Depth:
1215             os << "CL_IMAGE_DEPTH";
1216             break;
1217         case ImageInfo::ArraySize:
1218             os << "CL_IMAGE_ARRAY_SIZE";
1219             break;
1220         case ImageInfo::Buffer:
1221             os << "CL_IMAGE_BUFFER";
1222             break;
1223         case ImageInfo::NumMipLevels:
1224             os << "CL_IMAGE_NUM_MIP_LEVELS";
1225             break;
1226         case ImageInfo::NumSamples:
1227             os << "CL_IMAGE_NUM_SAMPLES";
1228             break;
1229         default:
1230             os << "GL_INVALID_ENUM";
1231             break;
1232     }
1233     return os;
1234 }
1235 
1236 template <>
FromCLenum(CLenum from)1237 KernelArgInfo FromCLenum<KernelArgInfo>(CLenum from)
1238 {
1239     switch (from)
1240     {
1241         case CL_KERNEL_ARG_ADDRESS_QUALIFIER:
1242             return KernelArgInfo::AddressQualifier;
1243         case CL_KERNEL_ARG_ACCESS_QUALIFIER:
1244             return KernelArgInfo::AccessQualifier;
1245         case CL_KERNEL_ARG_TYPE_NAME:
1246             return KernelArgInfo::TypeName;
1247         case CL_KERNEL_ARG_TYPE_QUALIFIER:
1248             return KernelArgInfo::TypeQualifier;
1249         case CL_KERNEL_ARG_NAME:
1250             return KernelArgInfo::Name;
1251         default:
1252             return KernelArgInfo::InvalidEnum;
1253     }
1254 }
1255 
ToCLenum(KernelArgInfo from)1256 CLenum ToCLenum(KernelArgInfo from)
1257 {
1258     switch (from)
1259     {
1260         case KernelArgInfo::AddressQualifier:
1261             return CL_KERNEL_ARG_ADDRESS_QUALIFIER;
1262         case KernelArgInfo::AccessQualifier:
1263             return CL_KERNEL_ARG_ACCESS_QUALIFIER;
1264         case KernelArgInfo::TypeName:
1265             return CL_KERNEL_ARG_TYPE_NAME;
1266         case KernelArgInfo::TypeQualifier:
1267             return CL_KERNEL_ARG_TYPE_QUALIFIER;
1268         case KernelArgInfo::Name:
1269             return CL_KERNEL_ARG_NAME;
1270         default:
1271             UNREACHABLE();
1272             return 0;
1273     }
1274 }
1275 
operator <<(std::ostream & os,KernelArgInfo value)1276 std::ostream &operator<<(std::ostream &os, KernelArgInfo value)
1277 {
1278     switch (value)
1279     {
1280         case KernelArgInfo::AddressQualifier:
1281             os << "CL_KERNEL_ARG_ADDRESS_QUALIFIER";
1282             break;
1283         case KernelArgInfo::AccessQualifier:
1284             os << "CL_KERNEL_ARG_ACCESS_QUALIFIER";
1285             break;
1286         case KernelArgInfo::TypeName:
1287             os << "CL_KERNEL_ARG_TYPE_NAME";
1288             break;
1289         case KernelArgInfo::TypeQualifier:
1290             os << "CL_KERNEL_ARG_TYPE_QUALIFIER";
1291             break;
1292         case KernelArgInfo::Name:
1293             os << "CL_KERNEL_ARG_NAME";
1294             break;
1295         default:
1296             os << "GL_INVALID_ENUM";
1297             break;
1298     }
1299     return os;
1300 }
1301 
1302 template <>
FromCLenum(CLenum from)1303 KernelExecInfo FromCLenum<KernelExecInfo>(CLenum from)
1304 {
1305     switch (from)
1306     {
1307         case CL_KERNEL_EXEC_INFO_SVM_PTRS:
1308             return KernelExecInfo::SVM_Ptrs;
1309         case CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM:
1310             return KernelExecInfo::SVM_FineGrainSystem;
1311         default:
1312             return KernelExecInfo::InvalidEnum;
1313     }
1314 }
1315 
ToCLenum(KernelExecInfo from)1316 CLenum ToCLenum(KernelExecInfo from)
1317 {
1318     switch (from)
1319     {
1320         case KernelExecInfo::SVM_Ptrs:
1321             return CL_KERNEL_EXEC_INFO_SVM_PTRS;
1322         case KernelExecInfo::SVM_FineGrainSystem:
1323             return CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM;
1324         default:
1325             UNREACHABLE();
1326             return 0;
1327     }
1328 }
1329 
operator <<(std::ostream & os,KernelExecInfo value)1330 std::ostream &operator<<(std::ostream &os, KernelExecInfo value)
1331 {
1332     switch (value)
1333     {
1334         case KernelExecInfo::SVM_Ptrs:
1335             os << "CL_KERNEL_EXEC_INFO_SVM_PTRS";
1336             break;
1337         case KernelExecInfo::SVM_FineGrainSystem:
1338             os << "CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM";
1339             break;
1340         default:
1341             os << "GL_INVALID_ENUM";
1342             break;
1343     }
1344     return os;
1345 }
1346 
1347 template <>
FromCLenum(CLenum from)1348 KernelInfo FromCLenum<KernelInfo>(CLenum from)
1349 {
1350     switch (from)
1351     {
1352         case CL_KERNEL_FUNCTION_NAME:
1353             return KernelInfo::FunctionName;
1354         case CL_KERNEL_NUM_ARGS:
1355             return KernelInfo::NumArgs;
1356         case CL_KERNEL_REFERENCE_COUNT:
1357             return KernelInfo::ReferenceCount;
1358         case CL_KERNEL_CONTEXT:
1359             return KernelInfo::Context;
1360         case CL_KERNEL_PROGRAM:
1361             return KernelInfo::Program;
1362         case CL_KERNEL_ATTRIBUTES:
1363             return KernelInfo::Attributes;
1364         default:
1365             return KernelInfo::InvalidEnum;
1366     }
1367 }
1368 
ToCLenum(KernelInfo from)1369 CLenum ToCLenum(KernelInfo from)
1370 {
1371     switch (from)
1372     {
1373         case KernelInfo::FunctionName:
1374             return CL_KERNEL_FUNCTION_NAME;
1375         case KernelInfo::NumArgs:
1376             return CL_KERNEL_NUM_ARGS;
1377         case KernelInfo::ReferenceCount:
1378             return CL_KERNEL_REFERENCE_COUNT;
1379         case KernelInfo::Context:
1380             return CL_KERNEL_CONTEXT;
1381         case KernelInfo::Program:
1382             return CL_KERNEL_PROGRAM;
1383         case KernelInfo::Attributes:
1384             return CL_KERNEL_ATTRIBUTES;
1385         default:
1386             UNREACHABLE();
1387             return 0;
1388     }
1389 }
1390 
operator <<(std::ostream & os,KernelInfo value)1391 std::ostream &operator<<(std::ostream &os, KernelInfo value)
1392 {
1393     switch (value)
1394     {
1395         case KernelInfo::FunctionName:
1396             os << "CL_KERNEL_FUNCTION_NAME";
1397             break;
1398         case KernelInfo::NumArgs:
1399             os << "CL_KERNEL_NUM_ARGS";
1400             break;
1401         case KernelInfo::ReferenceCount:
1402             os << "CL_KERNEL_REFERENCE_COUNT";
1403             break;
1404         case KernelInfo::Context:
1405             os << "CL_KERNEL_CONTEXT";
1406             break;
1407         case KernelInfo::Program:
1408             os << "CL_KERNEL_PROGRAM";
1409             break;
1410         case KernelInfo::Attributes:
1411             os << "CL_KERNEL_ATTRIBUTES";
1412             break;
1413         default:
1414             os << "GL_INVALID_ENUM";
1415             break;
1416     }
1417     return os;
1418 }
1419 
1420 template <>
FromCLenum(CLenum from)1421 KernelSubGroupInfo FromCLenum<KernelSubGroupInfo>(CLenum from)
1422 {
1423     switch (from)
1424     {
1425         case CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE:
1426             return KernelSubGroupInfo::MaxSubGroupSizeForNdrange;
1427         case CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE:
1428             return KernelSubGroupInfo::SubGroupCountForNdrange;
1429         case CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT:
1430             return KernelSubGroupInfo::LocalSizeForSubGroupCount;
1431         case CL_KERNEL_MAX_NUM_SUB_GROUPS:
1432             return KernelSubGroupInfo::MaxNumSubGroups;
1433         case CL_KERNEL_COMPILE_NUM_SUB_GROUPS:
1434             return KernelSubGroupInfo::CompileNumSubGroups;
1435         default:
1436             return KernelSubGroupInfo::InvalidEnum;
1437     }
1438 }
1439 
ToCLenum(KernelSubGroupInfo from)1440 CLenum ToCLenum(KernelSubGroupInfo from)
1441 {
1442     switch (from)
1443     {
1444         case KernelSubGroupInfo::MaxSubGroupSizeForNdrange:
1445             return CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE;
1446         case KernelSubGroupInfo::SubGroupCountForNdrange:
1447             return CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE;
1448         case KernelSubGroupInfo::LocalSizeForSubGroupCount:
1449             return CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT;
1450         case KernelSubGroupInfo::MaxNumSubGroups:
1451             return CL_KERNEL_MAX_NUM_SUB_GROUPS;
1452         case KernelSubGroupInfo::CompileNumSubGroups:
1453             return CL_KERNEL_COMPILE_NUM_SUB_GROUPS;
1454         default:
1455             UNREACHABLE();
1456             return 0;
1457     }
1458 }
1459 
operator <<(std::ostream & os,KernelSubGroupInfo value)1460 std::ostream &operator<<(std::ostream &os, KernelSubGroupInfo value)
1461 {
1462     switch (value)
1463     {
1464         case KernelSubGroupInfo::MaxSubGroupSizeForNdrange:
1465             os << "CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE";
1466             break;
1467         case KernelSubGroupInfo::SubGroupCountForNdrange:
1468             os << "CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE";
1469             break;
1470         case KernelSubGroupInfo::LocalSizeForSubGroupCount:
1471             os << "CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT";
1472             break;
1473         case KernelSubGroupInfo::MaxNumSubGroups:
1474             os << "CL_KERNEL_MAX_NUM_SUB_GROUPS";
1475             break;
1476         case KernelSubGroupInfo::CompileNumSubGroups:
1477             os << "CL_KERNEL_COMPILE_NUM_SUB_GROUPS";
1478             break;
1479         default:
1480             os << "GL_INVALID_ENUM";
1481             break;
1482     }
1483     return os;
1484 }
1485 
1486 template <>
FromCLenum(CLenum from)1487 KernelWorkGroupInfo FromCLenum<KernelWorkGroupInfo>(CLenum from)
1488 {
1489     switch (from)
1490     {
1491         case CL_KERNEL_WORK_GROUP_SIZE:
1492             return KernelWorkGroupInfo::WorkGroupSize;
1493         case CL_KERNEL_COMPILE_WORK_GROUP_SIZE:
1494             return KernelWorkGroupInfo::CompileWorkGroupSize;
1495         case CL_KERNEL_LOCAL_MEM_SIZE:
1496             return KernelWorkGroupInfo::LocalMemSize;
1497         case CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE:
1498             return KernelWorkGroupInfo::PreferredWorkGroupSizeMultiple;
1499         case CL_KERNEL_PRIVATE_MEM_SIZE:
1500             return KernelWorkGroupInfo::PrivateMemSize;
1501         case CL_KERNEL_GLOBAL_WORK_SIZE:
1502             return KernelWorkGroupInfo::GlobalWorkSize;
1503         default:
1504             return KernelWorkGroupInfo::InvalidEnum;
1505     }
1506 }
1507 
ToCLenum(KernelWorkGroupInfo from)1508 CLenum ToCLenum(KernelWorkGroupInfo from)
1509 {
1510     switch (from)
1511     {
1512         case KernelWorkGroupInfo::WorkGroupSize:
1513             return CL_KERNEL_WORK_GROUP_SIZE;
1514         case KernelWorkGroupInfo::CompileWorkGroupSize:
1515             return CL_KERNEL_COMPILE_WORK_GROUP_SIZE;
1516         case KernelWorkGroupInfo::LocalMemSize:
1517             return CL_KERNEL_LOCAL_MEM_SIZE;
1518         case KernelWorkGroupInfo::PreferredWorkGroupSizeMultiple:
1519             return CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE;
1520         case KernelWorkGroupInfo::PrivateMemSize:
1521             return CL_KERNEL_PRIVATE_MEM_SIZE;
1522         case KernelWorkGroupInfo::GlobalWorkSize:
1523             return CL_KERNEL_GLOBAL_WORK_SIZE;
1524         default:
1525             UNREACHABLE();
1526             return 0;
1527     }
1528 }
1529 
operator <<(std::ostream & os,KernelWorkGroupInfo value)1530 std::ostream &operator<<(std::ostream &os, KernelWorkGroupInfo value)
1531 {
1532     switch (value)
1533     {
1534         case KernelWorkGroupInfo::WorkGroupSize:
1535             os << "CL_KERNEL_WORK_GROUP_SIZE";
1536             break;
1537         case KernelWorkGroupInfo::CompileWorkGroupSize:
1538             os << "CL_KERNEL_COMPILE_WORK_GROUP_SIZE";
1539             break;
1540         case KernelWorkGroupInfo::LocalMemSize:
1541             os << "CL_KERNEL_LOCAL_MEM_SIZE";
1542             break;
1543         case KernelWorkGroupInfo::PreferredWorkGroupSizeMultiple:
1544             os << "CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE";
1545             break;
1546         case KernelWorkGroupInfo::PrivateMemSize:
1547             os << "CL_KERNEL_PRIVATE_MEM_SIZE";
1548             break;
1549         case KernelWorkGroupInfo::GlobalWorkSize:
1550             os << "CL_KERNEL_GLOBAL_WORK_SIZE";
1551             break;
1552         default:
1553             os << "GL_INVALID_ENUM";
1554             break;
1555     }
1556     return os;
1557 }
1558 
1559 template <>
FromCLenum(CLenum from)1560 MemInfo FromCLenum<MemInfo>(CLenum from)
1561 {
1562     switch (from)
1563     {
1564         case CL_MEM_TYPE:
1565             return MemInfo::Type;
1566         case CL_MEM_FLAGS:
1567             return MemInfo::Flags;
1568         case CL_MEM_SIZE:
1569             return MemInfo::Size;
1570         case CL_MEM_HOST_PTR:
1571             return MemInfo::HostPtr;
1572         case CL_MEM_MAP_COUNT:
1573             return MemInfo::MapCount;
1574         case CL_MEM_REFERENCE_COUNT:
1575             return MemInfo::ReferenceCount;
1576         case CL_MEM_CONTEXT:
1577             return MemInfo::Context;
1578         case CL_MEM_ASSOCIATED_MEMOBJECT:
1579             return MemInfo::AssociatedMemObject;
1580         case CL_MEM_OFFSET:
1581             return MemInfo::Offset;
1582         case CL_MEM_USES_SVM_POINTER:
1583             return MemInfo::UsesSVM_Pointer;
1584         case CL_MEM_PROPERTIES:
1585             return MemInfo::Properties;
1586         default:
1587             return MemInfo::InvalidEnum;
1588     }
1589 }
1590 
ToCLenum(MemInfo from)1591 CLenum ToCLenum(MemInfo from)
1592 {
1593     switch (from)
1594     {
1595         case MemInfo::Type:
1596             return CL_MEM_TYPE;
1597         case MemInfo::Flags:
1598             return CL_MEM_FLAGS;
1599         case MemInfo::Size:
1600             return CL_MEM_SIZE;
1601         case MemInfo::HostPtr:
1602             return CL_MEM_HOST_PTR;
1603         case MemInfo::MapCount:
1604             return CL_MEM_MAP_COUNT;
1605         case MemInfo::ReferenceCount:
1606             return CL_MEM_REFERENCE_COUNT;
1607         case MemInfo::Context:
1608             return CL_MEM_CONTEXT;
1609         case MemInfo::AssociatedMemObject:
1610             return CL_MEM_ASSOCIATED_MEMOBJECT;
1611         case MemInfo::Offset:
1612             return CL_MEM_OFFSET;
1613         case MemInfo::UsesSVM_Pointer:
1614             return CL_MEM_USES_SVM_POINTER;
1615         case MemInfo::Properties:
1616             return CL_MEM_PROPERTIES;
1617         default:
1618             UNREACHABLE();
1619             return 0;
1620     }
1621 }
1622 
operator <<(std::ostream & os,MemInfo value)1623 std::ostream &operator<<(std::ostream &os, MemInfo value)
1624 {
1625     switch (value)
1626     {
1627         case MemInfo::Type:
1628             os << "CL_MEM_TYPE";
1629             break;
1630         case MemInfo::Flags:
1631             os << "CL_MEM_FLAGS";
1632             break;
1633         case MemInfo::Size:
1634             os << "CL_MEM_SIZE";
1635             break;
1636         case MemInfo::HostPtr:
1637             os << "CL_MEM_HOST_PTR";
1638             break;
1639         case MemInfo::MapCount:
1640             os << "CL_MEM_MAP_COUNT";
1641             break;
1642         case MemInfo::ReferenceCount:
1643             os << "CL_MEM_REFERENCE_COUNT";
1644             break;
1645         case MemInfo::Context:
1646             os << "CL_MEM_CONTEXT";
1647             break;
1648         case MemInfo::AssociatedMemObject:
1649             os << "CL_MEM_ASSOCIATED_MEMOBJECT";
1650             break;
1651         case MemInfo::Offset:
1652             os << "CL_MEM_OFFSET";
1653             break;
1654         case MemInfo::UsesSVM_Pointer:
1655             os << "CL_MEM_USES_SVM_POINTER";
1656             break;
1657         case MemInfo::Properties:
1658             os << "CL_MEM_PROPERTIES";
1659             break;
1660         default:
1661             os << "GL_INVALID_ENUM";
1662             break;
1663     }
1664     return os;
1665 }
1666 
1667 template <>
FromCLenum(CLenum from)1668 MemObjectType FromCLenum<MemObjectType>(CLenum from)
1669 {
1670     switch (from)
1671     {
1672         case CL_MEM_OBJECT_BUFFER:
1673             return MemObjectType::Buffer;
1674         case CL_MEM_OBJECT_IMAGE2D:
1675             return MemObjectType::Image2D;
1676         case CL_MEM_OBJECT_IMAGE3D:
1677             return MemObjectType::Image3D;
1678         case CL_MEM_OBJECT_IMAGE2D_ARRAY:
1679             return MemObjectType::Image2D_Array;
1680         case CL_MEM_OBJECT_IMAGE1D:
1681             return MemObjectType::Image1D;
1682         case CL_MEM_OBJECT_IMAGE1D_ARRAY:
1683             return MemObjectType::Image1D_Array;
1684         case CL_MEM_OBJECT_IMAGE1D_BUFFER:
1685             return MemObjectType::Image1D_Buffer;
1686         case CL_MEM_OBJECT_PIPE:
1687             return MemObjectType::Pipe;
1688         default:
1689             return MemObjectType::InvalidEnum;
1690     }
1691 }
1692 
ToCLenum(MemObjectType from)1693 CLenum ToCLenum(MemObjectType from)
1694 {
1695     switch (from)
1696     {
1697         case MemObjectType::Buffer:
1698             return CL_MEM_OBJECT_BUFFER;
1699         case MemObjectType::Image2D:
1700             return CL_MEM_OBJECT_IMAGE2D;
1701         case MemObjectType::Image3D:
1702             return CL_MEM_OBJECT_IMAGE3D;
1703         case MemObjectType::Image2D_Array:
1704             return CL_MEM_OBJECT_IMAGE2D_ARRAY;
1705         case MemObjectType::Image1D:
1706             return CL_MEM_OBJECT_IMAGE1D;
1707         case MemObjectType::Image1D_Array:
1708             return CL_MEM_OBJECT_IMAGE1D_ARRAY;
1709         case MemObjectType::Image1D_Buffer:
1710             return CL_MEM_OBJECT_IMAGE1D_BUFFER;
1711         case MemObjectType::Pipe:
1712             return CL_MEM_OBJECT_PIPE;
1713         default:
1714             UNREACHABLE();
1715             return 0;
1716     }
1717 }
1718 
operator <<(std::ostream & os,MemObjectType value)1719 std::ostream &operator<<(std::ostream &os, MemObjectType value)
1720 {
1721     switch (value)
1722     {
1723         case MemObjectType::Buffer:
1724             os << "CL_MEM_OBJECT_BUFFER";
1725             break;
1726         case MemObjectType::Image2D:
1727             os << "CL_MEM_OBJECT_IMAGE2D";
1728             break;
1729         case MemObjectType::Image3D:
1730             os << "CL_MEM_OBJECT_IMAGE3D";
1731             break;
1732         case MemObjectType::Image2D_Array:
1733             os << "CL_MEM_OBJECT_IMAGE2D_ARRAY";
1734             break;
1735         case MemObjectType::Image1D:
1736             os << "CL_MEM_OBJECT_IMAGE1D";
1737             break;
1738         case MemObjectType::Image1D_Array:
1739             os << "CL_MEM_OBJECT_IMAGE1D_ARRAY";
1740             break;
1741         case MemObjectType::Image1D_Buffer:
1742             os << "CL_MEM_OBJECT_IMAGE1D_BUFFER";
1743             break;
1744         case MemObjectType::Pipe:
1745             os << "CL_MEM_OBJECT_PIPE";
1746             break;
1747         default:
1748             os << "GL_INVALID_ENUM";
1749             break;
1750     }
1751     return os;
1752 }
1753 
1754 template <>
FromCLenum(CLenum from)1755 PipeInfo FromCLenum<PipeInfo>(CLenum from)
1756 {
1757     switch (from)
1758     {
1759         case CL_PIPE_PACKET_SIZE:
1760             return PipeInfo::PacketSize;
1761         case CL_PIPE_MAX_PACKETS:
1762             return PipeInfo::MaxPackets;
1763         case CL_PIPE_PROPERTIES:
1764             return PipeInfo::Properties;
1765         default:
1766             return PipeInfo::InvalidEnum;
1767     }
1768 }
1769 
ToCLenum(PipeInfo from)1770 CLenum ToCLenum(PipeInfo from)
1771 {
1772     switch (from)
1773     {
1774         case PipeInfo::PacketSize:
1775             return CL_PIPE_PACKET_SIZE;
1776         case PipeInfo::MaxPackets:
1777             return CL_PIPE_MAX_PACKETS;
1778         case PipeInfo::Properties:
1779             return CL_PIPE_PROPERTIES;
1780         default:
1781             UNREACHABLE();
1782             return 0;
1783     }
1784 }
1785 
operator <<(std::ostream & os,PipeInfo value)1786 std::ostream &operator<<(std::ostream &os, PipeInfo value)
1787 {
1788     switch (value)
1789     {
1790         case PipeInfo::PacketSize:
1791             os << "CL_PIPE_PACKET_SIZE";
1792             break;
1793         case PipeInfo::MaxPackets:
1794             os << "CL_PIPE_MAX_PACKETS";
1795             break;
1796         case PipeInfo::Properties:
1797             os << "CL_PIPE_PROPERTIES";
1798             break;
1799         default:
1800             os << "GL_INVALID_ENUM";
1801             break;
1802     }
1803     return os;
1804 }
1805 
1806 template <>
FromCLenum(CLenum from)1807 PlatformInfo FromCLenum<PlatformInfo>(CLenum from)
1808 {
1809     switch (from)
1810     {
1811         case CL_PLATFORM_PROFILE:
1812             return PlatformInfo::Profile;
1813         case CL_PLATFORM_VERSION:
1814             return PlatformInfo::Version;
1815         case CL_PLATFORM_NAME:
1816             return PlatformInfo::Name;
1817         case CL_PLATFORM_VENDOR:
1818             return PlatformInfo::Vendor;
1819         case CL_PLATFORM_EXTENSIONS:
1820             return PlatformInfo::Extensions;
1821         case CL_PLATFORM_HOST_TIMER_RESOLUTION:
1822             return PlatformInfo::HostTimerResolution;
1823         case CL_PLATFORM_NUMERIC_VERSION:
1824             return PlatformInfo::NumericVersion;
1825         case CL_PLATFORM_EXTENSIONS_WITH_VERSION:
1826             return PlatformInfo::ExtensionsWithVersion;
1827         case CL_PLATFORM_ICD_SUFFIX_KHR:
1828             return PlatformInfo::IcdSuffix;
1829         default:
1830             return PlatformInfo::InvalidEnum;
1831     }
1832 }
1833 
ToCLenum(PlatformInfo from)1834 CLenum ToCLenum(PlatformInfo from)
1835 {
1836     switch (from)
1837     {
1838         case PlatformInfo::Profile:
1839             return CL_PLATFORM_PROFILE;
1840         case PlatformInfo::Version:
1841             return CL_PLATFORM_VERSION;
1842         case PlatformInfo::Name:
1843             return CL_PLATFORM_NAME;
1844         case PlatformInfo::Vendor:
1845             return CL_PLATFORM_VENDOR;
1846         case PlatformInfo::Extensions:
1847             return CL_PLATFORM_EXTENSIONS;
1848         case PlatformInfo::HostTimerResolution:
1849             return CL_PLATFORM_HOST_TIMER_RESOLUTION;
1850         case PlatformInfo::NumericVersion:
1851             return CL_PLATFORM_NUMERIC_VERSION;
1852         case PlatformInfo::ExtensionsWithVersion:
1853             return CL_PLATFORM_EXTENSIONS_WITH_VERSION;
1854         case PlatformInfo::IcdSuffix:
1855             return CL_PLATFORM_ICD_SUFFIX_KHR;
1856         default:
1857             UNREACHABLE();
1858             return 0;
1859     }
1860 }
1861 
operator <<(std::ostream & os,PlatformInfo value)1862 std::ostream &operator<<(std::ostream &os, PlatformInfo value)
1863 {
1864     switch (value)
1865     {
1866         case PlatformInfo::Profile:
1867             os << "CL_PLATFORM_PROFILE";
1868             break;
1869         case PlatformInfo::Version:
1870             os << "CL_PLATFORM_VERSION";
1871             break;
1872         case PlatformInfo::Name:
1873             os << "CL_PLATFORM_NAME";
1874             break;
1875         case PlatformInfo::Vendor:
1876             os << "CL_PLATFORM_VENDOR";
1877             break;
1878         case PlatformInfo::Extensions:
1879             os << "CL_PLATFORM_EXTENSIONS";
1880             break;
1881         case PlatformInfo::HostTimerResolution:
1882             os << "CL_PLATFORM_HOST_TIMER_RESOLUTION";
1883             break;
1884         case PlatformInfo::NumericVersion:
1885             os << "CL_PLATFORM_NUMERIC_VERSION";
1886             break;
1887         case PlatformInfo::ExtensionsWithVersion:
1888             os << "CL_PLATFORM_EXTENSIONS_WITH_VERSION";
1889             break;
1890         case PlatformInfo::IcdSuffix:
1891             os << "CL_PLATFORM_ICD_SUFFIX_KHR";
1892             break;
1893         default:
1894             os << "GL_INVALID_ENUM";
1895             break;
1896     }
1897     return os;
1898 }
1899 
1900 template <>
FromCLenum(CLenum from)1901 ProfilingInfo FromCLenum<ProfilingInfo>(CLenum from)
1902 {
1903     switch (from)
1904     {
1905         case CL_PROFILING_COMMAND_QUEUED:
1906             return ProfilingInfo::CommandQueued;
1907         case CL_PROFILING_COMMAND_SUBMIT:
1908             return ProfilingInfo::CommandSubmit;
1909         case CL_PROFILING_COMMAND_START:
1910             return ProfilingInfo::CommandStart;
1911         case CL_PROFILING_COMMAND_END:
1912             return ProfilingInfo::CommandEnd;
1913         case CL_PROFILING_COMMAND_COMPLETE:
1914             return ProfilingInfo::CommandComplete;
1915         default:
1916             return ProfilingInfo::InvalidEnum;
1917     }
1918 }
1919 
ToCLenum(ProfilingInfo from)1920 CLenum ToCLenum(ProfilingInfo from)
1921 {
1922     switch (from)
1923     {
1924         case ProfilingInfo::CommandQueued:
1925             return CL_PROFILING_COMMAND_QUEUED;
1926         case ProfilingInfo::CommandSubmit:
1927             return CL_PROFILING_COMMAND_SUBMIT;
1928         case ProfilingInfo::CommandStart:
1929             return CL_PROFILING_COMMAND_START;
1930         case ProfilingInfo::CommandEnd:
1931             return CL_PROFILING_COMMAND_END;
1932         case ProfilingInfo::CommandComplete:
1933             return CL_PROFILING_COMMAND_COMPLETE;
1934         default:
1935             UNREACHABLE();
1936             return 0;
1937     }
1938 }
1939 
operator <<(std::ostream & os,ProfilingInfo value)1940 std::ostream &operator<<(std::ostream &os, ProfilingInfo value)
1941 {
1942     switch (value)
1943     {
1944         case ProfilingInfo::CommandQueued:
1945             os << "CL_PROFILING_COMMAND_QUEUED";
1946             break;
1947         case ProfilingInfo::CommandSubmit:
1948             os << "CL_PROFILING_COMMAND_SUBMIT";
1949             break;
1950         case ProfilingInfo::CommandStart:
1951             os << "CL_PROFILING_COMMAND_START";
1952             break;
1953         case ProfilingInfo::CommandEnd:
1954             os << "CL_PROFILING_COMMAND_END";
1955             break;
1956         case ProfilingInfo::CommandComplete:
1957             os << "CL_PROFILING_COMMAND_COMPLETE";
1958             break;
1959         default:
1960             os << "GL_INVALID_ENUM";
1961             break;
1962     }
1963     return os;
1964 }
1965 
1966 template <>
FromCLenum(CLenum from)1967 ProgramBuildInfo FromCLenum<ProgramBuildInfo>(CLenum from)
1968 {
1969     switch (from)
1970     {
1971         case CL_PROGRAM_BUILD_STATUS:
1972             return ProgramBuildInfo::Status;
1973         case CL_PROGRAM_BUILD_OPTIONS:
1974             return ProgramBuildInfo::Options;
1975         case CL_PROGRAM_BUILD_LOG:
1976             return ProgramBuildInfo::Log;
1977         case CL_PROGRAM_BINARY_TYPE:
1978             return ProgramBuildInfo::BinaryType;
1979         case CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE:
1980             return ProgramBuildInfo::GlobalVariableTotalSize;
1981         default:
1982             return ProgramBuildInfo::InvalidEnum;
1983     }
1984 }
1985 
ToCLenum(ProgramBuildInfo from)1986 CLenum ToCLenum(ProgramBuildInfo from)
1987 {
1988     switch (from)
1989     {
1990         case ProgramBuildInfo::Status:
1991             return CL_PROGRAM_BUILD_STATUS;
1992         case ProgramBuildInfo::Options:
1993             return CL_PROGRAM_BUILD_OPTIONS;
1994         case ProgramBuildInfo::Log:
1995             return CL_PROGRAM_BUILD_LOG;
1996         case ProgramBuildInfo::BinaryType:
1997             return CL_PROGRAM_BINARY_TYPE;
1998         case ProgramBuildInfo::GlobalVariableTotalSize:
1999             return CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE;
2000         default:
2001             UNREACHABLE();
2002             return 0;
2003     }
2004 }
2005 
operator <<(std::ostream & os,ProgramBuildInfo value)2006 std::ostream &operator<<(std::ostream &os, ProgramBuildInfo value)
2007 {
2008     switch (value)
2009     {
2010         case ProgramBuildInfo::Status:
2011             os << "CL_PROGRAM_BUILD_STATUS";
2012             break;
2013         case ProgramBuildInfo::Options:
2014             os << "CL_PROGRAM_BUILD_OPTIONS";
2015             break;
2016         case ProgramBuildInfo::Log:
2017             os << "CL_PROGRAM_BUILD_LOG";
2018             break;
2019         case ProgramBuildInfo::BinaryType:
2020             os << "CL_PROGRAM_BINARY_TYPE";
2021             break;
2022         case ProgramBuildInfo::GlobalVariableTotalSize:
2023             os << "CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE";
2024             break;
2025         default:
2026             os << "GL_INVALID_ENUM";
2027             break;
2028     }
2029     return os;
2030 }
2031 
2032 template <>
FromCLenum(CLenum from)2033 ProgramInfo FromCLenum<ProgramInfo>(CLenum from)
2034 {
2035     switch (from)
2036     {
2037         case CL_PROGRAM_REFERENCE_COUNT:
2038             return ProgramInfo::ReferenceCount;
2039         case CL_PROGRAM_CONTEXT:
2040             return ProgramInfo::Context;
2041         case CL_PROGRAM_NUM_DEVICES:
2042             return ProgramInfo::NumDevices;
2043         case CL_PROGRAM_DEVICES:
2044             return ProgramInfo::Devices;
2045         case CL_PROGRAM_SOURCE:
2046             return ProgramInfo::Source;
2047         case CL_PROGRAM_BINARY_SIZES:
2048             return ProgramInfo::BinarySizes;
2049         case CL_PROGRAM_BINARIES:
2050             return ProgramInfo::Binaries;
2051         case CL_PROGRAM_NUM_KERNELS:
2052             return ProgramInfo::NumKernels;
2053         case CL_PROGRAM_KERNEL_NAMES:
2054             return ProgramInfo::KernelNames;
2055         case CL_PROGRAM_IL:
2056             return ProgramInfo::IL;
2057         case CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT:
2058             return ProgramInfo::ScopeGlobalCtorsPresent;
2059         case CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT:
2060             return ProgramInfo::ScopeGlobalDtorsPresent;
2061         default:
2062             return ProgramInfo::InvalidEnum;
2063     }
2064 }
2065 
ToCLenum(ProgramInfo from)2066 CLenum ToCLenum(ProgramInfo from)
2067 {
2068     switch (from)
2069     {
2070         case ProgramInfo::ReferenceCount:
2071             return CL_PROGRAM_REFERENCE_COUNT;
2072         case ProgramInfo::Context:
2073             return CL_PROGRAM_CONTEXT;
2074         case ProgramInfo::NumDevices:
2075             return CL_PROGRAM_NUM_DEVICES;
2076         case ProgramInfo::Devices:
2077             return CL_PROGRAM_DEVICES;
2078         case ProgramInfo::Source:
2079             return CL_PROGRAM_SOURCE;
2080         case ProgramInfo::BinarySizes:
2081             return CL_PROGRAM_BINARY_SIZES;
2082         case ProgramInfo::Binaries:
2083             return CL_PROGRAM_BINARIES;
2084         case ProgramInfo::NumKernels:
2085             return CL_PROGRAM_NUM_KERNELS;
2086         case ProgramInfo::KernelNames:
2087             return CL_PROGRAM_KERNEL_NAMES;
2088         case ProgramInfo::IL:
2089             return CL_PROGRAM_IL;
2090         case ProgramInfo::ScopeGlobalCtorsPresent:
2091             return CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT;
2092         case ProgramInfo::ScopeGlobalDtorsPresent:
2093             return CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT;
2094         default:
2095             UNREACHABLE();
2096             return 0;
2097     }
2098 }
2099 
operator <<(std::ostream & os,ProgramInfo value)2100 std::ostream &operator<<(std::ostream &os, ProgramInfo value)
2101 {
2102     switch (value)
2103     {
2104         case ProgramInfo::ReferenceCount:
2105             os << "CL_PROGRAM_REFERENCE_COUNT";
2106             break;
2107         case ProgramInfo::Context:
2108             os << "CL_PROGRAM_CONTEXT";
2109             break;
2110         case ProgramInfo::NumDevices:
2111             os << "CL_PROGRAM_NUM_DEVICES";
2112             break;
2113         case ProgramInfo::Devices:
2114             os << "CL_PROGRAM_DEVICES";
2115             break;
2116         case ProgramInfo::Source:
2117             os << "CL_PROGRAM_SOURCE";
2118             break;
2119         case ProgramInfo::BinarySizes:
2120             os << "CL_PROGRAM_BINARY_SIZES";
2121             break;
2122         case ProgramInfo::Binaries:
2123             os << "CL_PROGRAM_BINARIES";
2124             break;
2125         case ProgramInfo::NumKernels:
2126             os << "CL_PROGRAM_NUM_KERNELS";
2127             break;
2128         case ProgramInfo::KernelNames:
2129             os << "CL_PROGRAM_KERNEL_NAMES";
2130             break;
2131         case ProgramInfo::IL:
2132             os << "CL_PROGRAM_IL";
2133             break;
2134         case ProgramInfo::ScopeGlobalCtorsPresent:
2135             os << "CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT";
2136             break;
2137         case ProgramInfo::ScopeGlobalDtorsPresent:
2138             os << "CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT";
2139             break;
2140         default:
2141             os << "GL_INVALID_ENUM";
2142             break;
2143     }
2144     return os;
2145 }
2146 
2147 template <>
FromCLenum(CLenum from)2148 SamplerInfo FromCLenum<SamplerInfo>(CLenum from)
2149 {
2150     switch (from)
2151     {
2152         case CL_SAMPLER_REFERENCE_COUNT:
2153             return SamplerInfo::ReferenceCount;
2154         case CL_SAMPLER_CONTEXT:
2155             return SamplerInfo::Context;
2156         case CL_SAMPLER_NORMALIZED_COORDS:
2157             return SamplerInfo::NormalizedCoords;
2158         case CL_SAMPLER_ADDRESSING_MODE:
2159             return SamplerInfo::AddressingMode;
2160         case CL_SAMPLER_FILTER_MODE:
2161             return SamplerInfo::FilterMode;
2162         case CL_SAMPLER_PROPERTIES:
2163             return SamplerInfo::Properties;
2164         default:
2165             return SamplerInfo::InvalidEnum;
2166     }
2167 }
2168 
ToCLenum(SamplerInfo from)2169 CLenum ToCLenum(SamplerInfo from)
2170 {
2171     switch (from)
2172     {
2173         case SamplerInfo::ReferenceCount:
2174             return CL_SAMPLER_REFERENCE_COUNT;
2175         case SamplerInfo::Context:
2176             return CL_SAMPLER_CONTEXT;
2177         case SamplerInfo::NormalizedCoords:
2178             return CL_SAMPLER_NORMALIZED_COORDS;
2179         case SamplerInfo::AddressingMode:
2180             return CL_SAMPLER_ADDRESSING_MODE;
2181         case SamplerInfo::FilterMode:
2182             return CL_SAMPLER_FILTER_MODE;
2183         case SamplerInfo::Properties:
2184             return CL_SAMPLER_PROPERTIES;
2185         default:
2186             UNREACHABLE();
2187             return 0;
2188     }
2189 }
2190 
operator <<(std::ostream & os,SamplerInfo value)2191 std::ostream &operator<<(std::ostream &os, SamplerInfo value)
2192 {
2193     switch (value)
2194     {
2195         case SamplerInfo::ReferenceCount:
2196             os << "CL_SAMPLER_REFERENCE_COUNT";
2197             break;
2198         case SamplerInfo::Context:
2199             os << "CL_SAMPLER_CONTEXT";
2200             break;
2201         case SamplerInfo::NormalizedCoords:
2202             os << "CL_SAMPLER_NORMALIZED_COORDS";
2203             break;
2204         case SamplerInfo::AddressingMode:
2205             os << "CL_SAMPLER_ADDRESSING_MODE";
2206             break;
2207         case SamplerInfo::FilterMode:
2208             os << "CL_SAMPLER_FILTER_MODE";
2209             break;
2210         case SamplerInfo::Properties:
2211             os << "CL_SAMPLER_PROPERTIES";
2212             break;
2213         default:
2214             os << "GL_INVALID_ENUM";
2215             break;
2216     }
2217     return os;
2218 }
2219 
2220 }  // namespace cl
2221