diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/util/u_simple_shaders.c | 34 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_simple_shaders.h | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/renderer.c | 3 | ||||
-rw-r--r-- | src/gallium/tests/trivial/tri.c | 3 |
4 files changed, 37 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index 5f0134d7014..7e3666122bf 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -316,13 +316,39 @@ util_make_fragment_tex_shader_writestencil(struct pipe_context *pipe, /** - * Make simple fragment color pass-through shader. + * Make simple fragment color pass-through shader that replicates OUT[0] + * to all bound colorbuffers. */ void * -util_make_fragment_passthrough_shader(struct pipe_context *pipe) +util_make_fragment_passthrough_shader(struct pipe_context *pipe, + int input_semantic, + int input_interpolate) { - return util_make_fragment_cloneinput_shader(pipe, 1, TGSI_SEMANTIC_COLOR, - TGSI_INTERPOLATE_PERSPECTIVE); + static const char shader_templ[] = + "FRAG\n" + "PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1\n" + "DCL IN[0], %s[0], %s\n" + "DCL OUT[0], COLOR[0]\n" + + "MOV OUT[0], IN[0]\n" + "END\n"; + + char text[sizeof(shader_templ)+100]; + struct tgsi_token tokens[1000]; + struct pipe_shader_state state = {tokens}; + + sprintf(text, shader_templ, tgsi_semantic_names[input_semantic], + tgsi_interpolate_names[input_interpolate]); + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) { + assert(0); + return NULL; + } +#if 0 + tgsi_dump(state.tokens, 0); +#endif + + return pipe->create_fs_state(pipe, &state); } diff --git a/src/gallium/auxiliary/util/u_simple_shaders.h b/src/gallium/auxiliary/util/u_simple_shaders.h index e4ffde6521e..22b9cee4de6 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.h +++ b/src/gallium/auxiliary/util/u_simple_shaders.h @@ -87,7 +87,9 @@ util_make_fragment_tex_shader_writestencil(struct pipe_context *pipe, extern void * -util_make_fragment_passthrough_shader(struct pipe_context *pipe); +util_make_fragment_passthrough_shader(struct pipe_context *pipe, + int input_semantic, + int input_interpolate); extern void * diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c index 11d3b5a0779..61e31053234 100644 --- a/src/gallium/state_trackers/vega/renderer.c +++ b/src/gallium/state_trackers/vega/renderer.c @@ -308,7 +308,8 @@ static void renderer_set_fs(struct renderer *r, RendererFs id) switch (id) { case RENDERER_FS_COLOR: - fs = util_make_fragment_passthrough_shader(r->pipe); + fs = util_make_fragment_passthrough_shader(r->pipe, + TGSI_SEMANTIC_COLOR, TGSI_INTERPOLATE_PERSPECTIVE); break; case RENDERER_FS_TEXTURE: fs = util_make_fragment_tex_shader(r->pipe, diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c index ad88b869c8d..9acf2e1628a 100644 --- a/src/gallium/tests/trivial/tri.c +++ b/src/gallium/tests/trivial/tri.c @@ -216,7 +216,8 @@ static void init_prog(struct program *p) } /* fragment shader */ - p->fs = util_make_fragment_passthrough_shader(p->pipe); + p->fs = util_make_fragment_passthrough_shader(p->pipe, + TGSI_SEMANTIC_COLOR, TGSI_INTERPOLATE_PERSPECTIVE); } static void close_prog(struct program *p) |