Hi everyone,
We've experimented with building a UI using Dawn. All primitives in this UI are quads. Because each quad has unique properties such as its position, size, uv coordinates, color, etc. we are using buffers with dynamic offsets to pass that data to the shader.
The sort of limitation I seem to have (unless there's another way of doing this that I am not aware of) is that I can't render the quads in batch because I need to set the offset for each rendered quad. So I need to do something like
```
for (unsigned i = 0; i < num_quads; ++i) {
pass.SetIndexBuffer(index_buffer_, wgpu::IndexFormat::Uint32, index_offset);
pass.SetBindGroup(0, bindgroup_, 1, &bindgroup_offset);
pass.DrawIndexed(6);
bindgroup_offset += shader_params_offset;
index_offset += 6 * sizeof(uint32_t);
}
```
Instead of
```
pass.SetIndexBuffer(index_buffer_, wgpu::IndexFormat::Uint32, index_offset);
pass.SetBindGroup(0, bindgroup_, 1, &bindgroup_offset, array_stride); // this wouldn't work of course but just to illiustrate the idea
pass.DrawIndexed(num_quads * 2 * 3);
```
Of course, the second method doesn't work (
with respect to dynamic buffers) but was wondering if 1) there was a way of making this possible in the current implementation 2) whether you could see this as a possible thing to implement in the future (if this is technically possible with respect to the underlying APIs). The idea would that could just render a batch of triangles and specify a contiguous memory block in which the dynamic buffers for the shaders parameters would be stored (you would also need to indicate some kind of array stride and how many triangles you'd render before stepping forward to the next set of shader parameters in the buffer - at least 2 additional parameters).
Of course no idea if this is even possible, but to summarize this would be "how could one render a batch of primitive while still taking advantage of dynamic offset for uniform buffers".
Thanks a lot.