From 15a500d3edb03668b43cc6898fafcda024d0f006 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 29 Feb 2012 13:34:55 +0100 Subject: xserver fontconfig mesa pixman git update 29 Feb 2012 --- mesalib/src/mesa/main/readpix.c | 22 +++++++++++++++------- mesalib/src/mesa/main/teximage.c | 4 +--- mesalib/src/mesa/state_tracker/st_draw.c | 9 ++++++--- mesalib/src/mesa/vbo/vbo.h | 18 ++++++++++++++++-- mesalib/src/mesa/vbo/vbo_exec_array.c | 16 ---------------- 5 files changed, 38 insertions(+), 31 deletions(-) (limited to 'mesalib/src/mesa') diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 0f429ab22..3384d8a38 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -225,6 +225,16 @@ fast_read_rgba_pixels_memcpy( struct gl_context *ctx, ctx->Pack.SwapBytes)) return GL_FALSE; + /* If the format is unsigned normalized then we can ignore clamping + * because the values are already in the range [0,1] so it won't + * have any effect anyway. + */ + if (_mesa_get_format_datatype(rb->Format) == GL_UNSIGNED_NORMALIZED) + transferOps &= ~IMAGE_CLAMP_BIT; + + if (transferOps) + return GL_FALSE; + dstStride = _mesa_image_row_stride(packing, width, format, type); dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, format, type, 0, 0); @@ -320,13 +330,11 @@ read_rgba_pixels( struct gl_context *ctx, transferOps |= IMAGE_CLAMP_BIT; } - if (!transferOps) { - /* Try the optimized paths first. */ - if (fast_read_rgba_pixels_memcpy(ctx, x, y, width, height, - format, type, pixels, packing, - transferOps)) { - return; - } + /* Try the optimized paths first. */ + if (fast_read_rgba_pixels_memcpy(ctx, x, y, width, height, + format, type, pixels, packing, + transferOps)) { + return; } slow_read_rgba_pixels(ctx, x, y, width, height, diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 9b6c6c896..5328ae296 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -69,8 +69,6 @@ * * This is the format which is used during texture application (i.e. the * texture format and env mode determine the arithmetic used. - * - * XXX this could be static */ GLint _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) @@ -830,7 +828,7 @@ _mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level) struct gl_texture_image *texImage; GLuint texIndex; - if (level < 0 ) + if (level < 0) return NULL; switch (target) { diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c index c0554cfc7..c4b2caccd 100644 --- a/mesalib/src/mesa/state_tracker/st_draw.c +++ b/mesalib/src/mesa/state_tracker/st_draw.c @@ -905,6 +905,7 @@ st_validate_varrays(struct gl_context *ctx, unsigned num_vbuffers, num_velements; GLuint attr; unsigned i; + unsigned old_num_user_attribs; /* must get these after state validation! */ vp = st->vp; @@ -913,9 +914,7 @@ st_validate_varrays(struct gl_context *ctx, memset(velements, 0, sizeof(struct pipe_vertex_element) * vpv->num_inputs); /* Unreference any user vertex buffers. */ - for (i = 0; i < st->num_user_attribs; i++) { - pipe_resource_reference(&st->user_attrib[i].buffer, NULL); - } + old_num_user_attribs = st->num_user_attribs; st->num_user_attribs = 0; /* @@ -954,6 +953,10 @@ st_validate_varrays(struct gl_context *ctx, assert(!vbuffer[attr].buffer); } + for (i = old_num_user_attribs; i < st->num_user_attribs; i++) { + pipe_resource_reference(&st->user_attrib[i].buffer, NULL); + } + return GL_TRUE; } diff --git a/mesalib/src/mesa/vbo/vbo.h b/mesalib/src/mesa/vbo/vbo.h index bf925ab16..2d01d9823 100644 --- a/mesalib/src/mesa/vbo/vbo.h +++ b/mesalib/src/mesa/vbo/vbo.h @@ -123,8 +123,22 @@ void vbo_rebase_prims( struct gl_context *ctx, GLuint max_index, vbo_draw_func draw ); -int -vbo_sizeof_ib_type(GLenum type); +static inline int +vbo_sizeof_ib_type(GLenum type) +{ + switch (type) { + case GL_UNSIGNED_INT: + return sizeof(GLuint); + case GL_UNSIGNED_SHORT: + return sizeof(GLushort); + case GL_UNSIGNED_BYTE: + return sizeof(GLubyte); + default: + assert(!"unsupported index data type"); + /* In case assert is turned off */ + return 0; + } +} void vbo_get_minmax_indices(struct gl_context *ctx, const struct _mesa_prim *prim, diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index 06e36a677..b0a4261e7 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -75,22 +75,6 @@ vbo_check_buffers_are_unmapped(struct gl_context *ctx) assert(!_mesa_bufferobj_mapped(exec->vtx.bufferobj)); } -int -vbo_sizeof_ib_type(GLenum type) -{ - switch (type) { - case GL_UNSIGNED_INT: - return sizeof(GLuint); - case GL_UNSIGNED_SHORT: - return sizeof(GLushort); - case GL_UNSIGNED_BYTE: - return sizeof(GLubyte); - default: - assert(!"unsupported index data type"); - /* In case assert is turned off */ - return 0; - } -} /** -- cgit v1.2.3