diff options
author | marha <marha@users.sourceforge.net> | 2012-08-28 14:07:02 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-08-28 14:07:02 +0200 |
commit | 05d67ae9117e5157fd1a5175dde6d7e48caf4653 (patch) | |
tree | 601c92c99a901b165664df7482c7baf538d4d7c5 /mesalib/src | |
parent | b3462c12542a69eeaa3fe90fddfbb15d30c18158 (diff) | |
download | vcxsrv-05d67ae9117e5157fd1a5175dde6d7e48caf4653.tar.gz vcxsrv-05d67ae9117e5157fd1a5175dde6d7e48caf4653.tar.bz2 vcxsrv-05d67ae9117e5157fd1a5175dde6d7e48caf4653.zip |
fontconfig mesa xserver git update 28 Aug 2012
Diffstat (limited to 'mesalib/src')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_blitter.c | 46 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_blitter.h | 5 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_tile.c | 36 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/glX_proto_send.py | 35 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_texture.c | 10 |
5 files changed, 122 insertions, 10 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index a95e1b535..ad4ccd9eb 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -1515,6 +1515,7 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter, pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil); pipe->bind_vertex_elements_state(pipe, ctx->velem_state); pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1, FALSE)); + pipe->set_sample_mask(pipe, (1ull << MAX2(1, src->nr_samples)) - 1); memset(&surf_tmpl, 0, sizeof(surf_tmpl)); surf_tmpl.format = dst->format; @@ -1552,3 +1553,48 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter, pipe_surface_reference(&srcsurf, NULL); pipe_surface_reference(&dstsurf, NULL); } + +void util_blitter_custom_color(struct blitter_context *blitter, + struct pipe_surface *dstsurf, + void *custom_blend) +{ + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; + struct pipe_context *pipe = ctx->base.pipe; + struct pipe_framebuffer_state fb_state; + + assert(dstsurf->texture); + if (!dstsurf->texture) + return; + + /* check the saved state */ + blitter_set_running_flag(ctx); + blitter_check_saved_vertex_states(ctx); + blitter_check_saved_fragment_states(ctx); + blitter_check_saved_fb_state(ctx); + + /* bind states */ + pipe->bind_blend_state(pipe, custom_blend); + pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil); + pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1, FALSE)); + pipe->bind_vertex_elements_state(pipe, ctx->velem_state); + pipe->set_sample_mask(pipe, (1ull << MAX2(1, dstsurf->texture->nr_samples)) - 1); + + /* set a framebuffer state */ + fb_state.width = dstsurf->width; + fb_state.height = dstsurf->height; + fb_state.nr_cbufs = 1; + fb_state.cbufs[0] = dstsurf; + fb_state.zsbuf = 0; + pipe->set_framebuffer_state(pipe, &fb_state); + pipe->set_sample_mask(pipe, ~0); + + blitter_set_common_draw_rect_state(ctx); + blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height); + blitter->draw_rectangle(blitter, 0, 0, dstsurf->width, dstsurf->height, + 0, 0, NULL); + + blitter_restore_vertex_states(ctx); + blitter_restore_fragment_states(ctx); + blitter_restore_fb_state(ctx); + blitter_unset_running_flag(ctx); +} diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h index f227902c1..e06e8b12d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.h +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h @@ -308,6 +308,11 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter, unsigned sample_mask, void *dsa_stage, float depth); +/* Used by r600g for color decompression. */ +void util_blitter_custom_color(struct blitter_context *blitter, + struct pipe_surface *dstsurf, + void *custom_blend); + /* Used by r600g for MSAA color resolve. */ void util_blitter_custom_resolve_color(struct blitter_context *blitter, struct pipe_resource *dst, diff --git a/mesalib/src/gallium/auxiliary/util/u_tile.c b/mesalib/src/gallium/auxiliary/util/u_tile.c index ea4b91f95..48e73c40b 100644 --- a/mesalib/src/gallium/auxiliary/util/u_tile.c +++ b/mesalib/src/gallium/auxiliary/util/u_tile.c @@ -679,6 +679,28 @@ pipe_get_tile_z(struct pipe_context *pipe, } } break; + case PIPE_FORMAT_Z32_FLOAT: + { + const float *ptrc = (const float *)(map + y * pt->stride + x*4); + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + /* convert float Z to 32-bit Z */ + if (ptrc[j] <= 0.0) { + pDest[j] = 0; + } + else if (ptrc[j] >= 1.0) { + pDest[j] = 0xffffffff; + } + else { + double z = ptrc[j] * 0xffffffff; + pDest[j] = (uint) z; + } + } + pDest += dstStride; + ptrc += pt->stride/4; + } + } + break; default: assert(0); } @@ -786,6 +808,20 @@ pipe_put_tile_z(struct pipe_context *pipe, } } break; + case PIPE_FORMAT_Z32_FLOAT: + { + float *pDest = (float *) (map + y * pt->stride + x*2); + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + /* convert 32-bit integer Z to float Z */ + const double scale = 1.0 / 0xffffffffU; + pDest[j] = ptrc[j] * scale; + } + pDest += pt->stride/4; + ptrc += srcStride; + } + } + break; default: assert(0); } diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_send.py b/mesalib/src/mapi/glapi/gen/glX_proto_send.py index ca3a79056..c53359240 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_send.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_send.py @@ -681,16 +681,31 @@ generic_%u_byte( GLint rop, const void * ptr ) if f.needs_reply(): print ' %s_reply_t *reply = %s_reply(c, %s, NULL);' % (xcb_name, xcb_name, xcb_request) - if output and f.reply_always_array: - print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) - - elif output and not f.reply_always_array: - if not output.is_image(): - print ' if (%s_data_length(reply) == 0)' % (xcb_name) - print ' (void)memcpy(%s, &reply->datum, sizeof(reply->datum));' % (output.name) - print ' else' - print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) - + if output: + if output.is_image(): + [dim, w, h, d, junk] = output.get_dimensions() + if f.dimensions_in_reply: + w = "reply->width" + h = "reply->height" + d = "reply->depth" + if dim < 2: + h = "1" + else: + print ' if (%s == 0) { %s = 1; }' % (h, h) + if dim < 3: + d = "1" + else: + print ' if (%s == 0) { %s = 1; }' % (d, d) + + print ' __glEmptyImage(gc, 3, %s, %s, %s, %s, %s, %s_data(reply), %s);' % (w, h, d, output.img_format, output.img_type, xcb_name, output.name) + else: + if f.reply_always_array: + print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) + else: + print ' if (%s_data_length(reply) == 0)' % (xcb_name) + print ' (void)memcpy(%s, &reply->datum, sizeof(reply->datum));' % (output.name) + print ' else' + print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) if f.return_type != 'void': print ' retval = reply->ret_val;' diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index 3de96adf3..ed3bbc725 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -989,6 +989,16 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, goto fallback; } + if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) { + /* 1D arrays might be thought of as 2D images but the actual layout + * might not be that way. At some points, we convert OpenGL's 1D + * array 'height' into gallium 'layers' and that prevents the blit + * utility code from doing the right thing. Simpy use the memcpy-based + * fallback. + */ + goto fallback; + } + if (matching_base_formats && src_format == dest_format && !do_flip) { |