gallium: handle TGSI immediates in SSE code for vertex shaders

This commit is contained in:
Brian Paul 2008-04-11 15:02:21 -06:00
parent e3cf0cd6a9
commit 7c2416f06e
3 changed files with 28 additions and 8 deletions

View file

@ -50,13 +50,15 @@ typedef void (XSTDCALL *codegen_function) (
const struct tgsi_exec_vector *input,
struct tgsi_exec_vector *output,
float (*constant)[4],
struct tgsi_exec_vector *temporary );
struct tgsi_exec_vector *temporary,
float (*immediates)[4] );
struct draw_sse_vertex_shader {
struct draw_vertex_shader base;
struct x86_function sse2_program;
codegen_function func;
float immediates[TGSI_EXEC_NUM_IMMEDIATES][4];
};
@ -149,7 +151,8 @@ vs_sse_run( struct draw_vertex_shader *base,
shader->func(machine->Inputs,
machine->Outputs,
machine->Consts,
machine->Temps );
machine->Temps,
shader->immediates);
}
@ -243,7 +246,7 @@ draw_create_vs_sse(struct draw_context *draw,
x86_init_func( &vs->sse2_program );
if (!tgsi_emit_sse2( (struct tgsi_token *) vs->base.state.tokens,
&vs->sse2_program ))
&vs->sse2_program, vs->immediates ))
goto fail;
vs->func = (codegen_function) x86_get_func( &vs->sse2_program );

View file

@ -2316,10 +2316,12 @@ emit_declaration(
unsigned
tgsi_emit_sse2(
struct tgsi_token *tokens,
struct x86_function *func )
struct x86_function *func,
float (*immediates)[4] )
{
struct tgsi_parse_context parse;
unsigned ok = 1;
uint num_immediates = 0;
DUMP_START();
@ -2341,6 +2343,10 @@ tgsi_emit_sse2(
func,
get_temp_base(),
get_argument( 3 ) );
emit_mov(
func,
get_immediate_base(),
get_argument( 4 ) );
tgsi_parse_init( &parse, tokens );
@ -2363,9 +2369,18 @@ tgsi_emit_sse2(
break;
case TGSI_TOKEN_TYPE_IMMEDIATE:
/* XXX implement this */
ok = 0;
debug_printf("failed to emit immediate value to SSE\n");
/* simply copy the immediate values into the next immediates[] slot */
{
const uint size = parse.FullToken.FullImmediate.Immediate.Size - 1;
uint i;
assert(size <= 4);
assert(num_immediates < TGSI_EXEC_NUM_IMMEDIATES);
for( i = 0; i < size; i++ ) {
immediates[num_immediates][i] =
parse.FullToken.FullImmediate.u.ImmediateFloat32[i].Float;
}
num_immediates++;
}
break;
default:

View file

@ -11,7 +11,9 @@ struct x86_function;
unsigned
tgsi_emit_sse2(
struct tgsi_token *tokens,
struct x86_function *function );
struct x86_function *function,
float (*immediates)[4]
);
unsigned
tgsi_emit_sse2_fs(