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_exec.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_exec.h')
-rw-r--r-- | src/mesa/vbo/vbo_exec.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index bb265def8ab..f17fe684cc3 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -38,6 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "vbo.h" #include "vbo_attrib.h" +#include "main/imports.h" /** * Max number of primitives (number of glBegin/End pairs) per VBO. @@ -71,7 +72,7 @@ struct vbo_exec_eval2_map { struct vbo_exec_copied_vtx { - GLfloat buffer[VBO_ATTRIB_MAX * 4 * VBO_MAX_COPIED_VERTS]; + fi_type buffer[VBO_ATTRIB_MAX * 4 * VBO_MAX_COPIED_VERTS]; GLuint nr; }; @@ -91,10 +92,10 @@ struct vbo_exec_context struct _mesa_prim prim[VBO_MAX_PRIM]; GLuint prim_count; - GLfloat *buffer_map; - GLfloat *buffer_ptr; /* cursor, points into buffer */ + fi_type *buffer_map; + fi_type *buffer_ptr; /* cursor, points into buffer */ GLuint buffer_used; /* in bytes */ - GLfloat vertex[VBO_ATTRIB_MAX*4]; /* current vertex */ + fi_type vertex[VBO_ATTRIB_MAX*4]; /* current vertex */ GLuint vert_count; GLuint max_vert; @@ -104,7 +105,7 @@ struct vbo_exec_context GLenum attrtype[VBO_ATTRIB_MAX]; GLubyte active_sz[VBO_ATTRIB_MAX]; - GLfloat *attrptr[VBO_ATTRIB_MAX]; + fi_type *attrptr[VBO_ATTRIB_MAX]; struct gl_client_array arrays[VERT_ATTRIB_MAX]; /* According to program mode, the values above plus current |