As I’m using sprites and other 2D rendering systems, it seems moving forward I will need to develop my own solutions to rendering entities in a purely DOTS format.
The question is, where do I actually schedule the GPU execution? There seems to me 4 ways currently:
- Direct Graphics static class calls. Primarily the Graphics.Draw and Render methods.
- Graphics.ExecuteCommandBufferAsync
- URP / HDRP Render Pass API.
- RenderPipelineManager Begin / End Camera/Context Rendering events.
Which one should I be using?
Wherever possible, I would recommend using the URP and HDRP APIs (e.g. URP ScriptableRenderPass), as those are likely to be the best way for the drawing to get scheduled at the desired time (e.g. opaque rendering pass). They also give you access to the ScriptableRendererContext, which makes it possible to utilize BatchRendererGroup if necessary.
2 Likes
Sorry for necro.
I now use the first way with direct static class Graphics
calls to perform instanced renderer. I call it in ISystem
in PresentationSystemGroup
.
Me and some other devs which uses my package get very odd graphics artifacts which looks like rendered objects settings messed up. It sometimes happens for me when I open some windows in Unity Editor like Profiler. For other devs it happens constantly but only in Editor. VSync heal issue for particular devs. It also depends on count of rendered objects (entities). So I assume that it is something about where and when GPU execution happens.
Can you please give more details of other 3 ways of GPU execution, how they differ between each other and how to actually use them?
1 Like