diff options
author | marha <marha@users.sourceforge.net> | 2012-09-14 11:09:08 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-09-14 11:09:08 +0200 |
commit | b08ba56019b146786e1cde553c036dd0c4fd02e5 (patch) | |
tree | 651ada0a32bd95a5c80838f11d31205c8d3e8807 /mesalib/src/mesa/main | |
parent | aa10a08696cae93799fcddae3f0245ceee905e01 (diff) | |
download | vcxsrv-b08ba56019b146786e1cde553c036dd0c4fd02e5.tar.gz vcxsrv-b08ba56019b146786e1cde553c036dd0c4fd02e5.tar.bz2 vcxsrv-b08ba56019b146786e1cde553c036dd0c4fd02e5.zip |
fontconfig libX11 mesa xkeyboard-config git update 14 sep 2012
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/extensions.c | 11 | ||||
-rw-r--r-- | mesalib/src/mesa/main/fbobject.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/main/get.c | 59 | ||||
-rw-r--r-- | mesalib/src/mesa/main/imports.h | 22 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 12 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texstorage.c | 126 | ||||
-rw-r--r-- | mesalib/src/mesa/main/version.h | 4 |
8 files changed, 160 insertions, 80 deletions
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 36e1fcf62..e6f4541f0 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -927,7 +927,7 @@ _mesa_get_extension_count(struct gl_context *ctx) base = (GLboolean *) &ctx->Extensions; for (i = extension_table; i->name != 0; ++i) { - if (base[i->offset]) { + if (base[i->offset] && (i->api_set & (1 << ctx->API))) { ctx->Extensions.Count++; } } @@ -947,10 +947,11 @@ _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index) base = (GLboolean*) &ctx->Extensions; n = 0; for (i = extension_table; i->name != 0; ++i) { - if (n == index && base[i->offset]) { - return (const GLubyte*) i->name; - } else if (base[i->offset]) { - ++n; + if (base[i->offset] & (i->api_set & (1 << ctx->API))) { + if (n == index) + return (const GLubyte*) i->name; + else + ++n; } } diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 59a5ec32d..abc9d83a6 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -2979,8 +2979,8 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, /* extra checks for multisample copies... */ if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) { /* src and dest region sizes must be the same */ - if (srcX1 - srcX0 != dstX1 - dstX0 || - srcY1 - srcY0 != dstY1 - dstY0) { + if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) || + abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT(bad src/dst multisample region sizes)"); return; diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 24d2a18fe..6800cc353 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -789,6 +789,15 @@ static const struct value_desc values[] = { #endif /* FEATURE_GL || FEATURE_ES2 */ +#if FEATURE_ES1 || FEATURE_ES2 + { 0, 0, TYPE_API_MASK, API_OPENGLES | API_OPENGLES2_BIT, NO_EXTRA }, + /* GL_OES_EGL_image_external */ + { GL_TEXTURE_BINDING_EXTERNAL_OES, LOC_CUSTOM, + TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external }, + { GL_TEXTURE_EXTERNAL_OES, LOC_CUSTOM, + TYPE_BOOLEAN, 0, extra_OES_EGL_image_external }, +#endif + #if FEATURE_ES2 /* Enums unique to OpenGL ES 2.0 */ { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA }, @@ -801,12 +810,6 @@ static const struct value_desc values[] = { { GL_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA }, #endif /* FEATURE_ES2 */ - /* GL_OES_EGL_image_external */ - { GL_TEXTURE_BINDING_EXTERNAL_OES, LOC_CUSTOM, - TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external }, - { GL_TEXTURE_EXTERNAL_OES, LOC_CUSTOM, - TYPE_BOOLEAN, 0, extra_OES_EGL_image_external }, - #if FEATURE_GL /* Remaining enums are only in OpenGL */ { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGL_CORE_BIT, NO_EXTRA }, @@ -1398,29 +1401,29 @@ print_table_stats(void) for (i = 0; i < Elements(table); i++) { if (!table[i]) - continue; + continue; count++; d = &values[table[i]]; hash = (d->pname * prime_factor); j = 0; while (1) { - if (values[table[hash & mask]].pname == d->pname) - break; - hash += prime_step; - j++; + if (values[table[hash & mask]].pname == d->pname) + break; + hash += prime_step; + j++; } if (j < 10) - collisions[j]++; + collisions[j]++; else - collisions[10]++; + collisions[10]++; } printf("number of enums: %d (total %d)\n", count, Elements(values)); for (i = 0; i < Elements(collisions) - 1; i++) if (collisions[i] > 0) - printf(" %d enums with %d %scollisions\n", - collisions[i], i, i == 10 ? "or more " : ""); + printf(" %d enums with %d %scollisions\n", + collisions[i], i, i == 10 ? "or more " : ""); } #endif @@ -1442,20 +1445,20 @@ void _mesa_init_get_hash(struct gl_context *ctx) for (i = 0; i < Elements(values); i++) { if (values[i].type == TYPE_API_MASK) { - api_mask = values[i].offset; - continue; + api_mask = values[i].offset; + continue; } if (!(api_mask & api_bit)) - continue; + continue; hash = (values[i].pname * prime_factor) & mask; while (1) { - index = hash & mask; - if (!table[index]) { - table[index] = i; - break; - } - hash += prime_step; + index = hash & mask; + if (!table[index]) { + table[index] = i; + break; + } + hash += prime_step; } } @@ -1992,13 +1995,13 @@ find_value(const char *func, GLenum pname, void **p, union value *v) /* If the enum isn't valid, the hash walk ends with index 0, * which is the API mask entry at the beginning of values[]. */ if (unlikely(d->type == TYPE_API_MASK)) { - _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func, - _mesa_lookup_enum_by_nr(pname)); - return &error_value; + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func, + _mesa_lookup_enum_by_nr(pname)); + return &error_value; } if (likely(d->pname == pname)) - break; + break; hash += prime_step; } diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index abf216c99..81da51047 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -520,6 +520,28 @@ extern unsigned int _mesa_bitcount_64(uint64_t n); #endif +/** + * Find the last (most significant) bit set in a word. + * + * Essentially ffs() in the reverse direction. + */ +static inline unsigned int +_mesa_fls(unsigned int n) +{ +#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) + return n == 0 ? 0 : 32 - __builtin_clz(n); +#else + unsigned int v = 1; + + if (n == 0) + return 0; + + while (n >>= 1) + v++; + + return v; +#endif +} extern GLhalfARB _mesa_float_to_half(float f); diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 3cf74f295..02bd87ac6 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -660,8 +660,8 @@ _mesa_is_proxy_texture(GLenum target) /** * Return the proxy target which corresponds to the given texture target */ -static GLenum -get_proxy_target(GLenum target) +GLenum +_mesa_get_proxy_target(GLenum target) { switch (target) { case GL_TEXTURE_1D: @@ -692,7 +692,7 @@ get_proxy_target(GLenum target) case GL_PROXY_TEXTURE_2D_ARRAY_EXT: return GL_PROXY_TEXTURE_2D_ARRAY_EXT; default: - _mesa_problem(NULL, "unexpected target in get_proxy_target()"); + _mesa_problem(NULL, "unexpected target in _mesa_get_proxy_target()"); return 0; } } @@ -1703,7 +1703,7 @@ texture_error_check( struct gl_context *ctx, GLint width, GLint height, GLint depth, GLint border ) { - const GLenum proxyTarget = get_proxy_target(target); + const GLenum proxyTarget = _mesa_get_proxy_target(target); const GLboolean isProxy = target == proxyTarget; GLboolean sizeOK = GL_TRUE; GLboolean colorFormat; @@ -1933,7 +1933,7 @@ compressed_texture_error_check(struct gl_context *ctx, GLint dimensions, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize) { - const GLenum proxyTarget = get_proxy_target(target); + const GLenum proxyTarget = _mesa_get_proxy_target(target); const GLint maxLevels = _mesa_max_texture_levels(ctx, target); GLint expectedSize; GLenum choose_format; @@ -2308,7 +2308,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border ) { - const GLenum proxyTarget = get_proxy_target(target); + const GLenum proxyTarget = _mesa_get_proxy_target(target); const GLenum type = GL_FLOAT; GLboolean sizeOK; GLint baseFormat; diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h index feaaf0cba..36fd1c2bc 100644 --- a/mesalib/src/mesa/main/teximage.h +++ b/mesalib/src/mesa/main/teximage.h @@ -66,6 +66,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ); extern GLboolean _mesa_is_proxy_texture(GLenum target); +extern GLenum +_mesa_get_proxy_target(GLenum target); extern struct gl_texture_image * _mesa_new_texture_image( struct gl_context *ctx ); diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c index f8af8bf01..f8a939794 100644 --- a/mesalib/src/mesa/main/texstorage.c +++ b/mesalib/src/mesa/main/texstorage.c @@ -192,9 +192,10 @@ setup_texstorage(struct gl_context *ctx, return; } - } - texObj->Immutable = GL_TRUE; + /* Only set this field for non-proxy texture objects */ + texObj->Immutable = GL_TRUE; + } } @@ -242,25 +243,68 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { - const GLboolean isProxy = _mesa_is_proxy_texture(target); struct gl_texture_object *texObj; GLuint maxDim; + GLboolean legalFormat; + + /* check internal format - note that only sized formats are allowed */ + switch (internalformat) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_INTENSITY: + case GL_RED: + case GL_RG: + case GL_RGB: + case GL_RGBA: + case GL_BGRA: + case GL_DEPTH_COMPONENT: + case GL_DEPTH_STENCIL: + case GL_COMPRESSED_ALPHA: + case GL_COMPRESSED_LUMINANCE_ALPHA: + case GL_COMPRESSED_LUMINANCE: + case GL_COMPRESSED_INTENSITY: + case GL_COMPRESSED_RGB: + case GL_COMPRESSED_RGBA: + case GL_COMPRESSED_SRGB: + case GL_COMPRESSED_SRGB_ALPHA: + case GL_COMPRESSED_SLUMINANCE: + case GL_COMPRESSED_SLUMINANCE_ALPHA: + case GL_RED_INTEGER: + case GL_GREEN_INTEGER: + case GL_BLUE_INTEGER: + case GL_ALPHA_INTEGER: + case GL_RGB_INTEGER: + case GL_RGBA_INTEGER: + case GL_BGR_INTEGER: + case GL_BGRA_INTEGER: + case GL_LUMINANCE_INTEGER_EXT: + case GL_LUMINANCE_ALPHA_INTEGER_EXT: + /* these unsized formats are illegal */ + legalFormat = GL_FALSE; + break; + default: + legalFormat = _mesa_base_tex_format(ctx, internalformat) > 0; + } + + if (!legalFormat) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexStorage%uD(internalformat = %s)", dims, + _mesa_lookup_enum_by_nr(internalformat)); + return GL_TRUE; + } /* size check */ if (width < 1 || height < 1 || depth < 1) { - if (!isProxy) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glTexStorage%uD(width, height or depth < 1)", dims); - } + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexStorage%uD(width, height or depth < 1)", dims); return GL_TRUE; } /* levels check */ if (levels < 1 || height < 1 || depth < 1) { - if (!isProxy) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexStorage%uD(levels < 1)", - dims); - } + _mesa_error(ctx, GL_INVALID_VALUE, "glTexStorage%uD(levels < 1)", + dims); return GL_TRUE; } @@ -274,40 +318,32 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target, /* check levels against maximum */ if (levels > _mesa_max_texture_levels(ctx, target)) { - if (!isProxy) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexStorage%uD(levels too large)", dims); - } + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexStorage%uD(levels too large)", dims); return GL_TRUE; } /* check levels against width/height/depth */ maxDim = MAX3(width, height, depth); if (levels > _mesa_logbase2(maxDim) + 1) { - if (!isProxy) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexStorage%uD(too many levels for max texture dimension)", - dims); - } + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexStorage%uD(too many levels for max texture dimension)", + dims); return GL_TRUE; } /* non-default texture object check */ texObj = _mesa_get_current_tex_object(ctx, target); - if (!texObj || (texObj->Name == 0 && !isProxy)) { - if (!isProxy) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexStorage%uD(texture object 0)", dims); - } + if (!texObj || (texObj->Name == 0)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexStorage%uD(texture object 0)", dims); return GL_TRUE; } /* Check if texObj->Immutable is set */ if (texObj->Immutable) { - if (!isProxy) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexStorage%uD(immutable)", - dims); - } + _mesa_error(ctx, GL_INVALID_OPERATION, "glTexStorage%uD(immutable)", + dims); return GL_TRUE; } @@ -323,22 +359,38 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { struct gl_texture_object *texObj; - GLboolean error; + GLboolean sizeOK; + GLenum proxyTarget = _mesa_get_proxy_target(target); GET_CURRENT_CONTEXT(ctx); texObj = _mesa_get_current_tex_object(ctx, target); - error = tex_storage_error_check(ctx, dims, target, levels, - internalformat, width, height, depth); - if (!error) { + if (tex_storage_error_check(ctx, dims, target, levels, + internalformat, width, height, depth)) { + return; /* error was recorded */ + } + + sizeOK = ctx->Driver.TestProxyTexImage(ctx, proxyTarget, 0, + internalformat, GL_NONE, GL_NONE, + width, height, depth, 0); + + if (!sizeOK) { + if (_mesa_is_proxy_texture(texObj->Target)) { + /* clear all image fields for [levels] */ + clear_image_fields(ctx, dims, texObj); + } + else { + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexStorage%uD(invalid width, height or depth)", + dims); + return; + } + } + else { setup_texstorage(ctx, texObj, dims, levels, internalformat, width, height, depth); } - else if (_mesa_is_proxy_texture(target)) { - /* clear all image fields for [levels] */ - clear_image_fields(ctx, dims, texObj); - } } diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h index 5b2e85afd..f0ba6f267 100644 --- a/mesalib/src/mesa/main/version.h +++ b/mesalib/src/mesa/main/version.h @@ -33,9 +33,9 @@ struct gl_context; /* Mesa version */ #define MESA_MAJOR 9 -#define MESA_MINOR 0 +#define MESA_MINOR 1 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "9.0-devel" +#define MESA_VERSION_STRING "9.1-devel" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |