diff options
author | marha <marha@users.sourceforge.net> | 2012-04-20 17:07:15 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-04-20 17:07:15 +0200 |
commit | 0e3699334faf92f508b6c187a261548b656b0dd3 (patch) | |
tree | 28d7e84df7b54a3e6f85bf83e38efba937288fd3 /mesalib/src/mesa/main | |
parent | c1194ccd395fdbb23c9ab56bc340ee20a5feeb82 (diff) | |
download | vcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.tar.gz vcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.tar.bz2 vcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.zip |
fontconfig libX11 mesa pixman xserver git update 20 april 2012
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/attrib.c | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/main/context.c | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/main/ff_fragment_shader.cpp | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/readpix.c | 62 | ||||
-rw-r--r-- | mesalib/src/mesa/main/state.c | 22 | ||||
-rw-r--r-- | mesalib/src/mesa/main/varray.c | 2 |
7 files changed, 76 insertions, 22 deletions
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index 7042312a8..9b90b05f7 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -1448,9 +1448,6 @@ restore_array_attrib(struct gl_context *ctx, _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, src->ArrayObj->ElementArrayBufferObj->Name); - /* Better safe than sorry?! */ - dest->RebindArrays = GL_TRUE; - /* FIXME: Should some bits in ctx->Array->NewState also be set * FIXME: here? It seems like it should be set to inclusive-or * FIXME: of the old ArrayObj->_Enabled and the new _Enabled. diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 51b024143..d75351c85 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -1104,6 +1104,9 @@ _mesa_free_context_data( struct gl_context *ctx ) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, NULL); + _mesa_reference_array_object(ctx, &ctx->Array.DefaultArrayObj, NULL); + _mesa_free_attrib_data(ctx); _mesa_free_buffer_objects(ctx); _mesa_free_lighting_data( ctx ); @@ -1118,8 +1121,6 @@ _mesa_free_context_data( struct gl_context *ctx ) _mesa_free_varray_data(ctx); _mesa_free_transform_feedback(ctx); - _mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj); - #if FEATURE_ARB_pixel_buffer_object _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj, NULL); _mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj, NULL); diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 3c91b1a42..8a42281db 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -337,7 +337,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) } else if (!(vertexProgram || vertexShader)) { /* Fixed function vertex logic */ - /* _NEW_ARRAY */ + /* _NEW_VARYING_VP_INPUTS */ GLbitfield64 varying_inputs = ctx->varying_vp_inputs; /* These get generated in the setup routine regardless of the diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index bfa320a52..f277307a8 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -1632,7 +1632,6 @@ struct gl_array_attrib GLuint RestartIndex; GLbitfield64 NewState; /**< mask of VERT_BIT_* values */ - GLboolean RebindArrays; /**< whether the VBO module should rebind arrays */ /* GL_ARB_vertex_buffer_object */ struct gl_buffer_object *ArrayBufferObj; @@ -3063,6 +3062,7 @@ struct gl_matrix_stack #define _NEW_BUFFER_OBJECT (1 << 28) #define _NEW_FRAG_CLAMP (1 << 29) #define _NEW_TRANSFORM_FEEDBACK (1 << 30) /**< gl_context::TransformFeedback */ +#define _NEW_VARYING_VP_INPUTS (1 << 31) /**< gl_context::varying_vp_inputs */ #define _NEW_ALL ~0 /** diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 491854955..31acfcbf1 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -208,6 +208,11 @@ read_stencil_pixels( struct gl_context *ctx, ctx->Driver.UnmapRenderbuffer(ctx, rb); } + +/** + * Try to do glReadPixels of RGBA data using a simple memcpy or swizzle. + * \return GL_TRUE if successful, GL_FALSE otherwise (use the slow path) + */ static GLboolean fast_read_rgba_pixels_memcpy( struct gl_context *ctx, GLint x, GLint y, @@ -220,9 +225,23 @@ fast_read_rgba_pixels_memcpy( struct gl_context *ctx, struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; GLubyte *dst, *map; int dstStride, stride, j, texelBytes; - - if (!_mesa_format_matches_format_and_type(rb->Format, format, type, - ctx->Pack.SwapBytes)) + GLboolean swizzle_rb = GL_FALSE, copy_xrgb = GL_FALSE; + + /* XXX we could check for other swizzle/special cases here as needed */ + if (rb->Format == MESA_FORMAT_RGBA8888_REV && + format == GL_BGRA && + type == GL_UNSIGNED_INT_8_8_8_8_REV && + !ctx->Pack.SwapBytes) { + swizzle_rb = GL_TRUE; + } + else if (rb->Format == MESA_FORMAT_XRGB8888 && + format == GL_BGRA && + type == GL_UNSIGNED_INT_8_8_8_8_REV && + !ctx->Pack.SwapBytes) { + copy_xrgb = GL_TRUE; + } + else if (!_mesa_format_matches_format_and_type(rb->Format, format, type, + ctx->Pack.SwapBytes)) return GL_FALSE; /* If the format is unsigned normalized then we can ignore clamping @@ -247,10 +266,39 @@ fast_read_rgba_pixels_memcpy( struct gl_context *ctx, } texelBytes = _mesa_get_format_bytes(rb->Format); - for (j = 0; j < height; j++) { - memcpy(dst, map, width * texelBytes); - dst += dstStride; - map += stride; + + if (swizzle_rb) { + /* swap R/B */ + for (j = 0; j < height; j++) { + int i; + for (i = 0; i < width; i++) { + GLuint *dst4 = (GLuint *) dst, *map4 = (GLuint *) map; + GLuint pixel = map4[i]; + dst4[i] = (pixel & 0xff00ff00) + | ((pixel & 0x00ff0000) >> 16) + | ((pixel & 0x000000ff) << 16); + } + dst += dstStride; + map += stride; + } + } else if (copy_xrgb) { + /* convert xrgb -> argb */ + for (j = 0; j < height; j++) { + GLuint *dst4 = (GLuint *) dst, *map4 = (GLuint *) map; + int i; + for (i = 0; i < width; i++) { + dst4[i] = map4[i] | 0xff000000; /* set A=0xff */ + } + dst += dstStride; + map += stride; + } + } else { + /* just memcpy */ + for (j = 0; j < height; j++) { + memcpy(dst, map, width * texelBytes); + dst += dstStride; + map += stride; + } } ctx->Driver.UnmapRenderbuffer(ctx, rb); diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c index b01926622..f82e4a25e 100644 --- a/mesalib/src/mesa/main/state.c +++ b/mesalib/src/mesa/main/state.c @@ -473,12 +473,13 @@ _mesa_update_state_locked( struct gl_context *ctx ) /* Determine which state flags effect vertex/fragment program state */ if (ctx->FragmentProgram._MaintainTexEnvProgram) { prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG | - _NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE | - _NEW_PROGRAM | _NEW_FRAG_CLAMP | _NEW_COLOR); + _NEW_VARYING_VP_INPUTS | _NEW_LIGHT | _NEW_POINT | + _NEW_RENDERMODE | _NEW_PROGRAM | _NEW_FRAG_CLAMP | + _NEW_COLOR); } if (ctx->VertexProgram._MaintainTnlProgram) { - prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX | - _NEW_TRANSFORM | _NEW_POINT | + prog_flags |= (_NEW_VARYING_VP_INPUTS | _NEW_TEXTURE | + _NEW_TEXTURE_MATRIX | _NEW_TRANSFORM | _NEW_POINT | _NEW_FOG | _NEW_LIGHT | _MESA_NEW_NEED_EYE_COORDS); } @@ -580,8 +581,6 @@ _mesa_update_state_locked( struct gl_context *ctx ) ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); ctx->Array.NewState = 0; - if (!ctx->Array.RebindArrays) - ctx->Array.RebindArrays = (new_state & (_NEW_ARRAY | _NEW_PROGRAM)) != 0; } @@ -626,7 +625,16 @@ _mesa_set_varying_vp_inputs( struct gl_context *ctx, { if (ctx->varying_vp_inputs != varying_inputs) { ctx->varying_vp_inputs = varying_inputs; - ctx->NewState |= _NEW_ARRAY; + + /* Only the fixed-func generated programs need to use the flag + * and the fixed-func fragment program uses it only if there is also + * a fixed-func vertex program, so this only depends on the latter. + * + * It's okay to check the VP pointer here, because this is called after + * _mesa_update_state in the vbo module. */ + if (ctx->VertexProgram._TnlProgram) { + ctx->NewState |= _NEW_VARYING_VP_INPUTS; + } /*printf("%s %x\n", __FUNCTION__, varying_inputs);*/ } } diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index a402c7b22..1c1484323 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -1221,7 +1221,7 @@ _mesa_print_arrays(struct gl_context *ctx) void _mesa_init_varray(struct gl_context *ctx) { - ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0); + ctx->Array.DefaultArrayObj = ctx->Driver.NewArrayObject(ctx, 0); _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, ctx->Array.DefaultArrayObj); ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ |