diff options
author | Marek Olšák <[email protected]> | 2012-07-08 00:06:27 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-07-12 02:08:30 +0200 |
commit | bdaf0a085ba7b8af4cf858b31f701caf571b7c4f (patch) | |
tree | fa611f42f29bee87a8d411a83addedab4a4d10dd /src/gallium/auxiliary/util/u_simple_shaders.c | |
parent | 12fd81f9e7265076a3723b09bbb49e5868bde27e (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_simple_shaders.c')
-rw-r--r-- | src/gallium/auxiliary/util/u_simple_shaders.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index 545b6078667..3476b6ce0ca 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -265,6 +265,52 @@ util_make_fragment_tex_shader_writedepthstencil(struct pipe_context *pipe, /** + * Make a simple fragment texture shader which reads a texture and writes it + * as stencil. + */ +void * +util_make_fragment_tex_shader_writestencil(struct pipe_context *pipe, + unsigned tex_target, + unsigned interp_mode) +{ + struct ureg_program *ureg; + struct ureg_src stencil_sampler; + struct ureg_src tex; + struct ureg_dst out, stencil; + struct ureg_src imm; + + ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT ); + if (ureg == NULL) + return NULL; + + stencil_sampler = ureg_DECL_sampler( ureg, 0 ); + + tex = ureg_DECL_fs_input( ureg, + TGSI_SEMANTIC_GENERIC, 0, + interp_mode ); + + out = ureg_DECL_output( ureg, + TGSI_SEMANTIC_COLOR, + 0 ); + + stencil = ureg_DECL_output( ureg, + TGSI_SEMANTIC_STENCIL, + 0 ); + + imm = ureg_imm4f( ureg, 0, 0, 0, 1 ); + + ureg_MOV( ureg, out, imm ); + + ureg_TEX( ureg, + ureg_writemask(stencil, TGSI_WRITEMASK_Y), + tex_target, tex, stencil_sampler ); + ureg_END( ureg ); + + return ureg_create_shader_and_destroy( ureg, pipe ); +} + + +/** * Make simple fragment color pass-through shader. */ void * |