OSDN Git Service

st/mesa: set vertex arrays state only when necessary
authorMarek Olšák <maraeo@gmail.com>
Sun, 26 Dec 2010 03:30:51 +0000 (04:30 +0100)
committerMarek Olšák <maraeo@gmail.com>
Mon, 14 Feb 2011 20:50:08 +0000 (21:50 +0100)
commit2a904fd6a0cb80eec6dec2bae07fd8778b04caf3
tree8a959d1eb02aa38721a6bacab9441d81adafc47f
parentcdca3c58aa2d9549f5188910e2a77b438516714f
st/mesa: set vertex arrays state only when necessary

The vertex arrays state should be set only when (_NEW_ARRAY | _NEW_PROGRAM)
is dirty. This assumes user buffer content is mutable, which will be
sorted out in the next commit. The following usage case should be much faster
now:

for (i = 0; i < 1000; i++) {
   glDrawElements(...);
}

Or even:

for (i = 0; i < 1000; i++) {
   glSomeStateChangeOtherThanArraysOrProgram(...);
   glDrawElements(...);
}

The performance increase from this may be significant in some apps and
negligible in others. It is especially noticable in the Torcs game (r300g):
    Before: 15.4 fps
    After: 20 fps

Also less looping over attribs in st_draw_vbo yields slight speed-up
in apps with lots of glDraw* calls.
src/mesa/state_tracker/st_draw.c