Geometry: add buffer_view concept to bigwheels
- Dominant language
- C++
- Stars
- 107
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
GLTF file format has this concept of buffer views.
https://kcoley.github.io/glTF/specification/2.0/figures/gltfOverview-2.0.0a.png
(assuming vulkan concepts)
The idea is that you get a single memory allocation for all the mesh data (indices, vertices, attributes), and load it as once.
Then, you setup your buffers on top to access defined sub-ranges indices and vertex data.
Right now, the Geometry & mesh object is setup with the following API:
```c
GetIndexBuffer()
GetVertexBuffer(uint32_t index);
```
This means loading a model requires doing the following:
```c
geometry = parse_input_file("my_model.obj");
mesh = create_gpu_object();
staging_buffer = create_staging_buffer();
cpu_to_gpu(geometry.index_buffer(), staging_buffer);
gpu_to_gpu(staging_buffer, mesh.index_buffer());
cpu_to_gpu(geometry.vertex_buffer(0), staging_buffer);
gpu_to_gpu(staging_buffer, mesh.vertex_buffer(0));
cpu_to_gpu(geometry.vertex_buffer(1), staging_buffer);
gpu_to_gpu(staging_buffer, mesh.vertex_buffer(1));
```
The API might benefit from adding this buffer_view concept to bigwheels. This way, we would have only 1 buffer to copy for such models.
Contributor guide
Assessment
This issue has not been assessed yet.