gallium: Centralize SSE usage logic.
This commit is contained in:
@@ -45,12 +45,6 @@ struct draw_context *draw_create( void )
|
|||||||
if (draw == NULL)
|
if (draw == NULL)
|
||||||
goto fail;
|
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[0], -1, 0, 0, 1 );
|
||||||
ASSIGN_4V( draw->plane[1], 1, 0, 0, 1 );
|
ASSIGN_4V( draw->plane[1], 1, 0, 0, 1 );
|
||||||
ASSIGN_4V( draw->plane[2], 0, -1, 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,
|
void draw_set_render( struct draw_context *draw,
|
||||||
struct vbuf_render *render )
|
struct vbuf_render *render )
|
||||||
{
|
{
|
||||||
|
@@ -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);
|
void draw_enable_point_sprites(struct draw_context *draw, boolean enable);
|
||||||
|
|
||||||
|
|
||||||
boolean draw_use_sse(struct draw_context *draw);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe);
|
draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe);
|
||||||
|
|
||||||
|
@@ -192,8 +192,6 @@ struct draw_context
|
|||||||
float plane[12][4];
|
float plane[12][4];
|
||||||
unsigned nr_planes;
|
unsigned nr_planes;
|
||||||
|
|
||||||
boolean use_sse;
|
|
||||||
|
|
||||||
/* If a prim stage introduces new vertex attributes, they'll be stored here
|
/* If a prim stage introduces new vertex attributes, they'll be stored here
|
||||||
*/
|
*/
|
||||||
struct {
|
struct {
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include "draw_private.h"
|
#include "draw_private.h"
|
||||||
#include "draw_context.h"
|
#include "draw_context.h"
|
||||||
|
|
||||||
|
#include "rtasm/rtasm_cpu.h"
|
||||||
#include "rtasm/rtasm_x86sse.h"
|
#include "rtasm/rtasm_x86sse.h"
|
||||||
#include "tgsi/exec/tgsi_sse2.h"
|
#include "tgsi/exec/tgsi_sse2.h"
|
||||||
#include "tgsi/util/tgsi_parse.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;
|
struct draw_sse_vertex_shader *vs;
|
||||||
uint nt = tgsi_num_tokens(templ->tokens);
|
uint nt = tgsi_num_tokens(templ->tokens);
|
||||||
|
|
||||||
if (!draw->use_sse)
|
if (!rtasm_cpu_has_sse2())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vs = CALLOC_STRUCT( draw_sse_vertex_shader );
|
vs = CALLOC_STRUCT( draw_sse_vertex_shader );
|
||||||
|
@@ -26,14 +26,20 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include "pipe/p_debug.h"
|
||||||
#include "rtasm_cpu.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)
|
int rtasm_cpu_has_sse(void)
|
||||||
{
|
{
|
||||||
/* FIXME: actually detect this at run-time */
|
/* FIXME: actually detect this at run-time */
|
||||||
#if defined(__i386__) || defined(__386__) || defined(i386)
|
#if defined(__i386__) || defined(__386__) || defined(i386)
|
||||||
return 1;
|
return rtasm_sse_enabled();
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -43,7 +49,7 @@ int rtasm_cpu_has_sse2(void)
|
|||||||
{
|
{
|
||||||
/* FIXME: actually detect this at run-time */
|
/* FIXME: actually detect this at run-time */
|
||||||
#if defined(__i386__) || defined(__386__) || defined(i386)
|
#if defined(__i386__) || defined(__386__) || defined(i386)
|
||||||
return 1;
|
return rtasm_sse_enabled();
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user