summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2008-04-21 13:02:59 +0900
committerJosé Fonseca <[email protected]>2008-04-21 13:02:59 +0900
commit40e0439db448a7d93ddb18faac7f14b47b1343c0 (patch)
treeb3f67744af49cc93bd01d1ad23f45c3deaa1d0d2 /src/gallium
parent29858e1b553cee1fd7e3380ea62c69d2a6b91b95 (diff)
gallium: Centralize SSE usage logic.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c12
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_sse.c3
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_cpu.c10
5 files changed, 10 insertions, 19 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 4988d67faa1..b4dbdccd610 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -45,12 +45,6 @@ struct draw_context *draw_create( void )
if (draw == NULL)
goto fail;
-#if defined(__i386__) || defined(__386__)
- draw->use_sse = GETENV( "GALLIUM_NOSSE" ) == NULL;
-#else
- draw->use_sse = FALSE;
-#endif
-
ASSIGN_4V( draw->plane[0], -1, 0, 0, 1 );
ASSIGN_4V( draw->plane[1], 1, 0, 0, 1 );
ASSIGN_4V( draw->plane[2], 0, -1, 0, 1 );
@@ -320,12 +314,6 @@ draw_num_vs_outputs(struct draw_context *draw)
-boolean draw_use_sse(struct draw_context *draw)
-{
- return (boolean) draw->use_sse;
-}
-
-
void draw_set_render( struct draw_context *draw,
struct vbuf_render *render )
{
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index a0ac980c89f..68e2efb8655 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -73,8 +73,6 @@ void draw_enable_line_stipple(struct draw_context *draw, boolean enable);
void draw_enable_point_sprites(struct draw_context *draw, boolean enable);
-boolean draw_use_sse(struct draw_context *draw);
-
void
draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe);
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 27f61c2f40f..da973e868b8 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -192,8 +192,6 @@ struct draw_context
float plane[12][4];
unsigned nr_planes;
- boolean use_sse;
-
/* If a prim stage introduces new vertex attributes, they'll be stored here
*/
struct {
diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c
index 8e2d381f147..b1e9f671147 100644
--- a/src/gallium/auxiliary/draw/draw_vs_sse.c
+++ b/src/gallium/auxiliary/draw/draw_vs_sse.c
@@ -41,6 +41,7 @@
#include "draw_private.h"
#include "draw_context.h"
+#include "rtasm/rtasm_cpu.h"
#include "rtasm/rtasm_x86sse.h"
#include "tgsi/exec/tgsi_sse2.h"
#include "tgsi/util/tgsi_parse.h"
@@ -155,7 +156,7 @@ draw_create_vs_sse(struct draw_context *draw,
struct draw_sse_vertex_shader *vs;
uint nt = tgsi_num_tokens(templ->tokens);
- if (!draw->use_sse)
+ if (!rtasm_cpu_has_sse2())
return NULL;
vs = CALLOC_STRUCT( draw_sse_vertex_shader );
diff --git a/src/gallium/auxiliary/rtasm/rtasm_cpu.c b/src/gallium/auxiliary/rtasm/rtasm_cpu.c
index d577ff5b42f..175245a9f6b 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_cpu.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_cpu.c
@@ -26,14 +26,20 @@
**************************************************************************/
+#include "pipe/p_debug.h"
#include "rtasm_cpu.h"
+static boolean rtasm_sse_enabled(void)
+{
+ return !debug_get_bool_option("GALLIUM_NOSSE", FALSE);
+}
+
int rtasm_cpu_has_sse(void)
{
/* FIXME: actually detect this at run-time */
#if defined(__i386__) || defined(__386__) || defined(i386)
- return 1;
+ return rtasm_sse_enabled();
#else
return 0;
#endif
@@ -43,7 +49,7 @@ int rtasm_cpu_has_sse2(void)
{
/* FIXME: actually detect this at run-time */
#if defined(__i386__) || defined(__386__) || defined(i386)
- return 1;
+ return rtasm_sse_enabled();
#else
return 0;
#endif