<p>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 <code>glBufferData</code> with OpenGL). I can regenerate the array and reupload for each frame.</p>
<p>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 <code>glBufferSubData</code> with OpenGL) while keeping track of offset for each added mesh inside the buffer. We do this for each frame.</p>
<p>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?</p>

CC BY-SA 4.0
2022-08-08T22:35:12.970Z
Um, you seem to have that backwards. Uploading data to a buffer every frame? *That* is [streaming](https://www.khronos.org/opengl/wiki/Buffer_Object_Streaming). Uploading data once and leaving it there is *not* streaming.
Nicol Bolas
CC BY-SA 4.0
2022-08-08T22:40:59.733Z
@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)
Lenny White
CC BY-SA 4.0
2022-08-09T00:14:50.413Z
"*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?
Nicol Bolas
<gpu><vertex-buffer-object><synchronization>
Why use buffer streaming instead of collecting data on CPU and uploading to GPU all at once
Lenny White
# Why use buffer streaming instead of collecting data on CPU and uploading to GPU all at once

(Asked by: username_0 on 2022-08-08)

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?

**Tags:** gpu, vertex-buffer-object, synchronization

> **Comments:**
> **username_1**: Um, you seem to have that backwards. Uploading data to a buffer every frame? *That* is [streaming](https://www.khronos.org/opengl/wiki/Buffer_Object_Streaming). Uploading data once and leaving it there is *not* streaming.  
> **username_0**: @username_1 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)  
> **username_1**: "*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?  

---

## 0 answers

