diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-05-20 14:42:02 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-05-20 14:55:40 (GMT) |
commit | 27fadaa7eb2d58b47e7f0f508e3402e7a8de3894 (patch) | |
tree | d437982fe83dcb0c106455e77ff7d565aae7cd14 /src | |
parent | b5fd79dfe69513ccf8d83e2eac45ae9b830a2d56 (diff) | |
download | Qt-27fadaa7eb2d58b47e7f0f508e3402e7a8de3894.zip Qt-27fadaa7eb2d58b47e7f0f508e3402e7a8de3894.tar.gz Qt-27fadaa7eb2d58b47e7f0f508e3402e7a8de3894.tar.bz2 |
Make QEglProperties::value() return the EGL default if not set
Previously it would always return EGL_DONT_CARE, which causes a bug
somewhere on X11 leading to configs being requested with E.g.
EGL_GREEN_SIZE == EGL_DONT_CARE == -1 == 0xFFFFFFFF when cast to a uint.
This also helps debug config matching as toString() now indicates the
match criteria EGL will use.
Diffstat (limited to 'src')
-rw-r--r-- | src/opengl/qegl.cpp | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/opengl/qegl.cpp b/src/opengl/qegl.cpp index 165a0f3..aebc3cb 100644 --- a/src/opengl/qegl.cpp +++ b/src/opengl/qegl.cpp @@ -405,7 +405,54 @@ int QEglProperties::value(int name) const if (props[index] == name) return props[index + 1]; } - return EGL_DONT_CARE; + + // If the attribute has not been explicitly set, return the EGL default + // The following defaults were taken from the EGL 1.4 spec: + switch(name) { + case EGL_BUFFER_SIZE: return 0; + case EGL_RED_SIZE: return 0; + case EGL_GREEN_SIZE: return 0; + case EGL_BLUE_SIZE: return 0; + case EGL_LUMINANCE_SIZE: return 0; + case EGL_ALPHA_SIZE: return 0; + case EGL_ALPHA_MASK_SIZE: return 0; + case EGL_BIND_TO_TEXTURE_RGB: return EGL_DONT_CARE; + case EGL_BIND_TO_TEXTURE_RGBA: return EGL_DONT_CARE; + case EGL_COLOR_BUFFER_TYPE: return EGL_RGB_BUFFER; + case EGL_CONFIG_CAVEAT: return EGL_DONT_CARE; + case EGL_CONFIG_ID: return EGL_DONT_CARE; + case EGL_DEPTH_SIZE: return 0; + case EGL_LEVEL: return 0; + case EGL_NATIVE_RENDERABLE: return EGL_DONT_CARE; + case EGL_NATIVE_VISUAL_TYPE: return EGL_DONT_CARE; + case EGL_MAX_SWAP_INTERVAL: return EGL_DONT_CARE; + case EGL_MIN_SWAP_INTERVAL: return EGL_DONT_CARE; + case EGL_RENDERABLE_TYPE: return EGL_OPENGL_ES_BIT; + case EGL_SAMPLE_BUFFERS: return 0; + case EGL_SAMPLES: return 0; + case EGL_STENCIL_SIZE: return 0; + case EGL_SURFACE_TYPE: return EGL_WINDOW_BIT; + case EGL_TRANSPARENT_TYPE: return EGL_NONE; + case EGL_TRANSPARENT_RED_VALUE: return EGL_DONT_CARE; + case EGL_TRANSPARENT_GREEN_VALUE: return EGL_DONT_CARE; + case EGL_TRANSPARENT_BLUE_VALUE: return EGL_DONT_CARE; + +#if defined(EGL_VERSION_1_3) + case EGL_CONFORMANT: return 0; + case EGL_MATCH_NATIVE_PIXMAP: return EGL_NONE; +#endif + + case EGL_MAX_PBUFFER_HEIGHT: + case EGL_MAX_PBUFFER_WIDTH: + case EGL_MAX_PBUFFER_PIXELS: + case EGL_NATIVE_VISUAL_ID: + case EGL_NONE: + qWarning("QEglProperties::value() - Attibute %d does not affect config selection", name); + return 0; + default: + qWarning("QEglProperties::value() - Attibute %d is unknown in EGL <=1.4", name); + return EGL_DONT_CARE; + } } // Set the value associated with a property, replacing an existing |