1// GENERATED FILE - DO NOT EDIT.
2// Generated by gen_packed_gl_enums.py using data from packed_egl_enums.json.
3//
4// Copyright 2019 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
15namespace egl
16{
17
18template <>
19CompositorTiming 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
34EGLenum 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
50template <>
51MessageType FromEGLenum<MessageType>(EGLenum from)
52{
53 switch (from)
54 {
55 case EGL_DEBUG_MSG_CRITICAL_KHR:
56 return MessageType::Critical;
57 case EGL_DEBUG_MSG_ERROR_KHR:
58 return MessageType::Error;
59 case EGL_DEBUG_MSG_WARN_KHR:
60 return MessageType::Warn;
61 case EGL_DEBUG_MSG_INFO_KHR:
62 return MessageType::Info;
63 default:
64 return MessageType::InvalidEnum;
65 }
66}
67
68EGLenum ToEGLenum(MessageType from)
69{
70 switch (from)
71 {
72 case MessageType::Critical:
73 return EGL_DEBUG_MSG_CRITICAL_KHR;
74 case MessageType::Error:
75 return EGL_DEBUG_MSG_ERROR_KHR;
76 case MessageType::Warn:
77 return EGL_DEBUG_MSG_WARN_KHR;
78 case MessageType::Info:
79 return EGL_DEBUG_MSG_INFO_KHR;
80 default:
81 UNREACHABLE();
82 return 0;
83 }
84}
85
86template <>
87ObjectType FromEGLenum<ObjectType>(EGLenum from)
88{
89 switch (from)
90 {
91 case EGL_OBJECT_THREAD_KHR:
92 return ObjectType::Thread;
93 case EGL_OBJECT_DISPLAY_KHR:
94 return ObjectType::Display;
95 case EGL_OBJECT_CONTEXT_KHR:
96 return ObjectType::Context;
97 case EGL_OBJECT_SURFACE_KHR:
98 return ObjectType::Surface;
99 case EGL_OBJECT_IMAGE_KHR:
100 return ObjectType::Image;
101 case EGL_OBJECT_SYNC_KHR:
102 return ObjectType::Sync;
103 case EGL_OBJECT_STREAM_KHR:
104 return ObjectType::Stream;
105 default:
106 return ObjectType::InvalidEnum;
107 }
108}
109
110EGLenum ToEGLenum(ObjectType from)
111{
112 switch (from)
113 {
114 case ObjectType::Thread:
115 return EGL_OBJECT_THREAD_KHR;
116 case ObjectType::Display:
117 return EGL_OBJECT_DISPLAY_KHR;
118 case ObjectType::Context:
119 return EGL_OBJECT_CONTEXT_KHR;
120 case ObjectType::Surface:
121 return EGL_OBJECT_SURFACE_KHR;
122 case ObjectType::Image:
123 return EGL_OBJECT_IMAGE_KHR;
124 case ObjectType::Sync:
125 return EGL_OBJECT_SYNC_KHR;
126 case ObjectType::Stream:
127 return EGL_OBJECT_STREAM_KHR;
128 default:
129 UNREACHABLE();
130 return 0;
131 }
132}
133
134template <>
135TextureFormat FromEGLenum<TextureFormat>(EGLenum from)
136{
137 switch (from)
138 {
139 case EGL_NO_TEXTURE:
140 return TextureFormat::NoTexture;
141 case EGL_TEXTURE_RGB:
142 return TextureFormat::RGB;
143 case EGL_TEXTURE_RGBA:
144 return TextureFormat::RGBA;
145 default:
146 return TextureFormat::InvalidEnum;
147 }
148}
149
150EGLenum ToEGLenum(TextureFormat from)
151{
152 switch (from)
153 {
154 case TextureFormat::NoTexture:
155 return EGL_NO_TEXTURE;
156 case TextureFormat::RGB:
157 return EGL_TEXTURE_RGB;
158 case TextureFormat::RGBA:
159 return EGL_TEXTURE_RGBA;
160 default:
161 UNREACHABLE();
162 return 0;
163 }
164}
165
166template <>
167Timestamp FromEGLenum<Timestamp>(EGLenum from)
168{
169 switch (from)
170 {
171 case EGL_REQUESTED_PRESENT_TIME_ANDROID:
172 return Timestamp::RequestedPresentTime;
173 case EGL_RENDERING_COMPLETE_TIME_ANDROID:
174 return Timestamp::RenderingCompleteTime;
175 case EGL_COMPOSITION_LATCH_TIME_ANDROID:
176 return Timestamp::CompositionLatchTime;
177 case EGL_FIRST_COMPOSITION_START_TIME_ANDROID:
178 return Timestamp::FirstCompositionStartTime;
179 case EGL_LAST_COMPOSITION_START_TIME_ANDROID:
180 return Timestamp::LastCompositionStartTime;
181 case EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID:
182 return Timestamp::FirstCompositionGPUFinishedTime;
183 case EGL_DISPLAY_PRESENT_TIME_ANDROID:
184 return Timestamp::DisplayPresentTime;
185 case EGL_DEQUEUE_READY_TIME_ANDROID:
186 return Timestamp::DequeueReadyTime;
187 case EGL_READS_DONE_TIME_ANDROID:
188 return Timestamp::ReadsDoneTime;
189 default:
190 return Timestamp::InvalidEnum;
191 }
192}
193
194EGLenum ToEGLenum(Timestamp from)
195{
196 switch (from)
197 {
198 case Timestamp::RequestedPresentTime:
199 return EGL_REQUESTED_PRESENT_TIME_ANDROID;
200 case Timestamp::RenderingCompleteTime:
201 return EGL_RENDERING_COMPLETE_TIME_ANDROID;
202 case Timestamp::CompositionLatchTime:
203 return EGL_COMPOSITION_LATCH_TIME_ANDROID;
204 case Timestamp::FirstCompositionStartTime:
205 return EGL_FIRST_COMPOSITION_START_TIME_ANDROID;
206 case Timestamp::LastCompositionStartTime:
207 return EGL_LAST_COMPOSITION_START_TIME_ANDROID;
208 case Timestamp::FirstCompositionGPUFinishedTime:
209 return EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID;
210 case Timestamp::DisplayPresentTime:
211 return EGL_DISPLAY_PRESENT_TIME_ANDROID;
212 case Timestamp::DequeueReadyTime:
213 return EGL_DEQUEUE_READY_TIME_ANDROID;
214 case Timestamp::ReadsDoneTime:
215 return EGL_READS_DONE_TIME_ANDROID;
216 default:
217 UNREACHABLE();
218 return 0;
219 }
220}
221
222} // namespace egl
223