Default/mutable buffer uploading #285
-
For data that may change once every 1-100+ frames, what would you recommend as the GPU uploading scheme? Should small data objects generally be uploaded in a single call, possibly wasting bandwidth? Or is it, in general, better to optimize the amount of data uploaded by increasing the number of uploads? IE, skipping over unchanged data? I'm currently planning to upload using And there's also a question of how this should be handled when those objects don't reside in adjacent memory. Would it be worth it to copy all of them to another chunk of memory so they are adjacent, so it can be copied in one call? Or would it be just as effective to upload them one at a time? I will definitely test some of these things at some point, but I'm curious to hear from someone that knows much more about these things. Even when things test well, I'm skeptical to rely on it, due to lack of exposure to other cards/PCs and a general lack of past experience with graphics programming. I appreciate any info you have time for. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The general rule of thumb in GPU programming is to batch commands as much as possible. Updating all at once is going to be much more efficient than issuing many commands to update small parts.
That largely depends on your specific use case. If you need to re-upload megabytes of data just to update a few bytes, that is probably not going to be optimal. If you need to update, say at least 50% of the data, then batching will be benefcial.
Depends on how much data you need to update. UpdateBuffer is much more expensive than mapping a dynamic buffer. If you update few KBs of data, just do it.
Unless your object data is really tiny (like, few bytes), this likely will not give much benefit. But I don't know really. Also, always measure your performance and don't do premature or speculative optimizations - optimize only what is know to be the bottleneck from profiler. |
Beta Was this translation helpful? Give feedback.
The general rule of thumb in GPU programming is to batch commands as much as possible. Updating all at once is going to be much more efficient than issuing many commands to update small parts.
That largely depends on your specific use case. If you need to re-upload megabytes of data just to update a few bytes, that is probably not going to be optimal. If you need to update, say at least 50% of the data, then batching will be benefcial.