summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichal <michal@michal-laptop.(none)>2007-10-27 14:01:39 +0100
committermichal <michal@michal-laptop.(none)>2007-10-27 19:01:12 +0100
commit31b4b261083e546998eba37178ac196049e4e501 (patch)
treecf6e2d5bb7b8176edffc57ccf1a3dd22ddf982eb
parent7362fe5d163a32cb8ba76de907ccf53dc69ff066 (diff)
Enable SSE2 for vertex shaders.
-rw-r--r--src/mesa/pipe/draw/draw_private.h2
-rw-r--r--src/mesa/pipe/draw/draw_vertex_shader.c22
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 44cf0b1c98a..ac47d2a76f6 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 d8bd5a96d66..a2e64b1e4c2 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);