diff options
author | marha <marha@users.sourceforge.net> | 2014-03-21 19:36:05 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-21 19:36:05 +0100 |
commit | 41fea4472dec859ddec76bdfa7108ebec71de1e3 (patch) | |
tree | 385ccec6dc105acc75169122d4e0714046cfbbd5 /mesalib/src/mesa/main/context.c | |
parent | cd8b0d0de3fcb53f6d3ece8ce26d97aaab2c0914 (diff) | |
download | vcxsrv-41fea4472dec859ddec76bdfa7108ebec71de1e3.tar.gz vcxsrv-41fea4472dec859ddec76bdfa7108ebec71de1e3.tar.bz2 vcxsrv-41fea4472dec859ddec76bdfa7108ebec71de1e3.zip |
xserver fontconfig libX11 libXext libxcb mesa git update 21 Mar 2014
xserver commit 4fb31e4824d46edc80bb49b4065152899faa5ac6
libxcb commit cb686b576739deea00180c54697c8b62b8419ae0
libX11 commit 8be4610939b833587954957f5963eb4191b43d19
libXext commit 11aad96bd689d54156064d2e81213dc827a689d1
fontconfig commit 5478192f379d784b421329e4bf72cc780818e467
mesa commit 8d8d0cb09eb8735a04fc36cc4d0e2dc9f9d460eb
Diffstat (limited to 'mesalib/src/mesa/main/context.c')
-rw-r--r-- | mesalib/src/mesa/main/context.c | 82 |
1 files changed, 62 insertions, 20 deletions
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 5b77ce103..cd009c115 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -1013,7 +1013,8 @@ _mesa_initialize_dispatch_tables(struct gl_context *ctx) * * \param ctx the context to initialize * \param api the GL API type to create the context for - * \param visual describes the visual attributes for this context + * \param visual describes the visual attributes for this context or NULL to + * create a configless context * \param share_list points to context to share textures, display lists, * etc with, or NULL * \param driverFunctions table of device driver functions for this context @@ -1033,12 +1034,20 @@ _mesa_initialize_context(struct gl_context *ctx, assert(driverFunctions->FreeTextureImageBuffer); ctx->API = api; - ctx->Visual = *visual; ctx->DrawBuffer = NULL; ctx->ReadBuffer = NULL; ctx->WinSysDrawBuffer = NULL; ctx->WinSysReadBuffer = NULL; + if (visual) { + ctx->Visual = *visual; + ctx->HasConfig = GL_TRUE; + } + else { + memset(&ctx->Visual, 0, sizeof ctx->Visual); + ctx->HasConfig = GL_FALSE; + } + if (_mesa_is_desktop_gl(ctx)) { _mesa_override_gl_version(ctx); } @@ -1145,7 +1154,8 @@ fail: * the rendering context. * * \param api the GL API type to create the context for - * \param visual a struct gl_config pointer (we copy the struct contents) + * \param visual a struct gl_config pointer (we copy the struct contents) or + * NULL to create a configless context * \param share_list another context to share display lists with or NULL * \param driverFunctions points to the dd_function_table into which the * driver has plugged in all its special functions. @@ -1160,8 +1170,6 @@ _mesa_create_context(gl_api api, { struct gl_context *ctx; - ASSERT(visual); - ctx = calloc(1, sizeof(struct gl_context)); if (!ctx) return NULL; @@ -1475,6 +1483,54 @@ _mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height) } } +static void +handle_first_current(struct gl_context *ctx) +{ + GLenum buffer; + GLint bufferIndex; + + assert(ctx->Version > 0); + + ctx->Extensions.String = _mesa_make_extension_string(ctx); + + check_context_limits(ctx); + + /* According to GL_MESA_configless_context the default value of + * glDrawBuffers depends on the config of the first surface it is bound to. + * For GLES it is always GL_BACK which has a magic interpretation */ + if (!ctx->HasConfig && _mesa_is_desktop_gl(ctx)) { + if (ctx->DrawBuffer != _mesa_get_incomplete_framebuffer()) { + if (ctx->DrawBuffer->Visual.doubleBufferMode) + buffer = GL_BACK; + else + buffer = GL_FRONT; + + _mesa_drawbuffers(ctx, 1, &buffer, NULL /* destMask */); + } + + if (ctx->ReadBuffer != _mesa_get_incomplete_framebuffer()) { + if (ctx->ReadBuffer->Visual.doubleBufferMode) { + buffer = GL_BACK; + bufferIndex = BUFFER_BACK_LEFT; + } + else { + buffer = GL_FRONT; + bufferIndex = BUFFER_FRONT_LEFT; + } + + _mesa_readbuffer(ctx, buffer, bufferIndex); + } + } + + /* We can use this to help debug user's problems. Tell them to set + * the MESA_INFO env variable before running their app. Then the + * first time each context is made current we'll print some useful + * information. + */ + if (_mesa_getenv("MESA_INFO")) { + _mesa_print_info(ctx); + } +} /** * Bind the given context to the given drawBuffer and readBuffer and @@ -1567,21 +1623,7 @@ _mesa_make_current( struct gl_context *newCtx, } if (newCtx->FirstTimeCurrent) { - assert(newCtx->Version > 0); - - newCtx->Extensions.String = _mesa_make_extension_string(newCtx); - - check_context_limits(newCtx); - - /* We can use this to help debug user's problems. Tell them to set - * the MESA_INFO env variable before running their app. Then the - * first time each context is made current we'll print some useful - * information. - */ - if (_mesa_getenv("MESA_INFO")) { - _mesa_print_info(newCtx); - } - + handle_first_current(newCtx); newCtx->FirstTimeCurrent = GL_FALSE; } } |