Graphics Reference
In-Depth Information
glVertexAttribPointer ( ATTRIBUTE_STREAM_0 ,...)
glEnableTransformFeedback ()
glDrawArrays (...)
glDisableTransformFeedback ()
swap ( vbo [0] , vbo [1])
i = i + k
This technique requires multiple versions of the shader where each version exe-
cutes the summation on incrementally more input attributes up until the maxi-
mum batch size. It is important to note that the maximum number of input at-
tributes available is limited by the API. This value (which must be at least 16) can
be retrieved by querying glGetIntegerv with the argument GL_MAX_VERTEX_ATTRIBS .
4.4.3 Results
While gathering the data for the graph in Figure 4.3, a maximum batch size
of seven targets was used (batch size indicates the number of additions being
performed in the vertex shader). The demo was executed multiple times for
varying batch sizes. For each run the average frame rate was taken.
These results show that batching the passes reduces the overhead cost of re-
drawing the geometry during the animation update. Depending on the number
of targets used during a given frame, an adequately large batch size should be
chosen to reduce this cost.
300
250
200
150
100
50
0
No batching
Batch size 1
Batch size 2
Batch size 3
Batch size 4
Batch size 5
Batch size 6
Batch size 7
Batch Size
Figure 4.3. Relative performance against batch size when running the demo app.
Search WWH ::




Custom Search