I perceive that for environment friendly rendering in video games, you wish to reduce communication between the CPU and GPU. … is not this the CPU speaking to the GPU? Is not this very gradual and what we’re purported to keep away from?
It doesn’t matter what, you all the time must ship one thing to the GPU each body. Absolutely the minimal potential information to ship could be a single command “draw the subsequent body primarily based on the info you have already got”, however that’s not how video games work, since video games are interactive. Even “GPU-driven rendering” nonetheless wants the most recent body’s scene information to be transferred to the GPU.
However actually, for effectivity, it is best to keep away from sending pointless information to the GPU. Up to date transforms are vital information (except you might have, say, a GPU particle simulation).
You may be considering of the recommendation to keep away from studying information from the GPU (e.g. with glReadPixels
). This is “gradual” as a result of it has to attend for the GPU to complete writing the info you wish to learn, whereas so long as you do not learn something, the CPU and GPU can work in parallel, making ready the subsequent body whereas rendering the present one. (And you’ll nonetheless learn effectively by cautious scheduling and selecting to learn information from a earlier body’s computation.)
However consideration of the quantity of knowledge you write to the GPU needs to be approached similar to some other program optimization drawback: take into consideration what number of operations you are working, take into consideration how a lot information you need to switch over the reminiscence bus and the way it may be represented extra compactly, and many others. And all the time benchmark/profile a potential change or various design fairly than assuming that it have to be higher.
I perceive we will use uniform buffer objects as an alternative of updating uniforms individually
You need to be utilizing an occasion buffer to ship mannequin transforms to the GPU. That method you don’t must problem a separate draw name for each object.