gallium: Centralize SSE usage logic.

This commit is contained in:
José Fonseca
2008-04-21 13:02:59 +09:00
parent 29858e1b55
commit 40e0439db4
5 changed files with 10 additions and 19 deletions

View File

@@ -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 )
{

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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 );

View File

@@ -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