blob: 33a77c4470b7dc27d20f41918bbc5ceca1323cfa [file] [log] [blame]
Jesse Hall47743382013-02-08 11:13:46 -08001/*
Mathias Agopian518ec112011-05-13 16:21:08 -07002 ** Copyright 2007, The Android Open Source Project
3 **
Jesse Hall47743382013-02-08 11:13:46 -08004 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
Mathias Agopian518ec112011-05-13 16:21:08 -07007 **
Jesse Hall47743382013-02-08 11:13:46 -08008 ** http://www.apache.org/licenses/LICENSE-2.0
Mathias Agopian518ec112011-05-13 16:21:08 -07009 **
Jesse Hall47743382013-02-08 11:13:46 -080010 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
Mathias Agopian518ec112011-05-13 16:21:08 -070014 ** limitations under the License.
15 */
16
Mathias Agopian311b4792017-02-28 15:00:49 -080017#include "egl_object.h"
18
Michael Lentinee2fc6f82015-07-28 16:30:10 -070019#include <sstream>
20
Mathias Agopian518ec112011-05-13 16:21:08 -070021namespace android {
Mathias Agopian518ec112011-05-13 16:21:08 -070022
Yiwei Zhang8af03062020-08-12 21:28:15 -070023egl_object_t::egl_object_t(egl_display_t* disp) : display(disp), count(1) {
Mathias Agopian5b287a62011-05-16 18:58:55 -070024 // NOTE: this does an implicit incRef
Mathias Agopian518ec112011-05-13 16:21:08 -070025 display->addObject(this);
26}
27
Yiwei Zhang8af03062020-08-12 21:28:15 -070028egl_object_t::~egl_object_t() {}
Mathias Agopian518ec112011-05-13 16:21:08 -070029
Mathias Agopian5b287a62011-05-16 18:58:55 -070030void egl_object_t::terminate() {
31 // this marks the object as "terminated"
32 display->removeObject(this);
33 if (decRef() == 1) {
34 // shouldn't happen because this is called from LocalRef
Steve Blocke6f43dd2012-01-06 19:20:56 +000035 ALOGE("egl_object_t::terminate() removed the last reference!");
Mathias Agopian5b287a62011-05-16 18:58:55 -070036 }
37}
38
39void egl_object_t::destroy() {
40 if (decRef() == 1) {
41 delete this;
42 }
43}
44
Mathias Agopianf0480de2011-11-13 20:50:07 -080045bool egl_object_t::get(egl_display_t const* display, egl_object_t* object) {
Mathias Agopian5b287a62011-05-16 18:58:55 -070046 // used by LocalRef, this does an incRef() atomically with
47 // checking that the object is valid.
Mathias Agopianf0480de2011-11-13 20:50:07 -080048 return display->getObject(object);
Mathias Agopian518ec112011-05-13 16:21:08 -070049}
50
Courtney Goeltzenleuchter37836572017-04-26 15:07:51 -060051egl_surface_t::egl_surface_t(egl_display_t* dpy, EGLConfig config, EGLNativeWindowType win,
52 EGLSurface surface, EGLint colorSpace, egl_connection_t const* cnx)
53 : egl_object_t(dpy),
54 surface(surface),
55 config(config),
56 win(win),
57 cnx(cnx),
58 connected(true),
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -070059 colorSpace(colorSpace),
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -070060 egl_smpte2086_dirty(false),
61 egl_cta861_3_dirty(false) {
Yiwei Zhang8af03062020-08-12 21:28:15 -070062 egl_smpte2086_metadata.displayPrimaryRed = {EGL_DONT_CARE, EGL_DONT_CARE};
63 egl_smpte2086_metadata.displayPrimaryGreen = {EGL_DONT_CARE, EGL_DONT_CARE};
64 egl_smpte2086_metadata.displayPrimaryBlue = {EGL_DONT_CARE, EGL_DONT_CARE};
65 egl_smpte2086_metadata.whitePoint = {EGL_DONT_CARE, EGL_DONT_CARE};
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -070066 egl_smpte2086_metadata.maxLuminance = EGL_DONT_CARE;
67 egl_smpte2086_metadata.minLuminance = EGL_DONT_CARE;
68 egl_cta861_3_metadata.maxFrameAverageLightLevel = EGL_DONT_CARE;
69 egl_cta861_3_metadata.maxContentLightLevel = EGL_DONT_CARE;
70
Mathias Agopian65421432017-03-08 11:49:05 -080071 if (win) {
72 win->incStrong(this);
73 }
74}
Jesse Hall25838592012-04-05 15:53:28 -070075
76egl_surface_t::~egl_surface_t() {
Yi Kong48a6cd22018-07-18 10:07:09 -070077 if (win != nullptr) {
Pablo Ceballosae8cf0b2016-05-02 11:24:13 -070078 disconnect();
Mathias Agopian65421432017-03-08 11:49:05 -080079 win->decStrong(this);
Pablo Ceballosae8cf0b2016-05-02 11:24:13 -070080 }
81}
82
83void egl_surface_t::disconnect() {
Yi Kong48a6cd22018-07-18 10:07:09 -070084 if (win != nullptr && connected) {
Jason Macnak26c6f832021-04-02 12:29:08 -070085 // NOTE: When using Vulkan backend, the Vulkan runtime makes all the
86 // native_window_* calls, so don't do them here.
Peiyong Lin54926182023-06-15 22:35:14 +000087 if (!cnx->angleLoaded) {
Jason Macnak26c6f832021-04-02 12:29:08 -070088 native_window_set_buffers_format(win, 0);
89 if (native_window_api_disconnect(win, NATIVE_WINDOW_API_EGL)) {
90 ALOGW("EGLNativeWindowType %p disconnect failed", win);
91 }
Jesse Hall25838592012-04-05 15:53:28 -070092 }
Pablo Ceballosae8cf0b2016-05-02 11:24:13 -070093 connected = false;
Jesse Hall25838592012-04-05 15:53:28 -070094 }
95}
96
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -070097EGLBoolean egl_surface_t::setSmpte2086Attribute(EGLint attribute, EGLint value) {
98 switch (attribute) {
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -070099 case EGL_SMPTE2086_DISPLAY_PRIMARY_RX_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800100 egl_smpte2086_metadata.displayPrimaryRed.x = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700101 egl_smpte2086_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700102 return EGL_TRUE;
103 case EGL_SMPTE2086_DISPLAY_PRIMARY_RY_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800104 egl_smpte2086_metadata.displayPrimaryRed.y = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700105 egl_smpte2086_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700106 return EGL_TRUE;
107 case EGL_SMPTE2086_DISPLAY_PRIMARY_GX_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800108 egl_smpte2086_metadata.displayPrimaryGreen.x = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700109 egl_smpte2086_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700110 return EGL_TRUE;
111 case EGL_SMPTE2086_DISPLAY_PRIMARY_GY_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800112 egl_smpte2086_metadata.displayPrimaryGreen.y = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700113 egl_smpte2086_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700114 return EGL_TRUE;
115 case EGL_SMPTE2086_DISPLAY_PRIMARY_BX_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800116 egl_smpte2086_metadata.displayPrimaryBlue.x = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700117 egl_smpte2086_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700118 return EGL_TRUE;
119 case EGL_SMPTE2086_DISPLAY_PRIMARY_BY_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800120 egl_smpte2086_metadata.displayPrimaryBlue.y = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700121 egl_smpte2086_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700122 return EGL_TRUE;
123 case EGL_SMPTE2086_WHITE_POINT_X_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800124 egl_smpte2086_metadata.whitePoint.x = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700125 egl_smpte2086_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700126 return EGL_TRUE;
127 case EGL_SMPTE2086_WHITE_POINT_Y_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800128 egl_smpte2086_metadata.whitePoint.y = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700129 egl_smpte2086_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700130 return EGL_TRUE;
131 case EGL_SMPTE2086_MAX_LUMINANCE_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800132 egl_smpte2086_metadata.maxLuminance = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700133 egl_smpte2086_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700134 return EGL_TRUE;
135 case EGL_SMPTE2086_MIN_LUMINANCE_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800136 egl_smpte2086_metadata.minLuminance = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700137 egl_smpte2086_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700138 return EGL_TRUE;
139 }
140 return EGL_FALSE;
141}
142
143EGLBoolean egl_surface_t::setCta8613Attribute(EGLint attribute, EGLint value) {
144 switch (attribute) {
145 case EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800146 egl_cta861_3_metadata.maxContentLightLevel = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700147 egl_cta861_3_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700148 return EGL_TRUE;
149 case EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800150 egl_cta861_3_metadata.maxFrameAverageLightLevel = value;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700151 egl_cta861_3_dirty = true;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700152 return EGL_TRUE;
153 }
154 return EGL_FALSE;
155}
156
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700157EGLBoolean egl_surface_t::getSmpte2086Metadata(android_smpte2086_metadata& metadata) const {
158 if (!egl_smpte2086_dirty) return EGL_FALSE;
159 if (egl_smpte2086_metadata.displayPrimaryRed.x == EGL_DONT_CARE ||
160 egl_smpte2086_metadata.displayPrimaryRed.y == EGL_DONT_CARE ||
161 egl_smpte2086_metadata.displayPrimaryGreen.x == EGL_DONT_CARE ||
162 egl_smpte2086_metadata.displayPrimaryGreen.y == EGL_DONT_CARE ||
163 egl_smpte2086_metadata.displayPrimaryBlue.x == EGL_DONT_CARE ||
164 egl_smpte2086_metadata.displayPrimaryBlue.y == EGL_DONT_CARE ||
165 egl_smpte2086_metadata.whitePoint.x == EGL_DONT_CARE ||
166 egl_smpte2086_metadata.whitePoint.y == EGL_DONT_CARE ||
167 egl_smpte2086_metadata.maxLuminance == EGL_DONT_CARE ||
168 egl_smpte2086_metadata.minLuminance == EGL_DONT_CARE) {
169 ALOGW("egl_surface_t: incomplete SMPTE 2086 metadata!");
170 return EGL_FALSE;
171 }
172
Yiwei Zhang8af03062020-08-12 21:28:15 -0700173 metadata.displayPrimaryRed.x = static_cast<float>(egl_smpte2086_metadata.displayPrimaryRed.x) /
174 EGL_METADATA_SCALING_EXT;
175 metadata.displayPrimaryRed.y = static_cast<float>(egl_smpte2086_metadata.displayPrimaryRed.y) /
176 EGL_METADATA_SCALING_EXT;
177 metadata.displayPrimaryGreen.x =
178 static_cast<float>(egl_smpte2086_metadata.displayPrimaryGreen.x) /
179 EGL_METADATA_SCALING_EXT;
180 metadata.displayPrimaryGreen.y =
181 static_cast<float>(egl_smpte2086_metadata.displayPrimaryGreen.y) /
182 EGL_METADATA_SCALING_EXT;
183 metadata.displayPrimaryBlue.x =
184 static_cast<float>(egl_smpte2086_metadata.displayPrimaryBlue.x) /
185 EGL_METADATA_SCALING_EXT;
186 metadata.displayPrimaryBlue.y =
187 static_cast<float>(egl_smpte2086_metadata.displayPrimaryBlue.y) /
188 EGL_METADATA_SCALING_EXT;
189 metadata.whitePoint.x =
190 static_cast<float>(egl_smpte2086_metadata.whitePoint.x) / EGL_METADATA_SCALING_EXT;
191 metadata.whitePoint.y =
192 static_cast<float>(egl_smpte2086_metadata.whitePoint.y) / EGL_METADATA_SCALING_EXT;
193 metadata.maxLuminance =
194 static_cast<float>(egl_smpte2086_metadata.maxLuminance) / EGL_METADATA_SCALING_EXT;
195 metadata.minLuminance =
196 static_cast<float>(egl_smpte2086_metadata.minLuminance) / EGL_METADATA_SCALING_EXT;
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800197
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700198 return EGL_TRUE;
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800199}
200
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700201EGLBoolean egl_surface_t::getCta8613Metadata(android_cta861_3_metadata& metadata) const {
202 if (!egl_cta861_3_dirty) return EGL_FALSE;
203
204 if (egl_cta861_3_metadata.maxContentLightLevel == EGL_DONT_CARE ||
205 egl_cta861_3_metadata.maxFrameAverageLightLevel == EGL_DONT_CARE) {
206 ALOGW("egl_surface_t: incomplete CTA861.3 metadata!");
207 return EGL_FALSE;
208 }
209
Yiwei Zhang8af03062020-08-12 21:28:15 -0700210 metadata.maxContentLightLevel = static_cast<float>(egl_cta861_3_metadata.maxContentLightLevel) /
211 EGL_METADATA_SCALING_EXT;
212 metadata.maxFrameAverageLightLevel =
213 static_cast<float>(egl_cta861_3_metadata.maxFrameAverageLightLevel) /
214 EGL_METADATA_SCALING_EXT;
Courtney Goeltzenleuchter936799c2018-03-02 16:47:08 -0700215
216 return EGL_TRUE;
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800217}
218
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700219EGLBoolean egl_surface_t::getColorSpaceAttribute(EGLint attribute, EGLint* value) const {
220 if (attribute == EGL_GL_COLORSPACE_KHR) {
221 *value = colorSpace;
222 return EGL_TRUE;
223 }
224 return EGL_FALSE;
225}
226
Yiwei Zhang8af03062020-08-12 21:28:15 -0700227EGLBoolean egl_surface_t::getSmpte2086Attribute(EGLint attribute, EGLint* value) const {
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700228 switch (attribute) {
229 case EGL_SMPTE2086_DISPLAY_PRIMARY_RX_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800230 *value = egl_smpte2086_metadata.displayPrimaryRed.x;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700231 return EGL_TRUE;
232 break;
233 case EGL_SMPTE2086_DISPLAY_PRIMARY_RY_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800234 *value = egl_smpte2086_metadata.displayPrimaryRed.y;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700235 return EGL_TRUE;
236 break;
237 case EGL_SMPTE2086_DISPLAY_PRIMARY_GX_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800238 *value = egl_smpte2086_metadata.displayPrimaryGreen.x;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700239 return EGL_TRUE;
240 break;
241 case EGL_SMPTE2086_DISPLAY_PRIMARY_GY_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800242 *value = egl_smpte2086_metadata.displayPrimaryGreen.y;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700243 return EGL_TRUE;
244 break;
245 case EGL_SMPTE2086_DISPLAY_PRIMARY_BX_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800246 *value = egl_smpte2086_metadata.displayPrimaryBlue.x;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700247 return EGL_TRUE;
248 break;
249 case EGL_SMPTE2086_DISPLAY_PRIMARY_BY_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800250 *value = egl_smpte2086_metadata.displayPrimaryBlue.y;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700251 return EGL_TRUE;
252 break;
253 case EGL_SMPTE2086_WHITE_POINT_X_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800254 *value = egl_smpte2086_metadata.whitePoint.x;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700255 return EGL_TRUE;
256 break;
257 case EGL_SMPTE2086_WHITE_POINT_Y_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800258 *value = egl_smpte2086_metadata.whitePoint.y;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700259 return EGL_TRUE;
260 break;
261 case EGL_SMPTE2086_MAX_LUMINANCE_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800262 *value = egl_smpte2086_metadata.maxLuminance;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700263 return EGL_TRUE;
264 break;
265 case EGL_SMPTE2086_MIN_LUMINANCE_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800266 *value = egl_smpte2086_metadata.minLuminance;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700267 return EGL_TRUE;
268 break;
269 }
270 return EGL_FALSE;
271}
272
Yiwei Zhang8af03062020-08-12 21:28:15 -0700273EGLBoolean egl_surface_t::getCta8613Attribute(EGLint attribute, EGLint* value) const {
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700274 switch (attribute) {
275 case EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800276 *value = egl_cta861_3_metadata.maxContentLightLevel;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700277 return EGL_TRUE;
278 break;
279 case EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT:
Courtney Goeltzenleuchter786ab882018-01-26 13:37:33 -0800280 *value = egl_cta861_3_metadata.maxFrameAverageLightLevel;
Courtney Goeltzenleuchter12ffe092017-11-16 14:27:48 -0700281 return EGL_TRUE;
282 break;
283 }
284 return EGL_FALSE;
285}
286
Pablo Ceballosae8cf0b2016-05-02 11:24:13 -0700287void egl_surface_t::terminate() {
288 disconnect();
289 egl_object_t::terminate();
290}
291
Mathias Agopian48d438d2012-01-28 21:44:00 -0800292egl_context_t::egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig config,
Yiwei Zhang0657fba2020-08-12 19:09:26 -0700293 egl_connection_t const* cnx, int version)
294 : egl_object_t(get_display(dpy)),
295 dpy(dpy),
296 context(context),
297 config(config),
298 read(nullptr),
299 draw(nullptr),
300 cnx(cnx),
301 version(version) {}
Mathias Agopian48d438d2012-01-28 21:44:00 -0800302
303void egl_context_t::onLooseCurrent() {
Yi Kong48a6cd22018-07-18 10:07:09 -0700304 read = nullptr;
305 draw = nullptr;
Mathias Agopian48d438d2012-01-28 21:44:00 -0800306}
307
308void egl_context_t::onMakeCurrent(EGLSurface draw, EGLSurface read) {
309 this->read = read;
310 this->draw = draw;
311
312 /*
313 * Here we cache the GL_EXTENSIONS string for this context and we
314 * add the extensions always handled by the wrapper
315 */
Yiwei Zhang8af03062020-08-12 21:28:15 -0700316 if (!gl_extensions.empty()) return;
Mathias Agopian48d438d2012-01-28 21:44:00 -0800317
Yiwei Zhang8af03062020-08-12 21:28:15 -0700318 // call the implementation's glGetString(GL_EXTENSIONS)
319 const char* exts = (const char*)gEGLImpl.hooks[version]->gl.glGetString(GL_EXTENSIONS);
320 if (!exts) return;
Alistair Strachan89301ea2015-05-22 14:10:09 -0700321
Yiwei Zhang8af03062020-08-12 21:28:15 -0700322 // If this context is sharing with another context, and the other context was reset
323 // e.g. due to robustness failure, this context might also be reset and glGetString can
324 // return NULL.
325 gl_extensions = exts;
326 if (gl_extensions.find("GL_EXT_debug_marker") == std::string::npos) {
327 gl_extensions.insert(0, "GL_EXT_debug_marker ");
328 // eglGetProcAddress could return function pointers to these
329 // functions while they actually don't work. Fix them now.
330 __eglMustCastToProperFunctionPointerType* f;
331 f = (__eglMustCastToProperFunctionPointerType*)&gEGLImpl.hooks[version]
332 ->gl.glInsertEventMarkerEXT;
333 if (*f != gl_noop) *f = gl_noop;
334 f = (__eglMustCastToProperFunctionPointerType*)&gEGLImpl.hooks[version]
335 ->gl.glPushGroupMarkerEXT;
336 if (*f != gl_noop) *f = gl_noop;
337 f = (__eglMustCastToProperFunctionPointerType*)&gEGLImpl.hooks[version]
338 ->gl.glPopGroupMarkerEXT;
339 if (*f != gl_noop) *f = gl_noop;
340 }
Jesse Hall09fc8f92017-09-29 15:57:42 -0700341
Yiwei Zhang8af03062020-08-12 21:28:15 -0700342 // tokenize the supported extensions for the glGetStringi() wrapper
343 std::stringstream ss;
344 std::string str;
345 ss << gl_extensions;
346 while (ss >> str) {
347 tokenized_gl_extensions.push_back(str);
Mathias Agopian48d438d2012-01-28 21:44:00 -0800348 }
349}
350
Mathias Agopian518ec112011-05-13 16:21:08 -0700351}; // namespace android