summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-04-11 15:02:21 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-04-11 15:02:21 -0600
commit7c2416f06e518bc1491fe13e145dcc9487d75449 (patch)
tree843ab9262691a74e2ae414b183e35b9febe70fff /src
parente3cf0cd6a9f3f072594e5712763b98ce7e579bcf (diff)
gallium: handle TGSI immediates in SSE code for vertex shaders
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_sse.c9
-rwxr-xr-xsrc/gallium/auxiliary/tgsi/exec/tgsi_sse2.c23
-rwxr-xr-xsrc/gallium/auxiliary/tgsi/exec/tgsi_sse2.h4
3 files changed, 28 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c
index f40d65df08..13394129bc 100644
--- a/src/gallium/auxiliary/draw/draw_vs_sse.c
+++ b/src/gallium/auxiliary/draw/draw_vs_sse.c
@@ -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 );
diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
index 748c53dbfc..e55fae6047 100755
--- a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
@@ -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:
diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h
index fde06047fe..d1190727d0 100755
--- a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h
@@ -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(