-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gpu Driven Rendering By Default #1342
Comments
Im pretty sure Bevy already uses the GPU @DrewDaPilot ? |
According to the article the idea is to compute what to draw on the GPU instead of CPU and then use an indirect draw call to actually draw what was computed. Webgpu probably doesn't have support for this. |
Bevy does this
Could you be more specific? If you mean scan out, this is already quite efficient on most systems - compositors rarely copy around rasters like the old days. |
Ohhh, based on the article i think the OP is talking about supporting the approach where compute shaders generate most/all of the graphics, in lieu of shipping big buffers back and forth from the CPU. |
Yeah theres plenty of room for offloading more work to the gpu in Bevy. The big issue (in the short term) is that those techniques don't work well or at all on some platforms/apis (ex: webgl and older hardware). So in the short term while we sort out the core render apis I'd prefer to use more universally compatible techniques. This helps the codebase stay lean and easy to refactor. Engines like Bevy should be able to run everywhere by default and that will take precedence over squeezing every ounce of performance from each individual platform. In the medium term when the renderer has stabilized, we can start specializing to squeeze the most out of each platform. We're already using modern apis, so this should be a "high level addition", not a major rewrite of everything. Fortunately theres nothing stopping people from forging on ahead now. Its just not something I'm ready to invest in or maintain (yet) |
That's a fair argument to be made, however, even WebGL can support GPU driven rendering through the use of vertex and fragment shaders. As for IOS/Android, compute shaders are usually a thing if the OpenGL ES version is 3.1 or above, but a gpu driven pipeline can exist without compute shaders. I think it's at least worth looking into and investigating the feasibility. |
While compute shaders can be emulated using vertex and fragment shaders, GPU driven rendering needs the draw indirect command to actually draw the generated drawlist. This is command is only supported by OpenGL with the extension |
Fair enough, so maybe WebGL support would be finicky or impossible in the short term, but I think in the long-term WebGL will probably support such features when it updates to OpenGL ES 3.2. But I digress, I think it's still worth considering the extra performance on compatible platforms. I think it's fair to say that it's worth implementing since every platform supports indirect draw calls (except for WebGL). |
If we don't get WebGPU before then. |
# Objective - Implements a more efficient, GPU-driven (#1342) rendering pipeline based on meshlets. - Meshes are split into small clusters of triangles called meshlets, each of which acts as a mini index buffer into the larger mesh data. Meshlets can be compressed, streamed, culled, and batched much more efficiently than monolithic meshes. ![image](https://github.com/bevyengine/bevy/assets/47158642/cb2aaad0-7a9a-4e14-93b0-15d4e895b26a) ![image](https://github.com/bevyengine/bevy/assets/47158642/7534035b-1eb7-4278-9b99-5322e4401715) # Misc * Future work: #11518 * Nanite reference: https://advances.realtimerendering.com/s2021/Karis_Nanite_SIGGRAPH_Advances_2021_final.pdf Two pass occlusion culling explained very well: https://medium.com/@mil_kru/two-pass-occlusion-culling-4100edcad501 --------- Co-authored-by: Ricky Taylor <rickytaylor26@gmail.com> Co-authored-by: vero <email@atlasdostal.com> Co-authored-by: François <mockersf@gmail.com> Co-authored-by: atlas dostal <rodol@rivalrebels.com>
Performant Rendering
the default gpu pipeline used in bevy should be one that takes in to consideration concepts from guides like this https://vkguide.dev/docs/gpudriven/gpu_driven_engines/. In this way, bevy can render objects with extreme performance, and will never bottleneck on the cpu. In general, GPU Driven Rendering has some tradeoffs that would need to be made, but would increase performance, sustainability, and would enhance any future efforts to include ray-tracing and other novel tech.
The text was updated successfully, but these errors were encountered: