diff options
author | marha <marha@users.sourceforge.net> | 2012-02-27 07:24:18 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-02-27 07:24:18 +0100 |
commit | c4f44c07c6662d1ce08603945ccc4fa5afaa742a (patch) | |
tree | 5daa31bcbf8c90e74d99d679611a2d44f3ccede1 /mesalib/src/mesa/state_tracker | |
parent | 5fb4fb602bde5140dcea45464e3b70a49078ad2e (diff) | |
download | vcxsrv-c4f44c07c6662d1ce08603945ccc4fa5afaa742a.tar.gz vcxsrv-c4f44c07c6662d1ce08603945ccc4fa5afaa742a.tar.bz2 vcxsrv-c4f44c07c6662d1ce08603945ccc4fa5afaa742a.zip |
fontconfig pixman mesa git update 27 Feb 2012
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_drawpixels.c | 55 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_texture.c | 37 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_extensions.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 13 |
4 files changed, 66 insertions, 47 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index de4c189a8..18d0e53d4 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -824,9 +824,10 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, enum pipe_transfer_usage usage; struct pipe_transfer *pt; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0; - GLint skipPixels; ubyte *stmap; struct gl_pixelstore_attrib clippedUnpack = *unpack; + GLubyte *sValues; + GLuint *zValues; if (!zoom) { if (!_mesa_clip_drawpixels(ctx, &x, &y, &width, &height, @@ -862,22 +863,19 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, pixels = _mesa_map_pbo_source(ctx, &clippedUnpack, pixels); assert(pixels); - /* if width > MAX_WIDTH, have to process image in chunks */ - skipPixels = 0; - while (skipPixels < width) { - const GLint spanX = skipPixels; - const GLint spanWidth = MIN2(width - skipPixels, MAX_WIDTH); + sValues = (GLubyte *) malloc(width * sizeof(GLubyte)); + zValues = (GLuint *) malloc(width * sizeof(GLuint)); + + if (sValues && zValues) { GLint row; for (row = 0; row < height; row++) { - GLubyte sValues[MAX_WIDTH]; - GLuint zValues[MAX_WIDTH]; GLfloat *zValuesFloat = (GLfloat*)zValues; GLenum destType = GL_UNSIGNED_BYTE; const GLvoid *source = _mesa_image_address2d(&clippedUnpack, pixels, width, height, format, type, - row, skipPixels); - _mesa_unpack_stencil_span(ctx, spanWidth, destType, sValues, + row, 0); + _mesa_unpack_stencil_span(ctx, width, destType, sValues, type, source, &clippedUnpack, ctx->_ImageTransferState); @@ -886,7 +884,7 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, pt->resource->format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT ? GL_FLOAT : GL_UNSIGNED_INT; - _mesa_unpack_depth_span(ctx, spanWidth, ztype, zValues, + _mesa_unpack_depth_span(ctx, width, ztype, zValues, (1 << 24) - 1, type, source, &clippedUnpack); } @@ -910,63 +908,63 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, switch (pt->resource->format) { case PIPE_FORMAT_S8_UINT: { - ubyte *dest = stmap + spanY * pt->stride + spanX; + ubyte *dest = stmap + spanY * pt->stride; assert(usage == PIPE_TRANSFER_WRITE); - memcpy(dest, sValues, spanWidth); + memcpy(dest, sValues, width); } break; case PIPE_FORMAT_Z24_UNORM_S8_UINT: if (format == GL_DEPTH_STENCIL) { - uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); + uint *dest = (uint *) (stmap + spanY * pt->stride); GLint k; assert(usage == PIPE_TRANSFER_WRITE); - for (k = 0; k < spanWidth; k++) { + for (k = 0; k < width; k++) { dest[k] = zValues[k] | (sValues[k] << 24); } } else { - uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); + uint *dest = (uint *) (stmap + spanY * pt->stride); GLint k; assert(usage == PIPE_TRANSFER_READ_WRITE); - for (k = 0; k < spanWidth; k++) { + for (k = 0; k < width; k++) { dest[k] = (dest[k] & 0xffffff) | (sValues[k] << 24); } } break; case PIPE_FORMAT_S8_UINT_Z24_UNORM: if (format == GL_DEPTH_STENCIL) { - uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); + uint *dest = (uint *) (stmap + spanY * pt->stride); GLint k; assert(usage == PIPE_TRANSFER_WRITE); - for (k = 0; k < spanWidth; k++) { + for (k = 0; k < width; k++) { dest[k] = (zValues[k] << 8) | (sValues[k] & 0xff); } } else { - uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); + uint *dest = (uint *) (stmap + spanY * pt->stride); GLint k; assert(usage == PIPE_TRANSFER_READ_WRITE); - for (k = 0; k < spanWidth; k++) { + for (k = 0; k < width; k++) { dest[k] = (dest[k] & 0xffffff00) | (sValues[k] & 0xff); } } break; case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: if (format == GL_DEPTH_STENCIL) { - uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); + uint *dest = (uint *) (stmap + spanY * pt->stride); GLfloat *destf = (GLfloat*)dest; GLint k; assert(usage == PIPE_TRANSFER_WRITE); - for (k = 0; k < spanWidth; k++) { + for (k = 0; k < width; k++) { destf[k*2] = zValuesFloat[k]; dest[k*2+1] = sValues[k] & 0xff; } } else { - uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); + uint *dest = (uint *) (stmap + spanY * pt->stride); GLint k; assert(usage == PIPE_TRANSFER_READ_WRITE); - for (k = 0; k < spanWidth; k++) { + for (k = 0; k < width; k++) { dest[k*2+1] = sValues[k] & 0xff; } } @@ -976,8 +974,13 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, } } } - skipPixels += spanWidth; } + else { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels()"); + } + + free(sValues); + free(zValues); _mesa_unmap_pbo_source(ctx, &clippedUnpack); diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index d887455e6..ea59ccf25 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -684,9 +684,16 @@ decompress_with_blit(struct gl_context * ctx, /* format translation via floats */ GLuint row; enum pipe_format pformat = util_format_linear(dst_texture->format); + GLfloat *rgba; + + rgba = (GLfloat *) malloc(width * 4 * sizeof(GLfloat)); + if (!rgba) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()"); + goto end; + } + for (row = 0; row < height; row++) { const GLbitfield transferOps = 0x0; /* bypassed for glGetTexImage() */ - GLfloat rgba[4 * MAX_WIDTH]; GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width, height, format, type, row, 0); @@ -700,8 +707,11 @@ decompress_with_blit(struct gl_context * ctx, _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, type, dest, &ctx->Pack, transferOps); } + + free(rgba); } +end: _mesa_unmap_pbo_dest(ctx, &ctx->Pack); pipe->transfer_destroy(pipe, tex_xfer); @@ -763,8 +773,6 @@ fallback_copy_texsubimage(struct gl_context *ctx, if (ST_DEBUG & DEBUG_FALLBACK) debug_printf("%s: fallback processing\n", __FUNCTION__); - assert(width <= MAX_WIDTH); - if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { srcY = strb->Base.Height - srcY - height; } @@ -793,6 +801,7 @@ fallback_copy_texsubimage(struct gl_context *ctx, const GLboolean scaleOrBias = (ctx->Pixel.DepthScale != 1.0F || ctx->Pixel.DepthBias != 0.0F); GLint row, yStep; + uint *data; /* determine bottom-to-top vs. top-to-bottom order for src buffer */ if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { @@ -804,15 +813,23 @@ fallback_copy_texsubimage(struct gl_context *ctx, yStep = 1; } - /* To avoid a large temp memory allocation, do copy row by row */ - for (row = 0; row < height; row++, srcY += yStep) { - uint data[MAX_WIDTH]; - pipe_get_tile_z(pipe, src_trans, 0, srcY, width, 1, data); - if (scaleOrBias) { - _mesa_scale_and_bias_depth_uint(ctx, width, data); + data = (uint *) malloc(width * sizeof(uint)); + + if (data) { + /* To avoid a large temp memory allocation, do copy row by row */ + for (row = 0; row < height; row++, srcY += yStep) { + pipe_get_tile_z(pipe, src_trans, 0, srcY, width, 1, data); + if (scaleOrBias) { + _mesa_scale_and_bias_depth_uint(ctx, width, data); + } + pipe_put_tile_z(pipe, stImage->transfer, 0, row, width, 1, data); } - pipe_put_tile_z(pipe, stImage->transfer, 0, row, width, 1, data); } + else { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage()"); + } + + free(data); } else { /* RGBA format */ diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index fb36a6809..33bc6ed72 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -108,6 +108,14 @@ void st_init_limits(struct st_context *st) c->MaxTextureUnits = _min(c->MaxTextureImageUnits, c->MaxTextureCoordUnits); + /* Define max viewport size and max renderbuffer size in terms of + * max texture size (note: max tex RECT size = max tex 2D size). + * If this isn't true for some hardware we'll need new PIPE_CAP_ queries. + */ + c->MaxViewportWidth = + c->MaxViewportHeight = + c->MaxRenderbufferSize = c->MaxTextureRectSize; + c->MaxDrawBuffers = _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), 1, MAX_DRAW_BUFFERS); diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index f139e95fe..b0227855c 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4746,8 +4746,6 @@ get_mesa_program(struct gl_context *ctx, { glsl_to_tgsi_visitor* v = new glsl_to_tgsi_visitor(); struct gl_program *prog; - struct pipe_screen * screen = st_context(ctx)->pipe->screen; - unsigned pipe_shader_type; GLenum target; const char *target_string; bool progress; @@ -4758,17 +4756,14 @@ get_mesa_program(struct gl_context *ctx, case GL_VERTEX_SHADER: target = GL_VERTEX_PROGRAM_ARB; target_string = "vertex"; - pipe_shader_type = PIPE_SHADER_VERTEX; break; case GL_FRAGMENT_SHADER: target = GL_FRAGMENT_PROGRAM_ARB; target_string = "fragment"; - pipe_shader_type = PIPE_SHADER_FRAGMENT; break; case GL_GEOMETRY_SHADER: target = GL_GEOMETRY_PROGRAM_NV; target_string = "geometry"; - pipe_shader_type = PIPE_SHADER_GEOMETRY; break; default: assert(!"should not be reached"); @@ -4792,12 +4787,8 @@ get_mesa_program(struct gl_context *ctx, _mesa_generate_parameters_list_for_uniforms(shader_program, shader, prog->Parameters); - if (!screen->get_shader_param(screen, pipe_shader_type, - PIPE_SHADER_CAP_OUTPUT_READ)) { - /* Remove reads to output registers, and to varyings in vertex shaders. */ - lower_output_reads(shader->ir); - } - + /* Remove reads from output registers. */ + lower_output_reads(shader->ir); /* Emit intermediate IR for main(). */ visit_exec_list(shader->ir, v); |