summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_loopback.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2016-01-05 13:03:04 -0700
committerBrian Paul <brianp@vmware.com>2016-01-05 13:03:04 -0700
commitf04d7439a0ad6e13ff2912ff824553b6bcf511a4 (patch)
tree60b2e7da243918d1e2cc582a68f0743b4ededa33 /src/mesa/main/api_loopback.c
parenteec8d7e7e059c19b86cce0360cb7db28aef1f1dd (diff)
downloadexternal_mesa3d-f04d7439a0ad6e13ff2912ff824553b6bcf511a4.zip
external_mesa3d-f04d7439a0ad6e13ff2912ff824553b6bcf511a4.tar.gz
external_mesa3d-f04d7439a0ad6e13ff2912ff824553b6bcf511a4.tar.bz2
mesa: check for z=0 in _mesa_Vertex3dv()
It's very rare that a GL app calls glVertex3dv(), but one in particular calls it lot, always with Z = 0. Check for that condition and convert the call into glVertex2f. This reduces VBO memory used and reduces the number of times we have to switch between float[2] and float[3] vertex formats in the svga driver. This results in a small but measurable performance improvement. Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Diffstat (limited to 'src/mesa/main/api_loopback.c')
-rw-r--r--src/mesa/main/api_loopback.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index a7fd82c..8b63d9c 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -629,7 +629,10 @@ _mesa_Vertex2sv( const GLshort *v )
void GLAPIENTRY
_mesa_Vertex3dv( const GLdouble *v )
{
- VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+ if (v[2] == 0.0)
+ VERTEX2( (GLfloat) v[0], (GLfloat) v[1] );
+ else
+ VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
}
void GLAPIENTRY