From 41fea4472dec859ddec76bdfa7108ebec71de1e3 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 21 Mar 2014 19:36:05 +0100 Subject: 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 --- mesalib/src/mesa/main/blend.c | 4 +- mesalib/src/mesa/main/buffers.c | 7 +++- mesalib/src/mesa/main/context.c | 82 +++++++++++++++++++++++++++++---------- mesalib/src/mesa/main/errors.c | 5 ++- mesalib/src/mesa/main/fbobject.c | 4 -- mesalib/src/mesa/main/genmipmap.c | 4 ++ mesalib/src/mesa/main/get.c | 6 +-- mesalib/src/mesa/main/mipmap.c | 44 ++++++++++----------- mesalib/src/mesa/main/mtypes.h | 6 +++ mesalib/src/mesa/main/teximage.c | 16 ++++---- 10 files changed, 116 insertions(+), 62 deletions(-) (limited to 'mesalib/src/mesa/main') diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c index eb4f1d6be..c37c0fea5 100644 --- a/mesalib/src/mesa/main/blend.c +++ b/mesalib/src/mesa/main/blend.c @@ -911,7 +911,9 @@ void _mesa_init_color( struct gl_context * ctx ) ctx->Color.LogicOp = GL_COPY; ctx->Color.DitherFlag = GL_TRUE; - if (ctx->Visual.doubleBufferMode) { + /* GL_FRONT is not possible on GLES. Instead GL_BACK will render to either + * the front or the back buffer depending on the config */ + if (ctx->Visual.doubleBufferMode || _mesa_is_gles(ctx)) { ctx->Color.DrawBuffer[0] = GL_BACK; } else { diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c index 6cbce9d5d..b13a7af65 100644 --- a/mesalib/src/mesa/main/buffers.c +++ b/mesalib/src/mesa/main/buffers.c @@ -101,7 +101,7 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer) case GL_FRONT: return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT; case GL_BACK: - if (_mesa_is_gles3(ctx)) { + if (_mesa_is_gles(ctx)) { /* Page 181 (page 192 of the PDF) in section 4.2.1 of the OpenGL * ES 3.0.1 specification says: * @@ -111,6 +111,11 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer) * * Since there is no stereo rendering in ES 3.0, only return the * LEFT bits. This also satisfies the "n must be 1" requirement. + * + * We also do this for GLES 1 and 2 because those APIs have no + * concept of selecting the front and back buffer anyway and it's + * convenient to be able to maintain the magic behaviour of + * GL_BACK in that case. */ if (ctx->DrawBuffer->Visual.doubleBufferMode) return BUFFER_BIT_BACK_LEFT; 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; } } diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index 8ec6a8c33..9151718ea 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -969,7 +969,7 @@ _mesa_init_errors(struct gl_context *ctx) /** * Loop through debug group stack tearing down states for - * filtering debug messages. + * filtering debug messages. Then free debug output state. */ void _mesa_free_errors_data(struct gl_context *ctx) @@ -980,6 +980,9 @@ _mesa_free_errors_data(struct gl_context *ctx) for (i = 0; i <= ctx->Debug->GroupStackDepth; i++) { free_errors_data(ctx, i); } + FREE(ctx->Debug); + /* set to NULL just in case it is used before context is completely gone. */ + ctx->Debug = NULL; } } diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index a9dcc5144..dfe2f1e93 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -1565,10 +1565,6 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ARB_texture_float && ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0; - case GL_RGB9_E5: - return (_mesa_is_desktop_gl(ctx) - && ctx->Extensions.EXT_texture_shared_exponent) - ? GL_RGB : 0; case GL_R11F_G11F_B10F: return ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float) || _mesa_is_gles3(ctx) /* EXT_color_buffer_float */ ) diff --git a/mesalib/src/mesa/main/genmipmap.c b/mesalib/src/mesa/main/genmipmap.c index dcd482da2..9d111cab2 100644 --- a/mesalib/src/mesa/main/genmipmap.c +++ b/mesalib/src/mesa/main/genmipmap.c @@ -74,6 +74,10 @@ _mesa_GenerateMipmap(GLenum target) error = (_mesa_is_gles(ctx) && ctx->Version < 30) || !ctx->Extensions.EXT_texture_array; break; + case GL_TEXTURE_CUBE_MAP_ARRAY: + error = _mesa_is_gles(ctx) || + !ctx->Extensions.ARB_texture_cube_map_array; + break; default: error = GL_TRUE; } diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index b1908515c..88cf202df 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -1997,7 +1997,7 @@ _mesa_GetBooleani_v( GLenum pname, GLuint index, GLboolean *params ) params[3] = INT_TO_BOOLEAN(v.value_int_4[3]); break; case TYPE_INT64: - params[0] = INT64_TO_BOOLEAN(v.value_int); + params[0] = INT64_TO_BOOLEAN(v.value_int64); break; default: ; /* nothing - GL error was recorded */ @@ -2042,7 +2042,7 @@ _mesa_GetIntegeri_v( GLenum pname, GLuint index, GLint *params ) params[3] = v.value_int_4[3]; break; case TYPE_INT64: - params[0] = INT64_TO_INT(v.value_int); + params[0] = INT64_TO_INT(v.value_int64); break; default: ; /* nothing - GL error was recorded */ @@ -2067,7 +2067,7 @@ _mesa_GetInteger64i_v( GLenum pname, GLuint index, GLint64 *params ) params[3] = v.value_int_4[3]; break; case TYPE_INT64: - params[0] = v.value_int; + params[0] = v.value_int64; break; default: ; /* nothing - GL error was recorded */ diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index 521b2d8eb..cc109cc52 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -1548,23 +1548,18 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, const GLint dstDepthNB = dstDepth - 2 * border; GLint img, row; GLint bytesPerSrcImage, bytesPerDstImage; - GLint bytesPerSrcRow, bytesPerDstRow; GLint srcImageOffset, srcRowOffset; (void) srcDepthNB; /* silence warnings */ - - bytesPerSrcImage = srcWidth * srcHeight * bpt; - bytesPerDstImage = dstWidth * dstHeight * bpt; - - bytesPerSrcRow = srcWidth * bpt; - bytesPerDstRow = dstWidth * bpt; + bytesPerSrcImage = srcRowStride * srcHeight * bpt; + bytesPerDstImage = dstRowStride * dstHeight * bpt; /* Offset between adjacent src images to be averaged together */ srcImageOffset = (srcDepth == dstDepth) ? 0 : 1; /* Offset between adjacent src rows to be averaged together */ - srcRowOffset = (srcHeight == dstHeight) ? 0 : srcWidth * bpt; + srcRowOffset = (srcHeight == dstHeight) ? 0 : srcRowStride; /* * Need to average together up to 8 src pixels for each dest pixel. @@ -1582,14 +1577,14 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, for (img = 0; img < dstDepthNB; img++) { /* first source image pointer, skipping border */ const GLubyte *imgSrcA = srcPtr[img * 2 + border] - + bytesPerSrcRow * border + bpt * border; + + srcRowStride * border + bpt * border; /* second source image pointer, skipping border */ const GLubyte *imgSrcB = srcPtr[img * 2 + srcImageOffset + border] - + bytesPerSrcRow * border + bpt * border; + + srcRowStride * border + bpt * border; /* address of the dest image, skipping border */ GLubyte *imgDst = dstPtr[img + border] - + bytesPerDstRow * border + bpt * border; + + dstRowStride * border + bpt * border; /* setup the four source row pointers and the dest row pointer */ const GLubyte *srcImgARowA = imgSrcA; @@ -1605,11 +1600,11 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, dstWidthNB, dstImgRow); /* advance to next rows */ - srcImgARowA += bytesPerSrcRow + srcRowOffset; - srcImgARowB += bytesPerSrcRow + srcRowOffset; - srcImgBRowA += bytesPerSrcRow + srcRowOffset; - srcImgBRowB += bytesPerSrcRow + srcRowOffset; - dstImgRow += bytesPerDstRow; + srcImgARowA += srcRowStride + srcRowOffset; + srcImgARowB += srcRowStride + srcRowOffset; + srcImgBRowA += srcRowStride + srcRowOffset; + srcImgBRowB += srcRowStride + srcRowOffset; + dstImgRow += dstRowStride; } } @@ -1638,8 +1633,8 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, memcpy(dst, src, bpt); /* do border along [img][row=dstHeight-1][col=0] */ - src = srcPtr[img * 2] + (srcHeight - 1) * bytesPerSrcRow; - dst = dstPtr[img] + (dstHeight - 1) * bytesPerDstRow; + src = srcPtr[img * 2] + (srcHeight - 1) * srcRowStride; + dst = dstPtr[img] + (dstHeight - 1) * dstRowStride; memcpy(dst, src, bpt); /* do border along [img][row=0][col=dstWidth-1] */ @@ -1668,10 +1663,10 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, /* do border along [img][row=dstHeight-1][col=0] */ srcA = srcPtr[img * 2 + 0] - + (srcHeight - 1) * bytesPerSrcRow; + + (srcHeight - 1) * srcRowStride; srcB = srcPtr[img * 2 + srcImageOffset] - + (srcHeight - 1) * bytesPerSrcRow; - dst = dstPtr[img] + (dstHeight - 1) * bytesPerDstRow; + + (srcHeight - 1) * srcRowStride; + dst = dstPtr[img] + (dstHeight - 1) * dstRowStride; do_row(datatype, comps, 1, srcA, srcB, 1, dst); /* do border along [img][row=0][col=dstWidth-1] */ @@ -1746,6 +1741,7 @@ _mesa_generate_mipmap_level(GLenum target, } break; case GL_TEXTURE_2D_ARRAY_EXT: + case GL_TEXTURE_CUBE_MAP_ARRAY: for (i = 0; i < dstDepth; i++) { make_2d_mipmap(datatype, comps, border, srcWidth, srcHeight, srcData[i], srcRowStride, @@ -1788,7 +1784,8 @@ _mesa_next_mipmap_level_size(GLenum target, GLint border, } if ((srcDepth - 2 * border > 1) && - (target != GL_TEXTURE_2D_ARRAY_EXT)) { + (target != GL_TEXTURE_2D_ARRAY_EXT && + target != GL_TEXTURE_CUBE_MAP_ARRAY)) { *dstDepth = (srcDepth - 2 * border) / 2 + 2 * border; } else { @@ -2029,7 +2026,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, /* only two types of compressed textures at this time */ assert(texObj->Target == GL_TEXTURE_2D || texObj->Target == GL_TEXTURE_2D_ARRAY || - texObj->Target == GL_TEXTURE_CUBE_MAP_ARB); + texObj->Target == GL_TEXTURE_CUBE_MAP_ARB || + texObj->Target == GL_TEXTURE_CUBE_MAP_ARRAY); /* * Choose a format for the temporary, uncompressed base image. diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 7c83d664f..c6d90c579 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -4212,6 +4212,12 @@ struct gl_context GLboolean FirstTimeCurrent; /*@}*/ + /** + * False if this context was created without a config. This is needed + * because the initial state of glDrawBuffers depends on this + */ + GLboolean HasConfig; + /** software compression/decompression supported or not */ GLboolean Mesa_DXTn; diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index a6c3581bf..57a766f99 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -160,6 +160,9 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: return GL_DEPTH_COMPONENT; + case GL_DEPTH_STENCIL: + case GL_DEPTH24_STENCIL8: + return GL_DEPTH_STENCIL; default: ; /* fallthrough */ } @@ -301,14 +304,6 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) } } - switch (internalFormat) { - case GL_DEPTH_STENCIL: - case GL_DEPTH24_STENCIL8: - return GL_DEPTH_STENCIL; - default: - ; /* fallthrough */ - } - if (ctx->Extensions.EXT_texture_sRGB) { switch (internalFormat) { case GL_SRGB_EXT: @@ -1662,7 +1657,10 @@ error_check_subtexture_dimensions(struct gl_context *ctx, /* check zoffset and depth */ if (dims > 2) { - GLint zBorder = (target == GL_TEXTURE_2D_ARRAY) ? 0 : destImage->Border; + GLint zBorder = (target == GL_TEXTURE_2D_ARRAY || + target == GL_TEXTURE_CUBE_MAP_ARRAY) ? + 0 : destImage->Border; + if (zoffset < -zBorder) { _mesa_error(ctx, GL_INVALID_VALUE, "%s3D(zoffset)", function); return GL_TRUE; -- cgit v1.2.3