From 31b4b261083e546998eba37178ac196049e4e501 Mon Sep 17 00:00:00 2001 From: michal Date: Sat, 27 Oct 2007 14:01:39 +0100 Subject: [PATCH] Enable SSE2 for vertex shaders. --- src/mesa/pipe/draw/draw_private.h | 2 ++ src/mesa/pipe/draw/draw_vertex_shader.c | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index 44cf0b1..ac47d2a 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -124,7 +124,9 @@ struct draw_stage */ struct draw_vertex_shader { const struct pipe_shader_state *state; +#if defined(__i386__) || defined(__386__) struct x86_function sse2_program; +#endif }; /** diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c index d8bd5a9..a2e64b1 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader.c +++ b/src/mesa/pipe/draw/draw_vertex_shader.c @@ -100,20 +100,20 @@ run_vertex_program(struct draw_context *draw, draw_vertex_fetch( draw, machine, elts, count ); /* run shader */ - if( draw->vertex_shader->state->executable != NULL ) { +#if defined(__i386__) || defined(__386__) + { /* SSE */ - codegen_function func = (codegen_function) draw->vertex_shader->state->executable; + codegen_function func = (codegen_function) x86_get_func( &draw->vertex_shader->sse2_program ); func( machine->Inputs, machine->Outputs, machine->Consts, machine->Temps ); } - else { - /* interpreter */ - tgsi_exec_machine_run( machine ); - } - +#else + /* interpreter */ + tgsi_exec_machine_run( machine ); +#endif /* store machine results */ for (j = 0; j < count; j++) { @@ -225,11 +225,9 @@ draw_create_vertex_shader(struct draw_context *draw, /* cast-away const */ struct pipe_shader_state *sh = (struct pipe_shader_state *) shader; - x86_init_func( &sh->sse2_program ); - - tgsi_emit_sse2( sh->tokens, &sh->sse2_program ); + x86_init_func( &vs->sse2_program ); - sh->executable = x86_get_func( &sh->sse2_program ); + tgsi_emit_sse2( sh->tokens, &vs->sse2_program ); } #endif @@ -255,7 +253,7 @@ void draw_delete_vertex_shader(struct draw_context *draw, struct draw_vertex_shader *vs = (struct draw_vertex_shader*)(vcso); #if defined(__i386__) || defined(__386__) - x86_release_func((struct x86_function *) &vs->state->sse2_program); + x86_release_func((struct x86_function *) &vs->sse2_program); #endif free((void *) vs->state); -- 2.7.4