aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-28 14:07:02 +0200
committermarha <marha@users.sourceforge.net>2012-09-04 14:23:04 +0200
commit9dec848b23cf905ded387820f2893425cc00d545 (patch)
tree4933836d801d8569a31cd5689e5f8eceeb4f78ff /mesalib/src/gallium/auxiliary
parent9891a8cd45663a5431bbae63ccc41c6570a60d5b (diff)
downloadvcxsrv-9dec848b23cf905ded387820f2893425cc00d545.tar.gz
vcxsrv-9dec848b23cf905ded387820f2893425cc00d545.tar.bz2
vcxsrv-9dec848b23cf905ded387820f2893425cc00d545.zip
fontconfig mesa xserver git update 28 Aug 2012
Diffstat (limited to 'mesalib/src/gallium/auxiliary')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c46
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.h5
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_tile.c36
3 files changed, 87 insertions, 0 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);
}