After building all shaders, the main thread continues to update. It is OK in the single thread case.
But bgfx will create another render thread to call bgfx::renderframe to flush commands.
We need to split step 2:
Init EC World
Init Bgfx
Build shaders
Create GPU resources and renderers
So we will create resources and renderers in the same frame with update logic which can keep safe for recording graphics API commands.
I named step 4 as CreateRenderGraph as we will implement RDG to replace mannual written rendering orders and dependencies.
In current init logic:
After building all shaders, the main thread continues to update. It is OK in the single thread case. But bgfx will create another render thread to call bgfx::renderframe to flush commands.
We need to split step 2:
So we will create resources and renderers in the same frame with update logic which can keep safe for recording graphics API commands.
I named step 4 as CreateRenderGraph as we will implement RDG to replace mannual written rendering orders and dependencies.