gallium: fix mesa to tgsi translation for edgeflags
test apps (progs/trivial/tri-edgeflags and similar) seem to work now
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user