diff options
author | Brian Paul <[email protected]> | 2005-05-16 02:14:50 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-05-16 02:14:50 +0000 |
commit | 6493bd07a7a766552c754920190972c91f5c336c (patch) | |
tree | 8fd6a142d1dc3f8ac1b23a81ac6678f3400c56aa /src/egl | |
parent | 7bfe8df08aa53f04031f0812d3bd4164581df559 (diff) |
restore _eglSetConfigAttrib (for now), added prototype _eglConfigToContextModesRec()
Diffstat (limited to 'src/egl')
-rw-r--r-- | src/egl/main/eglconfig.c | 79 | ||||
-rw-r--r-- | src/egl/main/eglconfig.h | 3 |
2 files changed, 59 insertions, 23 deletions
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index e5aeeb1ab9a..59503f6c9be 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -16,8 +16,41 @@ #define MIN2(A, B) (((A) < (B)) ? (A) : (B)) -static void -SetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val) +/** + * Convert an _EGLConfig to a __GLcontextModes object. + */ +void +_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode) +{ + memset(mode, 0, sizeof(*mode)); + + mode->rgbMode = GL_TRUE; /* no color index */ + mode->colorIndexMode = GL_FALSE; + mode->doubleBufferMode = GL_TRUE; + mode->stereoMode = GL_FALSE; + + mode->redBits = GET_CONFIG_ATTRIB(config, EGL_RED_SIZE); + mode->greenBits = GET_CONFIG_ATTRIB(config, EGL_GREEN_SIZE); + mode->blueBits = GET_CONFIG_ATTRIB(config, EGL_BLUE_SIZE); + mode->alphaBits = GET_CONFIG_ATTRIB(config, EGL_ALPHA_SIZE); + mode->rgbBits = mode->redBits + mode->greenBits + + mode->blueBits + mode->alphaBits; + + mode->depthBits = GET_CONFIG_ATTRIB(config, EGL_DEPTH_SIZE); + mode->haveDepthBuffer = mode->depthBits > 0; + + mode->stencilBits = GET_CONFIG_ATTRIB(config, EGL_STENCIL_SIZE); + mode->haveStencilBuffer = mode->stencilBits > 0; + + mode->level = GET_CONFIG_ATTRIB(config, EGL_LEVEL); + mode->samples = GET_CONFIG_ATTRIB(config, EGL_SAMPLES); + mode->sampleBuffers = GET_CONFIG_ATTRIB(config, EGL_SAMPLE_BUFFERS); +} + + + +void +_eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val) { config->Attrib[attr - FIRST_ATTRIB] = val; @@ -101,21 +134,21 @@ _eglInitConfig(_EGLConfig *config, EGLint id) { memset(config, 0, sizeof(*config)); config->Handle = id; - SetConfigAttrib(config, EGL_CONFIG_ID, id); - SetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGB, EGL_DONT_CARE); - SetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGBA, EGL_DONT_CARE); - SetConfigAttrib(config, EGL_CONFIG_CAVEAT, EGL_DONT_CARE); - SetConfigAttrib(config, EGL_NATIVE_RENDERABLE, EGL_DONT_CARE); - SetConfigAttrib(config, EGL_NATIVE_VISUAL_TYPE, EGL_DONT_CARE); - SetConfigAttrib(config, EGL_MIN_SWAP_INTERVAL, EGL_DONT_CARE); - SetConfigAttrib(config, EGL_MAX_SWAP_INTERVAL, EGL_DONT_CARE); - SetConfigAttrib(config, EGL_SURFACE_TYPE, + _eglSetConfigAttrib(config, EGL_CONFIG_ID, id); + _eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGB, EGL_DONT_CARE); + _eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGBA, EGL_DONT_CARE); + _eglSetConfigAttrib(config, EGL_CONFIG_CAVEAT, EGL_DONT_CARE); + _eglSetConfigAttrib(config, EGL_NATIVE_RENDERABLE, EGL_DONT_CARE); + _eglSetConfigAttrib(config, EGL_NATIVE_VISUAL_TYPE, EGL_DONT_CARE); + _eglSetConfigAttrib(config, EGL_MIN_SWAP_INTERVAL, EGL_DONT_CARE); + _eglSetConfigAttrib(config, EGL_MAX_SWAP_INTERVAL, EGL_DONT_CARE); + _eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_SCREEN_BIT_MESA | EGL_PBUFFER_BIT | EGL_PIXMAP_BIT | EGL_WINDOW_BIT); - SetConfigAttrib(config, EGL_TRANSPARENT_TYPE, EGL_NONE); - SetConfigAttrib(config, EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE); - SetConfigAttrib(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE); - SetConfigAttrib(config, EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE); + _eglSetConfigAttrib(config, EGL_TRANSPARENT_TYPE, EGL_NONE); + _eglSetConfigAttrib(config, EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE); + _eglSetConfigAttrib(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE); + _eglSetConfigAttrib(config, EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE); } @@ -581,15 +614,15 @@ _eglFillInConfigs(_EGLConfig * configs, for (i = 0; i < num_db_modes; i++) { for (j = 0; j < 2; j++) { - SetConfigAttrib(config, EGL_RED_SIZE, bits[0]); - SetConfigAttrib(config, EGL_GREEN_SIZE, bits[1]); - SetConfigAttrib(config, EGL_BLUE_SIZE, bits[2]); - SetConfigAttrib(config, EGL_ALPHA_SIZE, bits[3]); + _eglSetConfigAttrib(config, EGL_RED_SIZE, bits[0]); + _eglSetConfigAttrib(config, EGL_GREEN_SIZE, bits[1]); + _eglSetConfigAttrib(config, EGL_BLUE_SIZE, bits[2]); + _eglSetConfigAttrib(config, EGL_ALPHA_SIZE, bits[3]); config->glmode.redMask = masks[0]; config->glmode.greenMask = masks[1]; config->glmode.blueMask = masks[2]; config->glmode.alphaMask = masks[3]; - SetConfigAttrib(config, EGL_BUFFER_SIZE, + _eglSetConfigAttrib(config, EGL_BUFFER_SIZE, config->glmode.redBits + config->glmode.greenBits + config->glmode.blueBits + config->glmode.alphaBits); @@ -599,12 +632,12 @@ _eglFillInConfigs(_EGLConfig * configs, config->glmode.accumAlphaBits = (masks[3] != 0) ? 16 * j : 0; config->glmode.visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; - SetConfigAttrib(config, EGL_STENCIL_SIZE, stencil_bits[k]); - SetConfigAttrib(config, EGL_DEPTH_SIZE, depth_bits[k]); + _eglSetConfigAttrib(config, EGL_STENCIL_SIZE, stencil_bits[k]); + _eglSetConfigAttrib(config, EGL_DEPTH_SIZE, depth_bits[k]); config->glmode.visualType = visType; config->glmode.renderType = GLX_RGBA_BIT; - SetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_SCREEN_BIT_MESA | + _eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_SCREEN_BIT_MESA | EGL_PBUFFER_BIT | EGL_PIXMAP_BIT | EGL_WINDOW_BIT); config->glmode.rgbMode = GL_TRUE; diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h index 8d5c5a76303..3ec8a757748 100644 --- a/src/egl/main/eglconfig.h +++ b/src/egl/main/eglconfig.h @@ -58,6 +58,9 @@ extern EGLBoolean _eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +extern void +_eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val); + extern GLboolean _eglFillInConfigs( _EGLConfig *configs, GLenum fb_format, GLenum fb_type, |