Should I use a small size for Queue::write_buffer_with? #7091
-
The documentation for Queue::write_buffer_with suggests that it creates a new buffer on ever call. The buffer is mapped, allowing me to write to it. Should I try to organize my data so I can call write_buffer_with over as small of a range/size as possible? Does it matter at all if I use a size argument of 100 megabytes just to write a kilobyte (sparse data)? Or does that argument only represent the upper boundary and does not actually allocate a staging buffer of 100 megabytes? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
We will allocate the entire size of buffer you request, and will copy that entire region to the gpu. In that way write_buffer shouldn't be used for very sparse updates as you'll upload a whole load of zeros. The best way to do very sparse updates is to upload |
Beta Was this translation helpful? Give feedback.
We will allocate the entire size of buffer you request, and will copy that entire region to the gpu. In that way write_buffer shouldn't be used for very sparse updates as you'll upload a whole load of zeros. The best way to do very sparse updates is to upload
(index, data)
pairs, then use a compute shader to scatter those to the places they need to go, but that's a more advanced technique.