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