1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by gen_packed_gl_enums.py using data from packed_egl_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 // PackedEGLEnums_autogen.cpp:
9 // Implements ANGLE-specific enums classes for EGLenums and functions operating
10 // on them.
11
12 #include "common/PackedEGLEnums_autogen.h"
13 #include "common/debug.h"
14
15 namespace egl
16 {
17
18 template <>
FromEGLenum(EGLenum from)19 CompositorTiming FromEGLenum<CompositorTiming>(EGLenum from)
20 {
21 switch (from)
22 {
23 case EGL_COMPOSITE_DEADLINE_ANDROID:
24 return CompositorTiming::CompositeDeadline;
25 case EGL_COMPOSITE_INTERVAL_ANDROID:
26 return CompositorTiming::CompositInterval;
27 case EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID:
28 return CompositorTiming::CompositToPresentLatency;
29 default:
30 return CompositorTiming::InvalidEnum;
31 }
32 }
33
ToEGLenum(CompositorTiming from)34 EGLenum ToEGLenum(CompositorTiming from)
35 {
36 switch (from)
37 {
38 case CompositorTiming::CompositeDeadline:
39 return EGL_COMPOSITE_DEADLINE_ANDROID;
40 case CompositorTiming::CompositInterval:
41 return EGL_COMPOSITE_INTERVAL_ANDROID;
42 case CompositorTiming::CompositToPresentLatency:
43 return EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID;
44 default:
45 UNREACHABLE();
46 return 0;
47 }
48 }
49
operator <<(std::ostream & os,CompositorTiming value)50 std::ostream &operator<<(std::ostream &os, CompositorTiming value)
51 {
52 switch (value)
53 {
54 case CompositorTiming::CompositeDeadline:
55 os << "EGL_COMPOSITE_DEADLINE_ANDROID";
56 break;
57 case CompositorTiming::CompositInterval:
58 os << "EGL_COMPOSITE_INTERVAL_ANDROID";
59 break;
60 case CompositorTiming::CompositToPresentLatency:
61 os << "EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID";
62 break;
63 default:
64 os << "GL_INVALID_ENUM";
65 break;
66 }
67 return os;
68 }
69
70 template <>
FromEGLenum(EGLenum from)71 ContextPriority FromEGLenum<ContextPriority>(EGLenum from)
72 {
73 switch (from)
74 {
75 case EGL_CONTEXT_PRIORITY_LOW_IMG:
76 return ContextPriority::Low;
77 case EGL_CONTEXT_PRIORITY_MEDIUM_IMG:
78 return ContextPriority::Medium;
79 case EGL_CONTEXT_PRIORITY_HIGH_IMG:
80 return ContextPriority::High;
81 default:
82 return ContextPriority::InvalidEnum;
83 }
84 }
85
ToEGLenum(ContextPriority from)86 EGLenum ToEGLenum(ContextPriority from)
87 {
88 switch (from)
89 {
90 case ContextPriority::Low:
91 return EGL_CONTEXT_PRIORITY_LOW_IMG;
92 case ContextPriority::Medium:
93 return EGL_CONTEXT_PRIORITY_MEDIUM_IMG;
94 case ContextPriority::High:
95 return EGL_CONTEXT_PRIORITY_HIGH_IMG;
96 default:
97 UNREACHABLE();
98 return 0;
99 }
100 }
101
operator <<(std::ostream & os,ContextPriority value)102 std::ostream &operator<<(std::ostream &os, ContextPriority value)
103 {
104 switch (value)
105 {
106 case ContextPriority::Low:
107 os << "EGL_CONTEXT_PRIORITY_LOW_IMG";
108 break;
109 case ContextPriority::Medium:
110 os << "EGL_CONTEXT_PRIORITY_MEDIUM_IMG";
111 break;
112 case ContextPriority::High:
113 os << "EGL_CONTEXT_PRIORITY_HIGH_IMG";
114 break;
115 default:
116 os << "GL_INVALID_ENUM";
117 break;
118 }
119 return os;
120 }
121
122 template <>
FromEGLenum(EGLenum from)123 MessageType FromEGLenum<MessageType>(EGLenum from)
124 {
125 switch (from)
126 {
127 case EGL_DEBUG_MSG_CRITICAL_KHR:
128 return MessageType::Critical;
129 case EGL_DEBUG_MSG_ERROR_KHR:
130 return MessageType::Error;
131 case EGL_DEBUG_MSG_WARN_KHR:
132 return MessageType::Warn;
133 case EGL_DEBUG_MSG_INFO_KHR:
134 return MessageType::Info;
135 default:
136 return MessageType::InvalidEnum;
137 }
138 }
139
ToEGLenum(MessageType from)140 EGLenum ToEGLenum(MessageType from)
141 {
142 switch (from)
143 {
144 case MessageType::Critical:
145 return EGL_DEBUG_MSG_CRITICAL_KHR;
146 case MessageType::Error:
147 return EGL_DEBUG_MSG_ERROR_KHR;
148 case MessageType::Warn:
149 return EGL_DEBUG_MSG_WARN_KHR;
150 case MessageType::Info:
151 return EGL_DEBUG_MSG_INFO_KHR;
152 default:
153 UNREACHABLE();
154 return 0;
155 }
156 }
157
operator <<(std::ostream & os,MessageType value)158 std::ostream &operator<<(std::ostream &os, MessageType value)
159 {
160 switch (value)
161 {
162 case MessageType::Critical:
163 os << "EGL_DEBUG_MSG_CRITICAL_KHR";
164 break;
165 case MessageType::Error:
166 os << "EGL_DEBUG_MSG_ERROR_KHR";
167 break;
168 case MessageType::Warn:
169 os << "EGL_DEBUG_MSG_WARN_KHR";
170 break;
171 case MessageType::Info:
172 os << "EGL_DEBUG_MSG_INFO_KHR";
173 break;
174 default:
175 os << "GL_INVALID_ENUM";
176 break;
177 }
178 return os;
179 }
180
181 template <>
FromEGLenum(EGLenum from)182 ObjectType FromEGLenum<ObjectType>(EGLenum from)
183 {
184 switch (from)
185 {
186 case EGL_OBJECT_THREAD_KHR:
187 return ObjectType::Thread;
188 case EGL_OBJECT_DISPLAY_KHR:
189 return ObjectType::Display;
190 case EGL_OBJECT_CONTEXT_KHR:
191 return ObjectType::Context;
192 case EGL_OBJECT_SURFACE_KHR:
193 return ObjectType::Surface;
194 case EGL_OBJECT_IMAGE_KHR:
195 return ObjectType::Image;
196 case EGL_OBJECT_SYNC_KHR:
197 return ObjectType::Sync;
198 case EGL_OBJECT_STREAM_KHR:
199 return ObjectType::Stream;
200 default:
201 return ObjectType::InvalidEnum;
202 }
203 }
204
ToEGLenum(ObjectType from)205 EGLenum ToEGLenum(ObjectType from)
206 {
207 switch (from)
208 {
209 case ObjectType::Thread:
210 return EGL_OBJECT_THREAD_KHR;
211 case ObjectType::Display:
212 return EGL_OBJECT_DISPLAY_KHR;
213 case ObjectType::Context:
214 return EGL_OBJECT_CONTEXT_KHR;
215 case ObjectType::Surface:
216 return EGL_OBJECT_SURFACE_KHR;
217 case ObjectType::Image:
218 return EGL_OBJECT_IMAGE_KHR;
219 case ObjectType::Sync:
220 return EGL_OBJECT_SYNC_KHR;
221 case ObjectType::Stream:
222 return EGL_OBJECT_STREAM_KHR;
223 default:
224 UNREACHABLE();
225 return 0;
226 }
227 }
228
operator <<(std::ostream & os,ObjectType value)229 std::ostream &operator<<(std::ostream &os, ObjectType value)
230 {
231 switch (value)
232 {
233 case ObjectType::Thread:
234 os << "EGL_OBJECT_THREAD_KHR";
235 break;
236 case ObjectType::Display:
237 os << "EGL_OBJECT_DISPLAY_KHR";
238 break;
239 case ObjectType::Context:
240 os << "EGL_OBJECT_CONTEXT_KHR";
241 break;
242 case ObjectType::Surface:
243 os << "EGL_OBJECT_SURFACE_KHR";
244 break;
245 case ObjectType::Image:
246 os << "EGL_OBJECT_IMAGE_KHR";
247 break;
248 case ObjectType::Sync:
249 os << "EGL_OBJECT_SYNC_KHR";
250 break;
251 case ObjectType::Stream:
252 os << "EGL_OBJECT_STREAM_KHR";
253 break;
254 default:
255 os << "GL_INVALID_ENUM";
256 break;
257 }
258 return os;
259 }
260
261 template <>
FromEGLenum(EGLenum from)262 TextureFormat FromEGLenum<TextureFormat>(EGLenum from)
263 {
264 switch (from)
265 {
266 case EGL_NO_TEXTURE:
267 return TextureFormat::NoTexture;
268 case EGL_TEXTURE_RGB:
269 return TextureFormat::RGB;
270 case EGL_TEXTURE_RGBA:
271 return TextureFormat::RGBA;
272 default:
273 return TextureFormat::InvalidEnum;
274 }
275 }
276
ToEGLenum(TextureFormat from)277 EGLenum ToEGLenum(TextureFormat from)
278 {
279 switch (from)
280 {
281 case TextureFormat::NoTexture:
282 return EGL_NO_TEXTURE;
283 case TextureFormat::RGB:
284 return EGL_TEXTURE_RGB;
285 case TextureFormat::RGBA:
286 return EGL_TEXTURE_RGBA;
287 default:
288 UNREACHABLE();
289 return 0;
290 }
291 }
292
operator <<(std::ostream & os,TextureFormat value)293 std::ostream &operator<<(std::ostream &os, TextureFormat value)
294 {
295 switch (value)
296 {
297 case TextureFormat::NoTexture:
298 os << "EGL_NO_TEXTURE";
299 break;
300 case TextureFormat::RGB:
301 os << "EGL_TEXTURE_RGB";
302 break;
303 case TextureFormat::RGBA:
304 os << "EGL_TEXTURE_RGBA";
305 break;
306 default:
307 os << "GL_INVALID_ENUM";
308 break;
309 }
310 return os;
311 }
312
313 template <>
FromEGLenum(EGLenum from)314 Timestamp FromEGLenum<Timestamp>(EGLenum from)
315 {
316 switch (from)
317 {
318 case EGL_REQUESTED_PRESENT_TIME_ANDROID:
319 return Timestamp::RequestedPresentTime;
320 case EGL_RENDERING_COMPLETE_TIME_ANDROID:
321 return Timestamp::RenderingCompleteTime;
322 case EGL_COMPOSITION_LATCH_TIME_ANDROID:
323 return Timestamp::CompositionLatchTime;
324 case EGL_FIRST_COMPOSITION_START_TIME_ANDROID:
325 return Timestamp::FirstCompositionStartTime;
326 case EGL_LAST_COMPOSITION_START_TIME_ANDROID:
327 return Timestamp::LastCompositionStartTime;
328 case EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID:
329 return Timestamp::FirstCompositionGPUFinishedTime;
330 case EGL_DISPLAY_PRESENT_TIME_ANDROID:
331 return Timestamp::DisplayPresentTime;
332 case EGL_DEQUEUE_READY_TIME_ANDROID:
333 return Timestamp::DequeueReadyTime;
334 case EGL_READS_DONE_TIME_ANDROID:
335 return Timestamp::ReadsDoneTime;
336 default:
337 return Timestamp::InvalidEnum;
338 }
339 }
340
ToEGLenum(Timestamp from)341 EGLenum ToEGLenum(Timestamp from)
342 {
343 switch (from)
344 {
345 case Timestamp::RequestedPresentTime:
346 return EGL_REQUESTED_PRESENT_TIME_ANDROID;
347 case Timestamp::RenderingCompleteTime:
348 return EGL_RENDERING_COMPLETE_TIME_ANDROID;
349 case Timestamp::CompositionLatchTime:
350 return EGL_COMPOSITION_LATCH_TIME_ANDROID;
351 case Timestamp::FirstCompositionStartTime:
352 return EGL_FIRST_COMPOSITION_START_TIME_ANDROID;
353 case Timestamp::LastCompositionStartTime:
354 return EGL_LAST_COMPOSITION_START_TIME_ANDROID;
355 case Timestamp::FirstCompositionGPUFinishedTime:
356 return EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID;
357 case Timestamp::DisplayPresentTime:
358 return EGL_DISPLAY_PRESENT_TIME_ANDROID;
359 case Timestamp::DequeueReadyTime:
360 return EGL_DEQUEUE_READY_TIME_ANDROID;
361 case Timestamp::ReadsDoneTime:
362 return EGL_READS_DONE_TIME_ANDROID;
363 default:
364 UNREACHABLE();
365 return 0;
366 }
367 }
368
operator <<(std::ostream & os,Timestamp value)369 std::ostream &operator<<(std::ostream &os, Timestamp value)
370 {
371 switch (value)
372 {
373 case Timestamp::RequestedPresentTime:
374 os << "EGL_REQUESTED_PRESENT_TIME_ANDROID";
375 break;
376 case Timestamp::RenderingCompleteTime:
377 os << "EGL_RENDERING_COMPLETE_TIME_ANDROID";
378 break;
379 case Timestamp::CompositionLatchTime:
380 os << "EGL_COMPOSITION_LATCH_TIME_ANDROID";
381 break;
382 case Timestamp::FirstCompositionStartTime:
383 os << "EGL_FIRST_COMPOSITION_START_TIME_ANDROID";
384 break;
385 case Timestamp::LastCompositionStartTime:
386 os << "EGL_LAST_COMPOSITION_START_TIME_ANDROID";
387 break;
388 case Timestamp::FirstCompositionGPUFinishedTime:
389 os << "EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID";
390 break;
391 case Timestamp::DisplayPresentTime:
392 os << "EGL_DISPLAY_PRESENT_TIME_ANDROID";
393 break;
394 case Timestamp::DequeueReadyTime:
395 os << "EGL_DEQUEUE_READY_TIME_ANDROID";
396 break;
397 case Timestamp::ReadsDoneTime:
398 os << "EGL_READS_DONE_TIME_ANDROID";
399 break;
400 default:
401 os << "GL_INVALID_ENUM";
402 break;
403 }
404 return os;
405 }
406
407 } // namespace egl
408