blob: 6ee6c96d87639baa608d1800c6a7ebcb0d0fe26e [file] [log] [blame]
John Bauman66b8ab22014-05-06 15:57:45 -04001// SwiftShader Software Renderer
2//
John Baumand4ae8632014-05-06 16:18:33 -04003// Copyright(c) 2005-2013 TransGaming Inc.
John Bauman66b8ab22014-05-06 15:57:45 -04004//
5// All rights reserved. No part of this software may be copied, distributed, transmitted,
6// transcribed, stored in a retrieval system, translated into any human or computer
7// language by any means, or disclosed to third parties without the explicit written
8// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
9// or implied, including but not limited to any patent rights, are granted to you.
10//
11
12// Config.cpp: Implements the egl::Config class, describing the format, type
13// and size for an egl::Surface. Implements EGLConfig and related functionality.
14// [EGL 1.4] section 3.4 page 15.
15
16#include "Config.h"
17
18#include "common/debug.h"
John Bauman66b8ab22014-05-06 15:57:45 -040019
Nicolas Capensf4fea7f2014-11-25 13:31:46 -050020#include <EGL/eglext.h>
Nicolas Capensb3c0c732015-10-30 14:05:23 -040021#ifdef __ANDROID__
22#include <system/graphics.h>
23#endif
Nicolas Capensf4fea7f2014-11-25 13:31:46 -050024
Nicolas Capensb77b8772015-10-30 13:50:31 -040025#include <string.h>
John Bauman66b8ab22014-05-06 15:57:45 -040026#include <algorithm>
27#include <vector>
28
29using namespace std;
30
31namespace egl
32{
Nicolas Capens8b4ea002015-10-01 01:09:27 -040033Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample)
34 : mDisplayFormat(displayFormat), mRenderTargetFormat(renderTargetFormat), mDepthStencilFormat(depthStencilFormat), mMultiSample(multiSample)
John Bauman66b8ab22014-05-06 15:57:45 -040035{
John Bauman66b8ab22014-05-06 15:57:45 -040036 mBindToTextureRGB = EGL_FALSE;
37 mBindToTextureRGBA = EGL_FALSE;
38
Nicolas Capensb3c0c732015-10-30 14:05:23 -040039 mNativeVisualID = 0;
40
Nicolas Capens5716cf02015-10-30 13:54:24 -040041 switch(renderTargetFormat)
John Bauman66b8ab22014-05-06 15:57:45 -040042 {
Nicolas Capens101e4f02015-06-03 14:54:38 -040043 case sw::FORMAT_A1R5G5B5:
John Bauman66b8ab22014-05-06 15:57:45 -040044 mRedSize = 5;
45 mGreenSize = 5;
46 mBlueSize = 5;
47 mAlphaSize = 1;
48 break;
Nicolas Capens101e4f02015-06-03 14:54:38 -040049 case sw::FORMAT_A2R10G10B10:
John Bauman66b8ab22014-05-06 15:57:45 -040050 mRedSize = 10;
51 mGreenSize = 10;
52 mBlueSize = 10;
53 mAlphaSize = 2;
54 break;
Nicolas Capens101e4f02015-06-03 14:54:38 -040055 case sw::FORMAT_A8R8G8B8:
John Bauman66b8ab22014-05-06 15:57:45 -040056 mRedSize = 8;
57 mGreenSize = 8;
58 mBlueSize = 8;
59 mAlphaSize = 8;
Nicolas Capense2b31f22015-05-31 01:38:47 -040060 mBindToTextureRGBA = EGL_TRUE;
Nicolas Capensb3c0c732015-10-30 14:05:23 -040061 #ifdef __ANDROID__
62 mNativeVisualID = HAL_PIXEL_FORMAT_BGRA_8888;
63 #endif
John Bauman66b8ab22014-05-06 15:57:45 -040064 break;
Nicolas Capens5716cf02015-10-30 13:54:24 -040065 case sw::FORMAT_A8B8G8R8:
66 mRedSize = 8;
67 mGreenSize = 8;
68 mBlueSize = 8;
69 mAlphaSize = 8;
70 mBindToTextureRGBA = EGL_TRUE;
Nicolas Capensb3c0c732015-10-30 14:05:23 -040071 #ifdef __ANDROID__
72 mNativeVisualID = HAL_PIXEL_FORMAT_RGBA_8888;
73 #endif
Nicolas Capens5716cf02015-10-30 13:54:24 -040074 break;
Nicolas Capens101e4f02015-06-03 14:54:38 -040075 case sw::FORMAT_R5G6B5:
John Bauman66b8ab22014-05-06 15:57:45 -040076 mRedSize = 5;
77 mGreenSize = 6;
78 mBlueSize = 5;
79 mAlphaSize = 0;
Nicolas Capensb3c0c732015-10-30 14:05:23 -040080 #ifdef __ANDROID__
81 mNativeVisualID = HAL_PIXEL_FORMAT_RGB_565;
82 #endif
John Bauman66b8ab22014-05-06 15:57:45 -040083 break;
Nicolas Capens101e4f02015-06-03 14:54:38 -040084 case sw::FORMAT_X8R8G8B8:
John Bauman66b8ab22014-05-06 15:57:45 -040085 mRedSize = 8;
86 mGreenSize = 8;
87 mBlueSize = 8;
88 mAlphaSize = 0;
Nicolas Capense2b31f22015-05-31 01:38:47 -040089 mBindToTextureRGB = EGL_TRUE;
Nicolas Capensb3c0c732015-10-30 14:05:23 -040090 #ifdef __ANDROID__
91 mNativeVisualID = HAL_PIXEL_FORMAT_BGRA_8888;
92 #endif
John Bauman66b8ab22014-05-06 15:57:45 -040093 break;
Nicolas Capens5716cf02015-10-30 13:54:24 -040094 case sw::FORMAT_X8B8G8R8:
95 mRedSize = 8;
96 mGreenSize = 8;
97 mBlueSize = 8;
98 mAlphaSize = 0;
99 mBindToTextureRGBA = EGL_TRUE;
Nicolas Capensb3c0c732015-10-30 14:05:23 -0400100 #ifdef __ANDROID__
101 mNativeVisualID = HAL_PIXEL_FORMAT_RGBX_8888;
102 #endif
Nicolas Capens5716cf02015-10-30 13:54:24 -0400103 break;
Nicolas Capens101e4f02015-06-03 14:54:38 -0400104 default:
Nicolas Capens3713cd42015-06-22 10:41:54 -0400105 UNREACHABLE(renderTargetFormat); // Other formats should not be valid
John Bauman66b8ab22014-05-06 15:57:45 -0400106 }
107
108 mLuminanceSize = 0;
Nicolas Capens101e4f02015-06-03 14:54:38 -0400109 mBufferSize = mRedSize + mGreenSize + mBlueSize + mLuminanceSize + mAlphaSize;
John Bauman66b8ab22014-05-06 15:57:45 -0400110 mAlphaMaskSize = 0;
111 mColorBufferType = EGL_RGB_BUFFER;
Nicolas Capens35331252014-11-24 17:36:19 -0500112 mConfigCaveat = isSlowConfig() ? EGL_SLOW_CONFIG : EGL_NONE;
John Bauman66b8ab22014-05-06 15:57:45 -0400113 mConfigID = 0;
Alexis Hetu83d0e982015-07-02 14:17:00 -0400114 mConformant = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT
115#ifndef __ANDROID__ // Do not allow GLES 3.0 on Android
116 | EGL_OPENGL_ES3_BIT
117#endif
118 ;
John Bauman66b8ab22014-05-06 15:57:45 -0400119
Nicolas Capens5716cf02015-10-30 13:54:24 -0400120 switch(depthStencilFormat)
John Bauman66b8ab22014-05-06 15:57:45 -0400121 {
122 case sw::FORMAT_NULL:
123 mDepthSize = 0;
124 mStencilSize = 0;
125 break;
126// case sw::FORMAT_D16_LOCKABLE:
127// mDepthSize = 16;
128// mStencilSize = 0;
129// break;
130 case sw::FORMAT_D32:
131 mDepthSize = 32;
132 mStencilSize = 0;
133 break;
134// case sw::FORMAT_D15S1:
135// mDepthSize = 15;
136// mStencilSize = 1;
137// break;
138 case sw::FORMAT_D24S8:
139 mDepthSize = 24;
140 mStencilSize = 8;
141 break;
142 case sw::FORMAT_D24X8:
143 mDepthSize = 24;
144 mStencilSize = 0;
145 break;
146// case sw::FORMAT_D24X4S4:
147// mDepthSize = 24;
148// mStencilSize = 4;
149// break;
150 case sw::FORMAT_D16:
151 mDepthSize = 16;
152 mStencilSize = 0;
153 break;
154// case sw::FORMAT_D32F_LOCKABLE:
155// mDepthSize = 32;
156// mStencilSize = 0;
157// break;
158// case sw::FORMAT_D24FS8:
159// mDepthSize = 24;
160// mStencilSize = 8;
161// break;
Nicolas Capens101e4f02015-06-03 14:54:38 -0400162 default:
Nicolas Capens3713cd42015-06-22 10:41:54 -0400163 UNREACHABLE(depthStencilFormat);
John Bauman66b8ab22014-05-06 15:57:45 -0400164 }
165
166 mLevel = 0;
167 mMatchNativePixmap = EGL_NONE;
168 mMaxPBufferWidth = 4096;
169 mMaxPBufferHeight = 4096;
170 mMaxPBufferPixels = mMaxPBufferWidth * mMaxPBufferHeight;
171 mMaxSwapInterval = maxInterval;
172 mMinSwapInterval = minInterval;
173 mNativeRenderable = EGL_FALSE;
John Bauman66b8ab22014-05-06 15:57:45 -0400174 mNativeVisualType = 0;
Alexis Hetu83d0e982015-07-02 14:17:00 -0400175 mRenderableType = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT
176#ifndef __ANDROID__ // Do not allow GLES 3.0 on Android
177 | EGL_OPENGL_ES3_BIT
178#endif
179 ;
Nicolas Capensb602f0d2015-09-01 01:38:00 -0400180 mSampleBuffers = (multiSample > 0) ? 1 : 0;
John Bauman66b8ab22014-05-06 15:57:45 -0400181 mSamples = multiSample;
182 mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
183 mTransparentType = EGL_NONE;
184 mTransparentRedValue = 0;
185 mTransparentGreenValue = 0;
186 mTransparentBlueValue = 0;
Nicolas Capens9a74a0e2015-08-12 16:36:52 -0400187
188 mRecordableAndroid = EGL_TRUE;
Nicolas Capensb77b8772015-10-30 13:50:31 -0400189 mFramebufferTargetAndroid = (displayFormat == renderTargetFormat) ? EGL_TRUE : EGL_FALSE;
John Bauman66b8ab22014-05-06 15:57:45 -0400190}
191
192EGLConfig Config::getHandle() const
193{
194 return (EGLConfig)(size_t)mConfigID;
195}
196
Nicolas Capens35331252014-11-24 17:36:19 -0500197bool Config::isSlowConfig() const
198{
Nicolas Capens688b0ad2014-12-04 14:41:38 -0500199 return mRenderTargetFormat != sw::FORMAT_X8R8G8B8 && mRenderTargetFormat != sw::FORMAT_A8R8G8B8;
Nicolas Capens35331252014-11-24 17:36:19 -0500200}
201
Nicolas Capense2b31f22015-05-31 01:38:47 -0400202// This ordering determines the config ID
203bool CompareConfig::operator()(const Config &x, const Config &y) const
204{
205 #define SORT_SMALLER(attribute) \
206 if(x.attribute != y.attribute) \
207 { \
208 return x.attribute < y.attribute; \
209 }
210
Nicolas Capense2b31f22015-05-31 01:38:47 -0400211 META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
212 SORT_SMALLER(mConfigCaveat);
213
214 META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
215 SORT_SMALLER(mColorBufferType);
216
Nicolas Capens101e4f02015-06-03 14:54:38 -0400217 SORT_SMALLER(mRedSize);
218 SORT_SMALLER(mGreenSize);
219 SORT_SMALLER(mBlueSize);
220 SORT_SMALLER(mAlphaSize);
Nicolas Capense2b31f22015-05-31 01:38:47 -0400221
222 SORT_SMALLER(mBufferSize);
223 SORT_SMALLER(mSampleBuffers);
224 SORT_SMALLER(mSamples);
225 SORT_SMALLER(mDepthSize);
226 SORT_SMALLER(mStencilSize);
227 SORT_SMALLER(mAlphaMaskSize);
228 SORT_SMALLER(mNativeVisualType);
229
230 #undef SORT_SMALLER
Nicolas Capense2b31f22015-05-31 01:38:47 -0400231
232 // Strict ordering requires sorting all non-equal fields above
233 assert(memcmp(&x, &y, sizeof(Config)) == 0);
234
235 return false;
236}
237
Nicolas Capens101e4f02015-06-03 14:54:38 -0400238// Function object used by STL sorting routines for ordering Configs according to [EGL] section 3.4.1 page 24.
239class SortConfig
240{
241public:
242 explicit SortConfig(const EGLint *attribList);
243
244 bool operator()(const Config *x, const Config *y) const;
245
246private:
247 EGLint wantedComponentsSize(const Config *config) const;
248
249 bool mWantRed;
250 bool mWantGreen;
251 bool mWantBlue;
252 bool mWantAlpha;
253 bool mWantLuminance;
Nicolas Capense2b31f22015-05-31 01:38:47 -0400254};
255
John Bauman66b8ab22014-05-06 15:57:45 -0400256SortConfig::SortConfig(const EGLint *attribList)
257 : mWantRed(false), mWantGreen(false), mWantBlue(false), mWantAlpha(false), mWantLuminance(false)
258{
Nicolas Capense2b31f22015-05-31 01:38:47 -0400259 // [EGL] section 3.4.1 page 24
260 // Sorting rule #3: by larger total number of color bits,
261 // not considering components that are 0 or don't-care.
John Bauman66b8ab22014-05-06 15:57:45 -0400262 for(const EGLint *attr = attribList; attr[0] != EGL_NONE; attr += 2)
263 {
264 if(attr[1] != 0 && attr[1] != EGL_DONT_CARE)
265 {
266 switch (attr[0])
267 {
Nicolas Capense2b31f22015-05-31 01:38:47 -0400268 case EGL_RED_SIZE: mWantRed = true; break;
269 case EGL_GREEN_SIZE: mWantGreen = true; break;
270 case EGL_BLUE_SIZE: mWantBlue = true; break;
271 case EGL_ALPHA_SIZE: mWantAlpha = true; break;
272 case EGL_LUMINANCE_SIZE: mWantLuminance = true; break;
John Bauman66b8ab22014-05-06 15:57:45 -0400273 }
274 }
275 }
276}
277
Nicolas Capense2b31f22015-05-31 01:38:47 -0400278EGLint SortConfig::wantedComponentsSize(const Config *config) const
John Bauman66b8ab22014-05-06 15:57:45 -0400279{
280 EGLint total = 0;
281
Nicolas Capense2b31f22015-05-31 01:38:47 -0400282 if(mWantRed) total += config->mRedSize;
283 if(mWantGreen) total += config->mGreenSize;
284 if(mWantBlue) total += config->mBlueSize;
285 if(mWantAlpha) total += config->mAlphaSize;
286 if(mWantLuminance) total += config->mLuminanceSize;
John Bauman66b8ab22014-05-06 15:57:45 -0400287
288 return total;
289}
290
291bool SortConfig::operator()(const Config *x, const Config *y) const
292{
Nicolas Capense2b31f22015-05-31 01:38:47 -0400293 #define SORT_SMALLER(attribute) \
294 if(x->attribute != y->attribute) \
John Bauman66b8ab22014-05-06 15:57:45 -0400295 { \
Nicolas Capense2b31f22015-05-31 01:38:47 -0400296 return x->attribute < y->attribute; \
John Bauman66b8ab22014-05-06 15:57:45 -0400297 }
298
299 META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
Nicolas Capense2b31f22015-05-31 01:38:47 -0400300 SORT_SMALLER(mConfigCaveat);
John Bauman66b8ab22014-05-06 15:57:45 -0400301
302 META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
Nicolas Capense2b31f22015-05-31 01:38:47 -0400303 SORT_SMALLER(mColorBufferType);
John Bauman66b8ab22014-05-06 15:57:45 -0400304
Nicolas Capense2b31f22015-05-31 01:38:47 -0400305 // By larger total number of color bits, only considering those that are requested to be > 0.
306 EGLint xComponentsSize = wantedComponentsSize(x);
307 EGLint yComponentsSize = wantedComponentsSize(y);
308 if(xComponentsSize != yComponentsSize)
309 {
310 return xComponentsSize > yComponentsSize;
311 }
John Bauman66b8ab22014-05-06 15:57:45 -0400312
Nicolas Capense2b31f22015-05-31 01:38:47 -0400313 SORT_SMALLER(mBufferSize);
314 SORT_SMALLER(mSampleBuffers);
315 SORT_SMALLER(mSamples);
316 SORT_SMALLER(mDepthSize);
317 SORT_SMALLER(mStencilSize);
318 SORT_SMALLER(mAlphaMaskSize);
319 SORT_SMALLER(mNativeVisualType);
320 SORT_SMALLER(mConfigID);
John Bauman66b8ab22014-05-06 15:57:45 -0400321
Nicolas Capense2b31f22015-05-31 01:38:47 -0400322 #undef SORT_SMALLER
John Bauman66b8ab22014-05-06 15:57:45 -0400323
324 return false;
325}
326
John Bauman66b8ab22014-05-06 15:57:45 -0400327ConfigSet::ConfigSet()
John Bauman66b8ab22014-05-06 15:57:45 -0400328{
329}
330
Nicolas Capens8b4ea002015-10-01 01:09:27 -0400331void ConfigSet::add(sw::Format displayFormat, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample)
John Bauman66b8ab22014-05-06 15:57:45 -0400332{
Nicolas Capens8b4ea002015-10-01 01:09:27 -0400333 Config config(displayFormat, minSwapInterval, maxSwapInterval, renderTargetFormat, depthStencilFormat, multiSample);
John Bauman66b8ab22014-05-06 15:57:45 -0400334
335 mSet.insert(config);
336}
337
338size_t ConfigSet::size() const
339{
340 return mSet.size();
341}
342
343bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
344{
345 vector<const Config*> passed;
346 passed.reserve(mSet.size());
347
348 for(Iterator config = mSet.begin(); config != mSet.end(); config++)
349 {
350 bool match = true;
351 const EGLint *attribute = attribList;
352
353 while(attribute[0] != EGL_NONE)
354 {
Nicolas Capensfc02cfc2015-06-04 08:59:09 -0400355 if(attribute[1] != EGL_DONT_CARE)
Nicolas Capens101e4f02015-06-03 14:54:38 -0400356 {
Nicolas Capensfc02cfc2015-06-04 08:59:09 -0400357 switch(attribute[0])
358 {
359 case EGL_BUFFER_SIZE: match = config->mBufferSize >= attribute[1]; break;
360 case EGL_ALPHA_SIZE: match = config->mAlphaSize >= attribute[1]; break;
361 case EGL_BLUE_SIZE: match = config->mBlueSize >= attribute[1]; break;
362 case EGL_GREEN_SIZE: match = config->mGreenSize >= attribute[1]; break;
363 case EGL_RED_SIZE: match = config->mRedSize >= attribute[1]; break;
364 case EGL_DEPTH_SIZE: match = config->mDepthSize >= attribute[1]; break;
365 case EGL_STENCIL_SIZE: match = config->mStencilSize >= attribute[1]; break;
366 case EGL_CONFIG_CAVEAT: match = config->mConfigCaveat == attribute[1]; break;
367 case EGL_CONFIG_ID: match = config->mConfigID == attribute[1]; break;
368 case EGL_LEVEL: match = config->mLevel >= attribute[1]; break;
369 case EGL_NATIVE_RENDERABLE: match = config->mNativeRenderable == attribute[1]; break;
370 case EGL_NATIVE_VISUAL_ID: match = config->mNativeVisualID == attribute[1]; break;
371 case EGL_NATIVE_VISUAL_TYPE: match = config->mNativeVisualType == attribute[1]; break;
372 case EGL_SAMPLES: match = config->mSamples >= attribute[1]; break;
373 case EGL_SAMPLE_BUFFERS: match = config->mSampleBuffers >= attribute[1]; break;
374 case EGL_SURFACE_TYPE: match = (config->mSurfaceType & attribute[1]) == attribute[1]; break;
375 case EGL_TRANSPARENT_TYPE: match = config->mTransparentType == attribute[1]; break;
376 case EGL_TRANSPARENT_BLUE_VALUE: match = config->mTransparentBlueValue == attribute[1]; break;
377 case EGL_TRANSPARENT_GREEN_VALUE: match = config->mTransparentGreenValue == attribute[1]; break;
378 case EGL_TRANSPARENT_RED_VALUE: match = config->mTransparentRedValue == attribute[1]; break;
379 case EGL_BIND_TO_TEXTURE_RGB: match = config->mBindToTextureRGB == attribute[1]; break;
380 case EGL_BIND_TO_TEXTURE_RGBA: match = config->mBindToTextureRGBA == attribute[1]; break;
381 case EGL_MIN_SWAP_INTERVAL: match = config->mMinSwapInterval == attribute[1]; break;
382 case EGL_MAX_SWAP_INTERVAL: match = config->mMaxSwapInterval == attribute[1]; break;
383 case EGL_LUMINANCE_SIZE: match = config->mLuminanceSize >= attribute[1]; break;
384 case EGL_ALPHA_MASK_SIZE: match = config->mAlphaMaskSize >= attribute[1]; break;
385 case EGL_COLOR_BUFFER_TYPE: match = config->mColorBufferType == attribute[1]; break;
386 case EGL_RENDERABLE_TYPE: match = (config->mRenderableType & attribute[1]) == attribute[1]; break;
387 case EGL_MATCH_NATIVE_PIXMAP: match = false; UNIMPLEMENTED(); break;
388 case EGL_CONFORMANT: match = (config->mConformant & attribute[1]) == attribute[1]; break;
389 case EGL_MAX_PBUFFER_WIDTH: match = config->mMaxPBufferWidth >= attribute[1]; break;
390 case EGL_MAX_PBUFFER_HEIGHT: match = config->mMaxPBufferHeight >= attribute[1]; break;
391 case EGL_MAX_PBUFFER_PIXELS: match = config->mMaxPBufferPixels >= attribute[1]; break;
Nicolas Capens9a74a0e2015-08-12 16:36:52 -0400392 case EGL_RECORDABLE_ANDROID: match = config->mRecordableAndroid == attribute[1]; break;
393 case EGL_FRAMEBUFFER_TARGET_ANDROID: match = config->mFramebufferTargetAndroid == attribute[1]; break;
Nicolas Capensfc02cfc2015-06-04 08:59:09 -0400394 default:
Nicolas Capens0c19ed82015-08-12 17:21:06 -0400395 *numConfig = 0;
396 return false;
Nicolas Capensfc02cfc2015-06-04 08:59:09 -0400397 }
398
399 if(!match)
400 {
401 break;
402 }
Nicolas Capens101e4f02015-06-03 14:54:38 -0400403 }
404
John Bauman66b8ab22014-05-06 15:57:45 -0400405 attribute += 2;
406 }
407
408 if(match)
409 {
410 passed.push_back(&*config);
411 }
412 }
413
414 if(configs)
415 {
416 sort(passed.begin(), passed.end(), SortConfig(attribList));
417
418 EGLint index;
419 for(index = 0; index < configSize && index < static_cast<EGLint>(passed.size()); index++)
420 {
421 configs[index] = passed[index]->getHandle();
422 }
423
424 *numConfig = index;
425 }
426 else
427 {
Alexis Hetu617a5d52014-11-13 10:56:20 -0500428 *numConfig = static_cast<EGLint>(passed.size());
John Bauman66b8ab22014-05-06 15:57:45 -0400429 }
430
431 return true;
432}
433
434const egl::Config *ConfigSet::get(EGLConfig configHandle)
435{
436 for(Iterator config = mSet.begin(); config != mSet.end(); config++)
437 {
438 if(config->getHandle() == configHandle)
439 {
440 return &(*config);
441 }
442 }
443
444 return NULL;
445}
446}