Commit 4104146a by Nicolas Capens Committed by Nicolas Capens

Fix setting the number of matching configs for an unknown attribute.

BUG=18201982 Change-Id: I638fc7b666490ab7109058b4db31d942013f98a5 Reviewed-on: https://swiftshader-review.googlesource.com/1302Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent faa10f05
......@@ -281,43 +281,44 @@ bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint
while(attribute[0] != EGL_NONE)
{
switch (attribute[0])
switch(attribute[0])
{
case EGL_BUFFER_SIZE: match = config->mBufferSize >= attribute[1]; break;
case EGL_ALPHA_SIZE: match = config->mAlphaSize >= attribute[1]; break;
case EGL_BLUE_SIZE: match = config->mBlueSize >= attribute[1]; break;
case EGL_GREEN_SIZE: match = config->mGreenSize >= attribute[1]; break;
case EGL_RED_SIZE: match = config->mRedSize >= attribute[1]; break;
case EGL_DEPTH_SIZE: match = config->mDepthSize >= attribute[1]; break;
case EGL_STENCIL_SIZE: match = config->mStencilSize >= attribute[1]; break;
case EGL_CONFIG_CAVEAT: match = config->mConfigCaveat == attribute[1]; break;
case EGL_CONFIG_ID: match = config->mConfigID == attribute[1]; break;
case EGL_LEVEL: match = config->mLevel >= attribute[1]; break;
case EGL_NATIVE_RENDERABLE: match = config->mNativeRenderable == attribute[1]; break;
case EGL_NATIVE_VISUAL_ID: match = config->mNativeVisualID == attribute[1]; break;
case EGL_NATIVE_VISUAL_TYPE: match = config->mNativeVisualType == attribute[1]; break;
case EGL_SAMPLES: match = config->mSamples >= attribute[1]; break;
case EGL_SAMPLE_BUFFERS: match = config->mSampleBuffers >= attribute[1]; break;
case EGL_SURFACE_TYPE: match = (config->mSurfaceType & attribute[1]) == attribute[1]; break;
case EGL_TRANSPARENT_TYPE: match = config->mTransparentType == attribute[1]; break;
case EGL_TRANSPARENT_BLUE_VALUE: match = config->mTransparentBlueValue == attribute[1]; break;
case EGL_TRANSPARENT_GREEN_VALUE: match = config->mTransparentGreenValue == attribute[1]; break;
case EGL_TRANSPARENT_RED_VALUE: match = config->mTransparentRedValue == attribute[1]; break;
case EGL_BIND_TO_TEXTURE_RGB: match = config->mBindToTextureRGB == attribute[1]; break;
case EGL_BIND_TO_TEXTURE_RGBA: match = config->mBindToTextureRGBA == attribute[1]; break;
case EGL_MIN_SWAP_INTERVAL: match = config->mMinSwapInterval == attribute[1]; break;
case EGL_MAX_SWAP_INTERVAL: match = config->mMaxSwapInterval == attribute[1]; break;
case EGL_LUMINANCE_SIZE: match = config->mLuminanceSize >= attribute[1]; break;
case EGL_ALPHA_MASK_SIZE: match = config->mAlphaMaskSize >= attribute[1]; break;
case EGL_COLOR_BUFFER_TYPE: match = config->mColorBufferType == attribute[1]; break;
case EGL_RENDERABLE_TYPE: match = (config->mRenderableType & attribute[1]) == attribute[1]; break;
case EGL_MATCH_NATIVE_PIXMAP: match = false; UNIMPLEMENTED(); break;
case EGL_CONFORMANT: match = (config->mConformant & attribute[1]) == attribute[1]; break;
case EGL_MAX_PBUFFER_WIDTH: match = config->mMaxPBufferWidth >= attribute[1]; break;
case EGL_MAX_PBUFFER_HEIGHT: match = config->mMaxPBufferHeight >= attribute[1]; break;
case EGL_MAX_PBUFFER_PIXELS: match = config->mMaxPBufferPixels >= attribute[1]; break;
default:
return false;
case EGL_BUFFER_SIZE: match = config->mBufferSize >= attribute[1]; break;
case EGL_ALPHA_SIZE: match = config->mAlphaSize >= attribute[1]; break;
case EGL_BLUE_SIZE: match = config->mBlueSize >= attribute[1]; break;
case EGL_GREEN_SIZE: match = config->mGreenSize >= attribute[1]; break;
case EGL_RED_SIZE: match = config->mRedSize >= attribute[1]; break;
case EGL_DEPTH_SIZE: match = config->mDepthSize >= attribute[1]; break;
case EGL_STENCIL_SIZE: match = config->mStencilSize >= attribute[1]; break;
case EGL_CONFIG_CAVEAT: match = config->mConfigCaveat == attribute[1]; break;
case EGL_CONFIG_ID: match = config->mConfigID == attribute[1]; break;
case EGL_LEVEL: match = config->mLevel >= attribute[1]; break;
case EGL_NATIVE_RENDERABLE: match = config->mNativeRenderable == attribute[1]; break;
case EGL_NATIVE_VISUAL_ID: match = config->mNativeVisualID == attribute[1]; break;
case EGL_NATIVE_VISUAL_TYPE: match = config->mNativeVisualType == attribute[1]; break;
case EGL_SAMPLES: match = config->mSamples >= attribute[1]; break;
case EGL_SAMPLE_BUFFERS: match = config->mSampleBuffers >= attribute[1]; break;
case EGL_SURFACE_TYPE: match = (config->mSurfaceType & attribute[1]) == attribute[1]; break;
case EGL_TRANSPARENT_TYPE: match = config->mTransparentType == attribute[1]; break;
case EGL_TRANSPARENT_BLUE_VALUE: match = config->mTransparentBlueValue == attribute[1]; break;
case EGL_TRANSPARENT_GREEN_VALUE: match = config->mTransparentGreenValue == attribute[1]; break;
case EGL_TRANSPARENT_RED_VALUE: match = config->mTransparentRedValue == attribute[1]; break;
case EGL_BIND_TO_TEXTURE_RGB: match = config->mBindToTextureRGB == attribute[1]; break;
case EGL_BIND_TO_TEXTURE_RGBA: match = config->mBindToTextureRGBA == attribute[1]; break;
case EGL_MIN_SWAP_INTERVAL: match = config->mMinSwapInterval == attribute[1]; break;
case EGL_MAX_SWAP_INTERVAL: match = config->mMaxSwapInterval == attribute[1]; break;
case EGL_LUMINANCE_SIZE: match = config->mLuminanceSize >= attribute[1]; break;
case EGL_ALPHA_MASK_SIZE: match = config->mAlphaMaskSize >= attribute[1]; break;
case EGL_COLOR_BUFFER_TYPE: match = config->mColorBufferType == attribute[1]; break;
case EGL_RENDERABLE_TYPE: match = (config->mRenderableType & attribute[1]) == attribute[1]; break;
case EGL_MATCH_NATIVE_PIXMAP: match = false; UNIMPLEMENTED(); break;
case EGL_CONFORMANT: match = (config->mConformant & attribute[1]) == attribute[1]; break;
case EGL_MAX_PBUFFER_WIDTH: match = config->mMaxPBufferWidth >= attribute[1]; break;
case EGL_MAX_PBUFFER_HEIGHT: match = config->mMaxPBufferHeight >= attribute[1]; break;
case EGL_MAX_PBUFFER_PIXELS: match = config->mMaxPBufferPixels >= attribute[1]; break;
default:
UNIMPLEMENTED();
match = false;
}
if(!match)
......
......@@ -229,7 +229,7 @@ EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint
return error(EGL_BAD_PARAMETER, EGL_FALSE);
}
const EGLint attribList[] = {EGL_NONE};
const EGLint attribList[] = {EGL_NONE};
if(!display->getConfigs(configs, attribList, config_size, num_config))
{
......@@ -266,7 +266,7 @@ EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list
return error(EGL_BAD_PARAMETER, EGL_FALSE);
}
const EGLint attribList[] = {EGL_NONE};
const EGLint attribList[] = {EGL_NONE};
if(!attrib_list)
{
......
......@@ -254,25 +254,27 @@ void error(EGLint errorCode)
{
egl::setCurrentError(errorCode);
switch(errorCode)
{
case EGL_SUCCESS: break;
case EGL_NOT_INITIALIZED: TRACE("\t! Error generated: not initialized\n"); break;
case EGL_BAD_ACCESS: TRACE("\t! Error generated: bad access\n"); break;
case EGL_BAD_ALLOC: TRACE("\t! Error generated: bad alloc\n"); break;
case EGL_BAD_ATTRIBUTE: TRACE("\t! Error generated: bad attribute\n"); break;
case EGL_BAD_CONFIG: TRACE("\t! Error generated: bad config\n"); break;
case EGL_BAD_CONTEXT: TRACE("\t! Error generated: bad context\n"); break;
case EGL_BAD_CURRENT_SURFACE: TRACE("\t! Error generated: bad current surface\n"); break;
case EGL_BAD_DISPLAY: TRACE("\t! Error generated: bad display\n"); break;
case EGL_BAD_MATCH: TRACE("\t! Error generated: bad match\n"); break;
case EGL_BAD_NATIVE_PIXMAP: TRACE("\t! Error generated: bad native pixmap\n"); break;
case EGL_BAD_NATIVE_WINDOW: TRACE("\t! Error generated: bad native window\n"); break;
case EGL_BAD_PARAMETER: TRACE("\t! Error generated: bad parameter\n"); break;
case EGL_BAD_SURFACE: TRACE("\t! Error generated: bad surface\n"); break;
case EGL_CONTEXT_LOST: TRACE("\t! Error generated: context lost\n"); break;
default: TRACE("\t! Error generated: <0x%X>\n", errorCode); break;
}
if(errorCode != EGL_SUCCESS)
{
switch(errorCode)
{
case EGL_NOT_INITIALIZED: TRACE("\t! Error generated: not initialized\n"); break;
case EGL_BAD_ACCESS: TRACE("\t! Error generated: bad access\n"); break;
case EGL_BAD_ALLOC: TRACE("\t! Error generated: bad alloc\n"); break;
case EGL_BAD_ATTRIBUTE: TRACE("\t! Error generated: bad attribute\n"); break;
case EGL_BAD_CONFIG: TRACE("\t! Error generated: bad config\n"); break;
case EGL_BAD_CONTEXT: TRACE("\t! Error generated: bad context\n"); break;
case EGL_BAD_CURRENT_SURFACE: TRACE("\t! Error generated: bad current surface\n"); break;
case EGL_BAD_DISPLAY: TRACE("\t! Error generated: bad display\n"); break;
case EGL_BAD_MATCH: TRACE("\t! Error generated: bad match\n"); break;
case EGL_BAD_NATIVE_PIXMAP: TRACE("\t! Error generated: bad native pixmap\n"); break;
case EGL_BAD_NATIVE_WINDOW: TRACE("\t! Error generated: bad native window\n"); break;
case EGL_BAD_PARAMETER: TRACE("\t! Error generated: bad parameter\n"); break;
case EGL_BAD_SURFACE: TRACE("\t! Error generated: bad surface\n"); break;
case EGL_CONTEXT_LOST: TRACE("\t! Error generated: context lost\n"); break;
default: TRACE("\t! Error generated: <0x%X>\n", errorCode); break;
}
}
}
namespace es1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment