diff options
-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 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_shader.c | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 4 |
6 files changed, 42 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index 5f0134d..7e36661 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 e4ffde6..22b9cee 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 11d3b5a..61e3105 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 ad88b86..9acf2e1 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) diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 45e7a11..c1d7c80 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -59,7 +59,8 @@ get_passthrough_fs(struct st_context *st) { if (!st->passthrough_fs) { st->passthrough_fs = - util_make_fragment_passthrough_shader(st->pipe); + util_make_fragment_passthrough_shader(st->pipe, TGSI_SEMANTIC_COLOR, + TGSI_INTERPOLATE_PERSPECTIVE); } return st->passthrough_fs; diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 5cf4c07..aabea63 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -96,7 +96,9 @@ static INLINE void set_fragment_shader(struct st_context *st) { if (!st->clear.fs) - st->clear.fs = util_make_fragment_passthrough_shader(st->pipe); + st->clear.fs = + util_make_fragment_passthrough_shader(st->pipe, TGSI_SEMANTIC_COLOR, + TGSI_INTERPOLATE_CONSTANT); cso_set_fragment_shader_handle(st->cso_context, st->clear.fs); } |