In addition to the info I have you Corentin.
The app I have right now has both a UI and a viewport. All using Dawn native. There's some animation on the UI that resizes the viewport etc. Now if I play the animation with no animation on the UI, the viewport content renders fine without any peak. No stutter. When the UI is ongoing, that's when I see some problems: it causes a stutter. In the viewport pass I copy the data for the geometry into the index and vertex buffer like so:
queue.WriteBuffer(render_pipeline_3dview_->index_buffer_, 0,
static_cast<uint8_t*>(scene_render_data_.indices.data()),
scene_render_data_.indices.size() * sizeof(uint32_t));
queue.WriteBuffer(render_pipeline_3dview_->vertex_buffer_, 0,
static_cast<uint8_t*>( scene_render_data_.vertex_data.data()),
scene_render_data_.vertex_data.size() * sizeof(Imath::V3f));
Nothing fancy here. But if skip this (say fill the buffer at startup) then there's no stutter when the UI gets animated?
Now the render pass is really basic:
- fetch data for the UI
- fill buffer for the UI
- set the command for the UI pass
- potentially do the same thing for a stencil pass before
- dothe same thing for the viewport
- composite the UI and the Viewport in a texture
- render to quad
(the quad rendering thing is temp, it's supposed to be replaced by a rectangle textured with the viewport texture in the UI pass - but I don't think this would be an issue). So I stack this as a set of commands and submit.
I tried at 60fps (mode Fifo/Mailbox) so rendering is constrained by the refresh rate. Doesn't make any difference. The data I am copying is really small (not even 4MB). The render times is around 2 to 3ms. I am really confused (.
I realize copying the data on every frame is not ideal, and that's only temp, but with such small data.
If you guys have any ideas I would really appreciate it. I will keep searching but I am starting to run out of ideas for now. Thanks a lot.