summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_blitter.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-07-08 00:06:27 +0200
committerMarek Olšák <[email protected]>2012-07-12 02:08:30 +0200
commitbdaf0a085ba7b8af4cf858b31f701caf571b7c4f (patch)
treefa611f42f29bee87a8d411a83addedab4a4d10dd /src/gallium/auxiliary/util/u_blitter.c
parent12fd81f9e7265076a3723b09bbb49e5868bde27e (diff)
gallium/u_blitter: accelerate stencil-only copying
This doesn't seem to be used by anything yet, but better safe than sorry. Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_blitter.c')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index b422ff8faed..590a6aad817 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -79,6 +79,7 @@ struct blitter_context_priv
where the index is PIPE_TEXTURE_* to be sampled. */
void *fs_texfetch_depth[PIPE_MAX_TEXTURE_TYPES];
void *fs_texfetch_depthstencil[PIPE_MAX_TEXTURE_TYPES];
+ void *fs_texfetch_stencil[PIPE_MAX_TEXTURE_TYPES];
/* Blend state. */
void *blend_write_color; /**< blend state with writemask of RGBA */
@@ -322,6 +323,8 @@ void util_blitter_destroy(struct blitter_context *blitter)
pipe->delete_fs_state(pipe, ctx->fs_texfetch_depth[i]);
if (ctx->fs_texfetch_depthstencil[i])
pipe->delete_fs_state(pipe, ctx->fs_texfetch_depthstencil[i]);
+ if (ctx->fs_texfetch_stencil[i])
+ pipe->delete_fs_state(pipe, ctx->fs_texfetch_stencil[i]);
}
for (i = 0; i <= PIPE_MAX_COLOR_BUFS; i++) {
@@ -746,6 +749,26 @@ void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx,
return ctx->fs_texfetch_depthstencil[tex_target];
}
+static INLINE
+void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
+ unsigned tex_target)
+{
+ struct pipe_context *pipe = ctx->base.pipe;
+
+ assert(tex_target < PIPE_MAX_TEXTURE_TYPES);
+
+ /* Create the fragment shader on-demand. */
+ if (!ctx->fs_texfetch_stencil[tex_target]) {
+ unsigned tgsi_tex = pipe_tex_to_tgsi_tex(tex_target);
+
+ ctx->fs_texfetch_stencil[tex_target] =
+ util_make_fragment_tex_shader_writestencil(pipe, tgsi_tex,
+ TGSI_INTERPOLATE_LINEAR);
+ }
+
+ return ctx->fs_texfetch_stencil[tex_target];
+}
+
static void blitter_set_common_draw_rect_state(struct blitter_context_priv *ctx)
{
struct pipe_context *pipe = ctx->base.pipe;
@@ -1056,7 +1079,10 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter,
pipe->bind_fs_state(pipe,
blitter_get_fs_texfetch_depth(ctx, src_target));
} else { /* is_stencil */
- assert(0);
+ pipe->bind_depth_stencil_alpha_state(pipe,
+ ctx->dsa_keep_depth_write_stencil);
+ pipe->bind_fs_state(pipe,
+ blitter_get_fs_texfetch_stencil(ctx, src_target));
}
fb_state.nr_cbufs = 0;