daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // Config.cpp: Implements the egl::Config class, describing the format, type |
| 8 | // and size for an egl::Surface. Implements EGLConfig and related functionality. |
| 9 | // [EGL 1.4] section 3.4 page 15. |
| 10 | |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 11 | #include "libEGL/Config.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 12 | |
| 13 | #include <algorithm> |
| 14 | #include <vector> |
| 15 | |
daniel@transgaming.com | 106e1f7 | 2012-10-31 18:38:36 +0000 | [diff] [blame] | 16 | #include <GLES2/gl2.h> |
| 17 | #include <GLES2/gl2ext.h> |
| 18 | |
alokp@chromium.org | ea0e1af | 2010-03-22 19:33:14 +0000 | [diff] [blame] | 19 | #include "common/debug.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 20 | |
| 21 | using namespace std; |
| 22 | |
| 23 | namespace egl |
| 24 | { |
daniel@transgaming.com | 3281f97 | 2012-10-31 18:38:51 +0000 | [diff] [blame] | 25 | Config::Config(renderer::ConfigDesc desc, EGLint minInterval, EGLint maxInterval, EGLint texWidth, EGLint texHeight) |
| 26 | : mRenderTargetFormat(desc.renderTargetFormat), mDepthStencilFormat(desc.depthStencilFormat), mMultiSample(desc.multiSample) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 27 | { |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 28 | mBindToTextureRGB = EGL_FALSE; |
| 29 | mBindToTextureRGBA = EGL_FALSE; |
daniel@transgaming.com | 3281f97 | 2012-10-31 18:38:51 +0000 | [diff] [blame] | 30 | switch (desc.renderTargetFormat) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 31 | { |
daniel@transgaming.com | 106e1f7 | 2012-10-31 18:38:36 +0000 | [diff] [blame] | 32 | case GL_RGB5_A1: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 33 | mBufferSize = 16; |
| 34 | mRedSize = 5; |
| 35 | mGreenSize = 5; |
| 36 | mBlueSize = 5; |
| 37 | mAlphaSize = 1; |
| 38 | break; |
daniel@transgaming.com | 106e1f7 | 2012-10-31 18:38:36 +0000 | [diff] [blame] | 39 | case GL_RGBA8_OES: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 40 | mBufferSize = 32; |
| 41 | mRedSize = 8; |
| 42 | mGreenSize = 8; |
| 43 | mBlueSize = 8; |
| 44 | mAlphaSize = 8; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 45 | mBindToTextureRGBA = true; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 46 | break; |
daniel@transgaming.com | 106e1f7 | 2012-10-31 18:38:36 +0000 | [diff] [blame] | 47 | case GL_RGB565: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 48 | mBufferSize = 16; |
| 49 | mRedSize = 5; |
| 50 | mGreenSize = 6; |
| 51 | mBlueSize = 5; |
| 52 | mAlphaSize = 0; |
| 53 | break; |
daniel@transgaming.com | 106e1f7 | 2012-10-31 18:38:36 +0000 | [diff] [blame] | 54 | case GL_RGB8_OES: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 55 | mBufferSize = 32; |
| 56 | mRedSize = 8; |
| 57 | mGreenSize = 8; |
| 58 | mBlueSize = 8; |
| 59 | mAlphaSize = 0; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 60 | mBindToTextureRGB = true; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 61 | break; |
| 62 | default: |
| 63 | UNREACHABLE(); // Other formats should not be valid |
| 64 | } |
| 65 | |
| 66 | mLuminanceSize = 0; |
| 67 | mAlphaMaskSize = 0; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 68 | mColorBufferType = EGL_RGB_BUFFER; |
daniel@transgaming.com | 3281f97 | 2012-10-31 18:38:51 +0000 | [diff] [blame] | 69 | mConfigCaveat = (desc.fastConfig) ? EGL_NONE : EGL_SLOW_CONFIG; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 70 | mConfigID = 0; |
| 71 | mConformant = EGL_OPENGL_ES2_BIT; |
| 72 | |
daniel@transgaming.com | 3281f97 | 2012-10-31 18:38:51 +0000 | [diff] [blame] | 73 | switch (desc.depthStencilFormat) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 74 | { |
daniel@transgaming.com | 106e1f7 | 2012-10-31 18:38:36 +0000 | [diff] [blame] | 75 | case GL_NONE: |
daniel@transgaming.com | a114c27 | 2011-04-22 04:18:50 +0000 | [diff] [blame] | 76 | mDepthSize = 0; |
| 77 | mStencilSize = 0; |
| 78 | break; |
daniel@transgaming.com | 106e1f7 | 2012-10-31 18:38:36 +0000 | [diff] [blame] | 79 | case GL_DEPTH_COMPONENT32_OES: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 80 | mDepthSize = 32; |
| 81 | mStencilSize = 0; |
| 82 | break; |
daniel@transgaming.com | 106e1f7 | 2012-10-31 18:38:36 +0000 | [diff] [blame] | 83 | case GL_DEPTH24_STENCIL8_OES: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 84 | mDepthSize = 24; |
| 85 | mStencilSize = 8; |
| 86 | break; |
daniel@transgaming.com | 106e1f7 | 2012-10-31 18:38:36 +0000 | [diff] [blame] | 87 | case GL_DEPTH_COMPONENT24_OES: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 88 | mDepthSize = 24; |
| 89 | mStencilSize = 0; |
| 90 | break; |
daniel@transgaming.com | 106e1f7 | 2012-10-31 18:38:36 +0000 | [diff] [blame] | 91 | case GL_DEPTH_COMPONENT16: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 92 | mDepthSize = 16; |
| 93 | mStencilSize = 0; |
| 94 | break; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 95 | default: |
| 96 | UNREACHABLE(); |
| 97 | } |
| 98 | |
| 99 | mLevel = 0; |
| 100 | mMatchNativePixmap = EGL_NONE; |
vladimirv@gmail.com | 721b7f2 | 2011-02-11 00:54:47 +0000 | [diff] [blame] | 101 | mMaxPBufferWidth = texWidth; |
| 102 | mMaxPBufferHeight = texHeight; |
| 103 | mMaxPBufferPixels = texWidth*texHeight; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 104 | mMaxSwapInterval = maxInterval; |
| 105 | mMinSwapInterval = minInterval; |
| 106 | mNativeRenderable = EGL_FALSE; |
| 107 | mNativeVisualID = 0; |
| 108 | mNativeVisualType = 0; |
| 109 | mRenderableType = EGL_OPENGL_ES2_BIT; |
daniel@transgaming.com | 3281f97 | 2012-10-31 18:38:51 +0000 | [diff] [blame] | 110 | mSampleBuffers = desc.multiSample ? 1 : 0; |
| 111 | mSamples = desc.multiSample; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 112 | mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT; |
| 113 | mTransparentType = EGL_NONE; |
| 114 | mTransparentRedValue = 0; |
| 115 | mTransparentGreenValue = 0; |
| 116 | mTransparentBlueValue = 0; |
| 117 | } |
| 118 | |
| 119 | EGLConfig Config::getHandle() const |
| 120 | { |
| 121 | return (EGLConfig)(size_t)mConfigID; |
| 122 | } |
| 123 | |
| 124 | SortConfig::SortConfig(const EGLint *attribList) |
| 125 | : mWantRed(false), mWantGreen(false), mWantBlue(false), mWantAlpha(false), mWantLuminance(false) |
| 126 | { |
| 127 | scanForWantedComponents(attribList); |
| 128 | } |
| 129 | |
| 130 | void SortConfig::scanForWantedComponents(const EGLint *attribList) |
| 131 | { |
| 132 | // [EGL] section 3.4.1 page 24 |
| 133 | // Sorting rule #3: by larger total number of color bits, not considering |
| 134 | // components that are 0 or don't-care. |
| 135 | for (const EGLint *attr = attribList; attr[0] != EGL_NONE; attr += 2) |
| 136 | { |
| 137 | if (attr[1] != 0 && attr[1] != EGL_DONT_CARE) |
| 138 | { |
| 139 | switch (attr[0]) |
| 140 | { |
| 141 | case EGL_RED_SIZE: mWantRed = true; break; |
| 142 | case EGL_GREEN_SIZE: mWantGreen = true; break; |
| 143 | case EGL_BLUE_SIZE: mWantBlue = true; break; |
| 144 | case EGL_ALPHA_SIZE: mWantAlpha = true; break; |
| 145 | case EGL_LUMINANCE_SIZE: mWantLuminance = true; break; |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | EGLint SortConfig::wantedComponentsSize(const Config &config) const |
| 152 | { |
| 153 | EGLint total = 0; |
| 154 | |
| 155 | if (mWantRed) total += config.mRedSize; |
| 156 | if (mWantGreen) total += config.mGreenSize; |
| 157 | if (mWantBlue) total += config.mBlueSize; |
| 158 | if (mWantAlpha) total += config.mAlphaSize; |
| 159 | if (mWantLuminance) total += config.mLuminanceSize; |
| 160 | |
| 161 | return total; |
| 162 | } |
| 163 | |
| 164 | bool SortConfig::operator()(const Config *x, const Config *y) const |
| 165 | { |
| 166 | return (*this)(*x, *y); |
| 167 | } |
| 168 | |
| 169 | bool SortConfig::operator()(const Config &x, const Config &y) const |
| 170 | { |
| 171 | #define SORT(attribute) \ |
| 172 | if (x.attribute != y.attribute) \ |
| 173 | { \ |
| 174 | return x.attribute < y.attribute; \ |
| 175 | } |
| 176 | |
| 177 | META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG); |
| 178 | SORT(mConfigCaveat); |
| 179 | |
| 180 | META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER); |
| 181 | SORT(mColorBufferType); |
| 182 | |
| 183 | // By larger total number of color bits, only considering those that are requested to be > 0. |
| 184 | EGLint xComponentsSize = wantedComponentsSize(x); |
| 185 | EGLint yComponentsSize = wantedComponentsSize(y); |
| 186 | if (xComponentsSize != yComponentsSize) |
| 187 | { |
| 188 | return xComponentsSize > yComponentsSize; |
| 189 | } |
| 190 | |
| 191 | SORT(mBufferSize); |
| 192 | SORT(mSampleBuffers); |
| 193 | SORT(mSamples); |
| 194 | SORT(mDepthSize); |
| 195 | SORT(mStencilSize); |
| 196 | SORT(mAlphaMaskSize); |
| 197 | SORT(mNativeVisualType); |
| 198 | SORT(mConfigID); |
| 199 | |
| 200 | #undef SORT |
| 201 | |
| 202 | return false; |
| 203 | } |
| 204 | |
| 205 | // We'd like to use SortConfig to also eliminate duplicate configs. |
| 206 | // This works as long as we never have two configs with different per-RGB-component layouts, |
| 207 | // but the same total. |
| 208 | // 5551 and 565 are different because R+G+B is different. |
| 209 | // 5551 and 555 are different because bufferSize is different. |
| 210 | const EGLint ConfigSet::mSortAttribs[] = |
| 211 | { |
| 212 | EGL_RED_SIZE, 1, |
| 213 | EGL_GREEN_SIZE, 1, |
| 214 | EGL_BLUE_SIZE, 1, |
| 215 | EGL_LUMINANCE_SIZE, 1, |
| 216 | // BUT NOT ALPHA |
| 217 | EGL_NONE |
| 218 | }; |
| 219 | |
| 220 | ConfigSet::ConfigSet() |
| 221 | : mSet(SortConfig(mSortAttribs)) |
| 222 | { |
| 223 | } |
| 224 | |
daniel@transgaming.com | 3281f97 | 2012-10-31 18:38:51 +0000 | [diff] [blame] | 225 | void ConfigSet::add(renderer::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 226 | { |
daniel@transgaming.com | 3281f97 | 2012-10-31 18:38:51 +0000 | [diff] [blame] | 227 | Config config(desc, minSwapInterval, maxSwapInterval, texWidth, texHeight); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 228 | mSet.insert(config); |
| 229 | } |
| 230 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 231 | size_t ConfigSet::size() const |
| 232 | { |
| 233 | return mSet.size(); |
| 234 | } |
| 235 | |
| 236 | bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig) |
| 237 | { |
daniel@transgaming.com | 6a94b97 | 2010-05-13 02:02:34 +0000 | [diff] [blame] | 238 | vector<const Config*> passed; |
| 239 | passed.reserve(mSet.size()); |
| 240 | |
| 241 | for (Iterator config = mSet.begin(); config != mSet.end(); config++) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 242 | { |
daniel@transgaming.com | 6a94b97 | 2010-05-13 02:02:34 +0000 | [diff] [blame] | 243 | bool match = true; |
| 244 | const EGLint *attribute = attribList; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 245 | |
daniel@transgaming.com | 6a94b97 | 2010-05-13 02:02:34 +0000 | [diff] [blame] | 246 | while (attribute[0] != EGL_NONE) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 247 | { |
daniel@transgaming.com | 6a94b97 | 2010-05-13 02:02:34 +0000 | [diff] [blame] | 248 | switch (attribute[0]) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 249 | { |
daniel@transgaming.com | 178adff | 2010-05-18 18:52:04 +0000 | [diff] [blame] | 250 | case EGL_BUFFER_SIZE: match = config->mBufferSize >= attribute[1]; break; |
| 251 | case EGL_ALPHA_SIZE: match = config->mAlphaSize >= attribute[1]; break; |
| 252 | case EGL_BLUE_SIZE: match = config->mBlueSize >= attribute[1]; break; |
| 253 | case EGL_GREEN_SIZE: match = config->mGreenSize >= attribute[1]; break; |
| 254 | case EGL_RED_SIZE: match = config->mRedSize >= attribute[1]; break; |
| 255 | case EGL_DEPTH_SIZE: match = config->mDepthSize >= attribute[1]; break; |
| 256 | case EGL_STENCIL_SIZE: match = config->mStencilSize >= attribute[1]; break; |
apatrick@chromium.org | 9c3a393 | 2012-01-30 20:03:32 +0000 | [diff] [blame] | 257 | case EGL_CONFIG_CAVEAT: match = config->mConfigCaveat == (EGLenum) attribute[1]; break; |
daniel@transgaming.com | 178adff | 2010-05-18 18:52:04 +0000 | [diff] [blame] | 258 | case EGL_CONFIG_ID: match = config->mConfigID == attribute[1]; break; |
| 259 | case EGL_LEVEL: match = config->mLevel >= attribute[1]; break; |
apatrick@chromium.org | 9c3a393 | 2012-01-30 20:03:32 +0000 | [diff] [blame] | 260 | case EGL_NATIVE_RENDERABLE: match = config->mNativeRenderable == (EGLBoolean) attribute[1]; break; |
daniel@transgaming.com | 178adff | 2010-05-18 18:52:04 +0000 | [diff] [blame] | 261 | case EGL_NATIVE_VISUAL_TYPE: match = config->mNativeVisualType == attribute[1]; break; |
| 262 | case EGL_SAMPLES: match = config->mSamples >= attribute[1]; break; |
| 263 | case EGL_SAMPLE_BUFFERS: match = config->mSampleBuffers >= attribute[1]; break; |
| 264 | case EGL_SURFACE_TYPE: match = (config->mSurfaceType & attribute[1]) == attribute[1]; break; |
apatrick@chromium.org | 9c3a393 | 2012-01-30 20:03:32 +0000 | [diff] [blame] | 265 | case EGL_TRANSPARENT_TYPE: match = config->mTransparentType == (EGLenum) attribute[1]; break; |
daniel@transgaming.com | 178adff | 2010-05-18 18:52:04 +0000 | [diff] [blame] | 266 | case EGL_TRANSPARENT_BLUE_VALUE: match = config->mTransparentBlueValue == attribute[1]; break; |
| 267 | case EGL_TRANSPARENT_GREEN_VALUE: match = config->mTransparentGreenValue == attribute[1]; break; |
| 268 | case EGL_TRANSPARENT_RED_VALUE: match = config->mTransparentRedValue == attribute[1]; break; |
apatrick@chromium.org | 9c3a393 | 2012-01-30 20:03:32 +0000 | [diff] [blame] | 269 | case EGL_BIND_TO_TEXTURE_RGB: match = config->mBindToTextureRGB == (EGLBoolean) attribute[1]; break; |
| 270 | case EGL_BIND_TO_TEXTURE_RGBA: match = config->mBindToTextureRGBA == (EGLBoolean) attribute[1]; break; |
daniel@transgaming.com | 178adff | 2010-05-18 18:52:04 +0000 | [diff] [blame] | 271 | case EGL_MIN_SWAP_INTERVAL: match = config->mMinSwapInterval == attribute[1]; break; |
| 272 | case EGL_MAX_SWAP_INTERVAL: match = config->mMaxSwapInterval == attribute[1]; break; |
| 273 | case EGL_LUMINANCE_SIZE: match = config->mLuminanceSize >= attribute[1]; break; |
| 274 | case EGL_ALPHA_MASK_SIZE: match = config->mAlphaMaskSize >= attribute[1]; break; |
apatrick@chromium.org | 9c3a393 | 2012-01-30 20:03:32 +0000 | [diff] [blame] | 275 | case EGL_COLOR_BUFFER_TYPE: match = config->mColorBufferType == (EGLenum) attribute[1]; break; |
daniel@transgaming.com | 178adff | 2010-05-18 18:52:04 +0000 | [diff] [blame] | 276 | case EGL_RENDERABLE_TYPE: match = (config->mRenderableType & attribute[1]) == attribute[1]; break; |
| 277 | case EGL_MATCH_NATIVE_PIXMAP: match = false; UNIMPLEMENTED(); break; |
| 278 | case EGL_CONFORMANT: match = (config->mConformant & attribute[1]) == attribute[1]; break; |
vladimirv@gmail.com | 721b7f2 | 2011-02-11 00:54:47 +0000 | [diff] [blame] | 279 | case EGL_MAX_PBUFFER_WIDTH: match = config->mMaxPBufferWidth >= attribute[1]; break; |
| 280 | case EGL_MAX_PBUFFER_HEIGHT: match = config->mMaxPBufferHeight >= attribute[1]; break; |
| 281 | case EGL_MAX_PBUFFER_PIXELS: match = config->mMaxPBufferPixels >= attribute[1]; break; |
daniel@transgaming.com | 6a94b97 | 2010-05-13 02:02:34 +0000 | [diff] [blame] | 282 | default: |
| 283 | return false; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 284 | } |
| 285 | |
daniel@transgaming.com | 6a94b97 | 2010-05-13 02:02:34 +0000 | [diff] [blame] | 286 | if (!match) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 287 | { |
daniel@transgaming.com | 6a94b97 | 2010-05-13 02:02:34 +0000 | [diff] [blame] | 288 | break; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 289 | } |
daniel@transgaming.com | 6a94b97 | 2010-05-13 02:02:34 +0000 | [diff] [blame] | 290 | |
| 291 | attribute += 2; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 292 | } |
| 293 | |
daniel@transgaming.com | 6a94b97 | 2010-05-13 02:02:34 +0000 | [diff] [blame] | 294 | if (match) |
| 295 | { |
| 296 | passed.push_back(&*config); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | if (configs) |
| 301 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 302 | sort(passed.begin(), passed.end(), SortConfig(attribList)); |
| 303 | |
| 304 | EGLint index; |
| 305 | for (index = 0; index < configSize && index < static_cast<EGLint>(passed.size()); index++) |
| 306 | { |
| 307 | configs[index] = passed[index]->getHandle(); |
| 308 | } |
| 309 | |
| 310 | *numConfig = index; |
| 311 | } |
| 312 | else |
| 313 | { |
daniel@transgaming.com | 6a94b97 | 2010-05-13 02:02:34 +0000 | [diff] [blame] | 314 | *numConfig = passed.size(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 315 | } |
| 316 | |
| 317 | return true; |
| 318 | } |
| 319 | |
| 320 | const egl::Config *ConfigSet::get(EGLConfig configHandle) |
| 321 | { |
| 322 | for (Iterator config = mSet.begin(); config != mSet.end(); config++) |
| 323 | { |
| 324 | if (config->getHandle() == configHandle) |
| 325 | { |
| 326 | return &(*config); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | return NULL; |
| 331 | } |
| 332 | } |