diff options
-rw-r--r-- | src/mesa/pipe/draw/draw_context.c | 11 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_context.h | 1 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_private.h | 2 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex_shader.c | 9 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 11 |
5 files changed, 26 insertions, 8 deletions
diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c index 5efb173228..3fb667ab1a 100644 --- a/src/mesa/pipe/draw/draw_context.c +++ b/src/mesa/pipe/draw/draw_context.c @@ -41,6 +41,12 @@ struct draw_context *draw_create( void ) { struct draw_context *draw = CALLOC_STRUCT( draw_context ); +#if defined(__i386__) || defined(__386__) + draw->use_sse = getenv("GALLIUM_SSE") != NULL; +#else + draw->use_sse = false; +#endif + /* create pipeline stages */ draw->pipeline.unfilled = draw_unfilled_stage( draw ); draw->pipeline.twoside = draw_twoside_stage( draw ); @@ -244,4 +250,9 @@ void draw_free_tmps( struct draw_stage *stage ) } } +boolean draw_use_sse(struct draw_context *draw) +{ + return draw->use_sse; +} + diff --git a/src/mesa/pipe/draw/draw_context.h b/src/mesa/pipe/draw/draw_context.h index 398e96d94d..8e2232244c 100644 --- a/src/mesa/pipe/draw/draw_context.h +++ b/src/mesa/pipe/draw/draw_context.h @@ -99,6 +99,7 @@ void draw_bind_vertex_shader(struct draw_context *draw, void draw_delete_vertex_shader(struct draw_context *draw, void *vcso); +boolean draw_use_sse(struct draw_context *draw); void draw_set_vertex_buffer(struct draw_context *draw, diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index 2f52299f74..12a970a671 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -220,6 +220,8 @@ struct draw_context struct prim_header queue[PRIM_QUEUE_LENGTH]; unsigned queue_nr; } pq; + + int use_sse : 1; }; diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c index f7ddbd1909..3518bd52a3 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader.c +++ b/src/mesa/pipe/draw/draw_vertex_shader.c @@ -220,10 +220,11 @@ draw_create_vertex_shader(struct draw_context *draw, #if defined(__i386__) || defined(__386__) x86_init_func(&vs->sse2_program); - tgsi_emit_sse2(shader->tokens, &vs->sse2_program); - - ((struct pipe_shader_state*)(vs->state))->executable = - x86_get_func(&vs->sse2_program); + if (draw->use_sse) { + tgsi_emit_sse2(shader->tokens, &vs->sse2_program); + ((struct pipe_shader_state*)(vs->state))->executable = + x86_get_func(&vs->sse2_program); + } #endif return vs; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 116b59a067..a41b953a21 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -36,6 +36,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" +#include "pipe/draw/draw_context.h" #include "pipe/tgsi/mesa/mesa_to_tgsi.h" #include "pipe/tgsi/exec/tgsi_core.h" @@ -391,11 +392,13 @@ st_translate_fragment_program(struct st_context *st, tgsi_dump( tokensOut, 0/*TGSI_DUMP_VERBOSE*/ ); #if defined(__i386__) || defined(__386__) - if (stfp->sse2_program.csr == stfp->sse2_program.store) - tgsi_emit_sse2_fs( tokensOut, &stfp->sse2_program ); + if (draw_use_sse(st->draw)) { + if (stfp->sse2_program.csr == stfp->sse2_program.store) + tgsi_emit_sse2_fs( tokensOut, &stfp->sse2_program ); - if (!cso->state.executable) - ((struct cso_fragment_shader*)cso)->state.executable = (void *) x86_get_func( &stfp->sse2_program ); + if (!cso->state.executable) + ((struct cso_fragment_shader*)cso)->state.executable = (void *) x86_get_func( &stfp->sse2_program ); + } #endif return cso; |