summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_exec_draw.c
diff options
context:
space:
mode:
authorMarius Predut <marius.predut@intel.com>2015-02-25 09:49:45 -0700
committerBrian Paul <brianp@vmware.com>2015-02-25 16:35:49 -0700
commit1a93e7690dc90211164082d6a2d26d93da8127ef (patch)
tree85dea0aa989370fbd767eec2b243e37c8892b6b5 /src/mesa/vbo/vbo_exec_draw.c
parent47053464630888f819ef8cc44278f1a1220159b9 (diff)
downloadexternal_mesa3d-1a93e7690dc90211164082d6a2d26d93da8127ef.zip
external_mesa3d-1a93e7690dc90211164082d6a2d26d93da8127ef.tar.gz
external_mesa3d-1a93e7690dc90211164082d6a2d26d93da8127ef.tar.bz2
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 <marius.predut@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/vbo/vbo_exec_draw.c')
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 6d43514..ec44fdb 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -73,8 +73,8 @@ vbo_copy_vertices( struct vbo_exec_context *exec )
GLuint nr = exec->vtx.prim[exec->vtx.prim_count-1].count;
GLuint ovf, i;
GLuint sz = exec->vtx.vertex_size;
- GLfloat *dst = exec->vtx.copied.buffer;
- const GLfloat *src = (exec->vtx.buffer_map +
+ fi_type *dst = exec->vtx.copied.buffer;
+ const fi_type *src = (exec->vtx.buffer_map +
exec->vtx.prim[exec->vtx.prim_count-1].start *
exec->vtx.vertex_size);
@@ -309,7 +309,7 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec )
/* The VBO exists and there's room for more */
if (exec->vtx.bufferobj->Size > 0) {
exec->vtx.buffer_map =
- (GLfloat *)ctx->Driver.MapBufferRange(ctx,
+ (fi_type *)ctx->Driver.MapBufferRange(ctx,
exec->vtx.buffer_used,
(VBO_VERT_BUFFER_SIZE -
exec->vtx.buffer_used),
@@ -336,7 +336,7 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec )
exec->vtx.bufferobj)) {
/* buffer allocation worked, now map the buffer */
exec->vtx.buffer_map =
- (GLfloat *)ctx->Driver.MapBufferRange(ctx,
+ (fi_type *)ctx->Driver.MapBufferRange(ctx,
0, VBO_VERT_BUFFER_SIZE,
accessRange,
exec->vtx.bufferobj,