0
$\begingroup$

Say I have a couple of meshes that I want to reupload to GPU for each frame. I can do this by generating a single array from all the meshes on CPU and then uploading to GPU (ex with glBufferData with OpenGL). I can regenerate the array and reupload for each frame.

This is something I've done before I became aware of buffer streaming. The way I understand buffer streaming is we first allocate a large enough vertex buffer, then we upload each mesh to it (ex with glBufferSubData with OpenGL) while keeping track of offset for each added mesh inside the buffer. We do this for each frame.

With streaming there are issues like implicit synchronization. We can avoid this problem by different means. But why not just do the work on CPU instead, by collecting all the data into one array and uploading at the end of the frame? Would it be a considerable performance hit?

$\endgroup$
3
  • $\begingroup$ Um, you seem to have that backwards. Uploading data to a buffer every frame? That is streaming. Uploading data once and leaving it there is not streaming. $\endgroup$ Aug 8, 2022 at 22:35
  • $\begingroup$ @NicolBolas I think I didn't explain it well enough. With streaming I did mean uploading data to a buffer every frame. But the way I understand this is traditionally done is by uploading each mesh individually. As opposed to merging them into one single mesh and uploading once (on each frame) $\endgroup$ Aug 8, 2022 at 22:40
  • 1
    $\begingroup$ "But the way I understand this is traditionally done is by uploading each mesh individually." Whose tradition? What were they trying to render where they did this? What were they doing to the mesh data on the CPU? See, the entire point of any streaming system is to communicate data that originates on the CPU for GPU consumption. So the first question with any streaming setup is... why are you doing it? What's going on on the CPU that you need to pass this data in every frame? $\endgroup$ Aug 9, 2022 at 0:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.