diff options
author | Marius Predut <[email protected]> | 2015-02-25 09:49:45 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2015-02-25 16:35:49 -0700 |
commit | 1a93e7690dc90211164082d6a2d26d93da8127ef (patch) | |
tree | 85dea0aa989370fbd767eec2b243e37c8892b6b5 /src/mesa/vbo/vbo_context.h | |
parent | 47053464630888f819ef8cc44278f1a1220159b9 (diff) |
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 <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/vbo/vbo_context.h')
-rw-r--r-- | src/mesa/vbo/vbo_context.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index 8d22602b5f4..3b454be4422 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -56,6 +56,7 @@ #include "vbo_exec.h" #include "vbo_save.h" +#include "main/macros.h" struct vbo_context { struct gl_client_array currval[VBO_ATTRIB_MAX]; @@ -151,24 +152,23 @@ vbo_attrtype_to_integer_flag(GLenum format) } } - /** * Return default component values for the given format. - * The return type is an array of floats, because that's how we declare - * the vertex storage despite the fact we sometimes store integers in there. + * The return type is an array of fi_types, because that's how we declare + * the vertex storage : floats , integers or unsigned integers. */ -static inline const GLfloat * -vbo_get_default_vals_as_float(GLenum format) +static inline const fi_type * +vbo_get_default_vals_as_union(GLenum format) { static const GLfloat default_float[4] = { 0, 0, 0, 1 }; static const GLint default_int[4] = { 0, 0, 0, 1 }; switch (format) { case GL_FLOAT: - return default_float; + return (fi_type *)default_float; case GL_INT: case GL_UNSIGNED_INT: - return (const GLfloat*)default_int; + return (fi_type *)default_int; default: assert(0); return NULL; |