Game Development Reference
In-Depth Information
x -axis: Number of Draws
y -axis: Processing Time in ms
100
80
60
40
20
0
1,000
2,000
4,000
8,000
16,000
32,000
64,000
128,000
256,000
Discarded
Rendered
Figure 2.9. Comparing performance between discarded draws and draws rendering a
single quad per draw producing 16 pixels on the framebuffer.
indirect buffer. For this chapter we used a brute force OpenCL kernel to check
every object in the scene, but nothing prevents us from using space partitioning
techniques to continue scaling up the scene complexity.
Taking a closer look at the new draw call functions, it is both interest-
ing and annoying to acknowledge that the glMultiDrawElementsIndirect and
glMultiDrawArraysIndirect parameter drawcount is not sourced from the indi-
rect draw buffer. It would be a wrong idea to query the number of draws that
the compute program effectively wrote in the indirect draw buffer and use this
number for drawcount . Such an idea is worse than a CPU draw call overhead as it
implies a synchronization point between the CPU and the GPU, preventing them
from running in parallel. A better alternative is to use the maximum number of
elements in the multi draw indirect buffer for drawcount and ask the command
processor to discard the draws we don't need by writing 0 for the primCount pa-
rameter of each draw we want to discard. As Figure 2.9 shows, discarding draws
is not free so that the number of draws needs to be carefully chosen.
2.4.2
Programmable Vertex Fetching
Using Programmable Draw Dispatching is an interesting step but it can show
some limitations as soon as the scene contains meshes with multiple vertex for-
mats. Sorting the multiple indirect draws per vertex format is not very practical
but is necessary. Each vertex format requires a separate CPU call, which increases
the CPU overhead. If there are many different vertex formats, then the high CPU
cost of indirect draw calls may lead to an overall lower level of performance from
the application.
 
Search Nedrilad ::




Custom Search