diff options
Diffstat (limited to 'src/gallium/auxiliary/util/u_simple_shaders.c')
-rw-r--r-- | src/gallium/auxiliary/util/u_simple_shaders.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index 019dda767d..5b682f496c 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -87,10 +87,15 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe, * MOV OUT[0], IMM[0] // (if writemask != 0xf) * TEX OUT[0].writemask, IN[0], SAMP[0], 2D; * END; + * + * \param tex_target one of PIPE_TEXTURE_x + * \parma interp_mode either TGSI_INTERPOLATE_LINEAR or PERSPECTIVE + * \param writemask mask of TGSI_WRITEMASK_x */ void * util_make_fragment_tex_shader_writemask(struct pipe_context *pipe, unsigned tex_target, + unsigned interp_mode, unsigned writemask ) { struct ureg_program *ureg; @@ -98,6 +103,9 @@ util_make_fragment_tex_shader_writemask(struct pipe_context *pipe, struct ureg_src tex; struct ureg_dst out; + assert(interp_mode == TGSI_INTERPOLATE_LINEAR || + interp_mode == TGSI_INTERPOLATE_PERSPECTIVE); + ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT ); if (ureg == NULL) return NULL; @@ -106,7 +114,7 @@ util_make_fragment_tex_shader_writemask(struct pipe_context *pipe, tex = ureg_DECL_fs_input( ureg, TGSI_SEMANTIC_GENERIC, 0, - TGSI_INTERPOLATE_PERSPECTIVE ); + interp_mode ); out = ureg_DECL_output( ureg, TGSI_SEMANTIC_COLOR, @@ -133,10 +141,12 @@ util_make_fragment_tex_shader_writemask(struct pipe_context *pipe, * \param tex_target one of PIPE_TEXTURE_x */ void * -util_make_fragment_tex_shader(struct pipe_context *pipe, unsigned tex_target ) +util_make_fragment_tex_shader(struct pipe_context *pipe, unsigned tex_target, + unsigned interp_mode) { return util_make_fragment_tex_shader_writemask( pipe, tex_target, + interp_mode, TGSI_WRITEMASK_XYZW ); } @@ -147,7 +157,8 @@ util_make_fragment_tex_shader(struct pipe_context *pipe, unsigned tex_target ) */ void * util_make_fragment_tex_shader_writedepth(struct pipe_context *pipe, - unsigned tex_target) + unsigned tex_target, + unsigned interp_mode) { struct ureg_program *ureg; struct ureg_src sampler; @@ -163,7 +174,7 @@ util_make_fragment_tex_shader_writedepth(struct pipe_context *pipe, tex = ureg_DECL_fs_input( ureg, TGSI_SEMANTIC_GENERIC, 0, - TGSI_INTERPOLATE_PERSPECTIVE ); + interp_mode ); out = ureg_DECL_output( ureg, TGSI_SEMANTIC_COLOR, |