From 1a93e7690dc90211164082d6a2d26d93da8127ef Mon Sep 17 00:00:00 2001 From: Marius Predut Date: Wed, 25 Feb 2015 09:49:45 -0700 Subject: mesa: use fi_type in vertex attribute code For 32-bit builds, floating point operations use x86 FPU registers, not SSE registers. If we're actually storing an integer in a float variable, the value might get modified when written to memory. This patch changes the VBO code to use the fi_type (float/int union) to store/copy vertex attributes. Also, this can improve performance on x86 because moving floats with integer registers instead of FP registers is faster. Neil Roberts review: - include changes on all places that are storing attribute values. - check with and without -O3 compiler flag. Brian Paul review: - use fi_type type instead gl_constant_value type - fix a bunch of nit-picks. - fix compiler warnings Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668 Signed-off-by: Marius Predut Reviewed-by: Brian Paul --- src/mesa/main/context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/context.c') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 43acc9d283d..d6c13680f24 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -134,6 +134,7 @@ #include "math/m_matrix.h" #include "main/dispatch.h" /* for _gloffset_COUNT */ #include "uniforms.h" +#include "macros.h" #ifdef USE_SPARC_ASM #include "sparc/sparc.h" @@ -656,7 +657,7 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) consts->MaxSamples = 0; /* GLSL default if NativeIntegers == FALSE */ - consts->UniformBooleanTrue = FLT_AS_UINT(1.0f); + consts->UniformBooleanTrue = FLOAT_AS_UNION(1.0f).u; /* GL_ARB_sync */ consts->MaxServerWaitTimeout = 0x1fff7fffffffULL; -- cgit v1.2.3