diff options
author | Roland Scheidegger <sroland@vmware.com> | 2009-12-18 15:54:28 +0100 |
---|---|---|
committer | Roland Scheidegger <sroland@vmware.com> | 2009-12-18 15:54:28 +0100 |
commit | 890809d71b6ab40c56d341a5dad9f5e6b06469d0 (patch) | |
tree | 8e6095478eadd9fc4b7fbe77437a0d673ab58b77 /src/mesa/state_tracker | |
parent | 50caff5675888c0063c73fa64b88129db7aa11dd (diff) |
gallium: fix mesa to tgsi translation for edgeflags
test apps (progs/trivial/tri-edgeflags and similar) seem to work now
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 15 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.h | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 28 |
3 files changed, 31 insertions, 15 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 72bd17bf41..7b334e21d2 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -718,6 +718,16 @@ emit_face_var( struct st_translate *t, t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]] = ureg_src(face_temp); } +static void +emit_edgeflags( struct st_translate *t, + const struct gl_program *program ) +{ + struct ureg_program *ureg = t->ureg; + struct ureg_dst edge_dst = t->outputs[t->outputMapping[VERT_RESULT_EDGE]]; + struct ureg_src edge_src = t->inputs[t->inputMapping[VERT_ATTRIB_EDGEFLAG]]; + + ureg_MOV( ureg, edge_dst, edge_src ); +} /** * Translate Mesa program to TGSI format. @@ -752,7 +762,8 @@ st_translate_mesa_program( GLuint numOutputs, const GLuint outputMapping[], const ubyte outputSemanticName[], - const ubyte outputSemanticIndex[] ) + const ubyte outputSemanticIndex[], + boolean passthrough_edgeflags ) { struct st_translate translate, *t; unsigned i; @@ -823,6 +834,8 @@ st_translate_mesa_program( outputSemanticName[i], outputSemanticIndex[i] ); } + if (passthrough_edgeflags) + emit_edgeflags( t, program ); } /* Declare address register. diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index 9dae373ede..e3c5bd1d94 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -54,7 +54,8 @@ st_translate_mesa_program( GLuint numOutputs, const GLuint outputMapping[], const ubyte outputSemanticName[], - const ubyte outputSemanticIndex[] ); + const ubyte outputSemanticIndex[], + boolean passthrough_edgeflags ); void st_free_tokens(const struct tgsi_token *tokens); diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 45ab8504ae..fcc04782de 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -185,6 +185,10 @@ st_prepare_vertex_program(struct st_context *st, } } } + /* similar hack to above, presetup potentially unused edgeflag output */ + stvp->result_to_output[VERT_RESULT_EDGE] = stvp->num_outputs; + stvp->output_semantic_name[stvp->num_outputs] = TGSI_SEMANTIC_EDGEFLAG; + stvp->output_semantic_index[stvp->num_outputs] = 0; } @@ -197,12 +201,18 @@ st_translate_vertex_program(struct st_context *st, struct pipe_context *pipe = st->pipe; struct ureg_program *ureg; enum pipe_error error; + unsigned num_outputs; ureg = ureg_create( TGSI_PROCESSOR_VERTEX ); if (ureg == NULL) return NULL; vpv->num_inputs = stvp->num_inputs; + num_outputs = stvp->num_outputs; + if (key->passthrough_edgeflags) { + vpv->num_inputs++; + num_outputs++; + } error = st_translate_mesa_program(st->ctx, @@ -210,29 +220,21 @@ st_translate_vertex_program(struct st_context *st, ureg, &stvp->Base.Base, /* inputs */ - stvp->num_inputs, + vpv->num_inputs, stvp->input_to_index, NULL, /* input semantic name */ NULL, /* input semantic index */ NULL, /* outputs */ - stvp->num_outputs, + num_outputs, stvp->result_to_output, stvp->output_semantic_name, - stvp->output_semantic_index ); + stvp->output_semantic_index, + key->passthrough_edgeflags ); if (error) goto fail; - /* Edgeflags will be the last input: - */ - if (key->passthrough_edgeflags) { - ureg_MOV( ureg, - ureg_DECL_output( ureg, TGSI_SEMANTIC_EDGEFLAG, 0 ), - ureg_DECL_vs_input( ureg, vpv->num_inputs )); - vpv->num_inputs++; - } - vpv->state.tokens = ureg_get_tokens( ureg, NULL ); ureg_destroy( ureg ); @@ -430,7 +432,7 @@ st_translate_fragment_program(struct st_context *st, fs_num_outputs, outputMapping, fs_output_semantic_name, - fs_output_semantic_index ); + fs_output_semantic_index, FALSE ); stfp->state.tokens = ureg_get_tokens( ureg, NULL ); ureg_destroy( ureg ); |