aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-09-14 11:11:28 +0200
committermarha <marha@users.sourceforge.net>2012-09-14 11:11:28 +0200
commitc0212d660fe99ea5e4a1b897670f7f7c111553c7 (patch)
tree12c04842a73bb885640f1e23ef9a3ca654d09c5a /mesalib/src
parentf61137c5cf42ded5eeb85eaf007ae11f0811e022 (diff)
parentb08ba56019b146786e1cde553c036dd0c4fd02e5 (diff)
downloadvcxsrv-c0212d660fe99ea5e4a1b897670f7f7c111553c7.tar.gz
vcxsrv-c0212d660fe99ea5e4a1b897670f7f7c111553c7.tar.bz2
vcxsrv-c0212d660fe99ea5e4a1b897670f7f7c111553c7.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c15
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp19
-rw-r--r--mesalib/src/glsl/link_uniforms.cpp5
-rw-r--r--mesalib/src/mapi/glapi/gen/glX_proto_send.py4
-rw-r--r--mesalib/src/mesa/main/extensions.c11
-rw-r--r--mesalib/src/mesa/main/fbobject.c4
-rw-r--r--mesalib/src/mesa/main/get.c59
-rw-r--r--mesalib/src/mesa/main/imports.h22
-rw-r--r--mesalib/src/mesa/main/teximage.c12
-rw-r--r--mesalib/src/mesa/main/teximage.h2
-rw-r--r--mesalib/src/mesa/main/texstorage.c126
-rw-r--r--mesalib/src/mesa/main/version.h4
12 files changed, 198 insertions, 85 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 44295c136..35b8edba7 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -1213,6 +1213,21 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter,
pipe->bind_fragment_sampler_states(pipe, 2, samplers);
pipe_sampler_view_reference(&views[1], NULL);
+ } else if (blit_stencil) {
+ /* Set a stencil-only sampler view for it not to sample depth instead. */
+ struct pipe_sampler_view templ;
+ struct pipe_sampler_view *view;
+
+ templ = *src;
+ templ.format = util_format_stencil_only(templ.format);
+ assert(templ.format != PIPE_FORMAT_NONE);
+
+ view = pipe->create_sampler_view(pipe, src->texture, &templ);
+
+ pipe->set_fragment_sampler_views(pipe, 1, &view);
+ pipe->bind_fragment_sampler_states(pipe, 1, &ctx->sampler_state);
+
+ pipe_sampler_view_reference(&view, NULL);
} else {
pipe->set_fragment_sampler_views(pipe, 1, &src);
pipe->bind_fragment_sampler_states(pipe, 1, &ctx->sampler_state);
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 02fe66b60..5157661b3 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -2086,9 +2086,24 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
} else {
var->location = qual->location;
}
+
if (qual->flags.q.explicit_index) {
- var->explicit_index = true;
- var->index = qual->index;
+ /* From the GLSL 4.30 specification, section 4.4.2 (Output
+ * Layout Qualifiers):
+ *
+ * "It is also a compile-time error if a fragment shader
+ * sets a layout index to less than 0 or greater than 1."
+ *
+ * Older specifications don't mandate a behavior; we take
+ * this as a clarification and always generate the error.
+ */
+ if (qual->index < 0 || qual->index > 1) {
+ _mesa_glsl_error(loc, state,
+ "explicit index may only be 0 or 1\n");
+ } else {
+ var->explicit_index = true;
+ var->index = qual->index;
+ }
}
}
} else if (qual->flags.q.explicit_index) {
diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp
index 5d701e75e..118bfae68 100644
--- a/mesalib/src/glsl/link_uniforms.cpp
+++ b/mesalib/src/glsl/link_uniforms.cpp
@@ -572,8 +572,11 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
/* FINISHME: Update code to process built-in uniforms!
*/
- if (strncmp("gl_", var->name, 3) == 0)
+ if (strncmp("gl_", var->name, 3) == 0) {
+ uniform_size.num_shader_uniform_components +=
+ var->type->component_slots();
continue;
+ }
uniform_size.process(var);
}
diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_send.py b/mesalib/src/mapi/glapi/gen/glX_proto_send.py
index d42f661ea..34aa2c31f 100644
--- a/mesalib/src/mapi/glapi/gen/glX_proto_send.py
+++ b/mesalib/src/mapi/glapi/gen/glX_proto_send.py
@@ -423,9 +423,9 @@ __indirect_get_proc_address(const char *name)
print ''
print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)'
print ' if (gc->isDirect) {'
- print ' const _glapi_proc *const table = GET_DISPATCH();'
+ print ' const _glapi_proc *const disp_table = GET_DISPATCH();'
print ' PFNGL%sPROC p =' % (name.upper())
- print ' (PFNGL%sPROC) table[%d];' % (name.upper(), func.offset)
+ print ' (PFNGL%sPROC) disp_table[%d];' % (name.upper(), func.offset)
print ' %sp(%s);' % (ret_string, func.get_called_parameter_string())
print ' } else'
print '#endif'
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))