mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
gallium/util: fix glClear with MRT by making the FS write to all cbufs
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
parent
2cd1407d2d
commit
355d463f73
6 changed files with 42 additions and 9 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 *
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue