Skip to content
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

Expose mesh shader functionality #11272

Closed
Ansraer opened this issue Dec 1, 2024 · 2 comments
Closed

Expose mesh shader functionality #11272

Ansraer opened this issue Dec 1, 2024 · 2 comments

Comments

@Ansraer
Copy link

Ansraer commented Dec 1, 2024

Describe the project you are working on

Rendering experiments in godot, occasional godot PRs

Describe the problem or limitation you are having in your project

Godot's rendering code uses RenderingDevice and RenderingDeviceDriver to interact with the underlying rendering API. This means that developers can write generic rendering code targeting this custom abstraction layer and godot will automatically take care of "translating" those instructions to the underlying API using a so called "rendering driver". We are thus able to support a multitude of modern rendering APIs (Vulkan, Metal, DX12, ...)

However, this also means that when we are developing new features for godot itself or including custom rendering instructions in our projects using the recent-ish hooks(godot/pull/80214) we are limited to rendering features that have already been added to this abstraction layer.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Mesh Shading is a more modern geometry pipeline that aims to provide an alternative to the traditional vertex/fragment pipeline rendering engineers have been using so far. Instead of having a vertex shader that processes single vertices at a time the mesh shader stage operates on entire meshes at once (usually called "meshlets"). Since these mesh shaders are fully customizeable the developer has a lot more control over how exactly the geometry is organized and processed.
Additionally, a new optional stage is introduced, so called "task shader" which are capable of dispatching the mesh shader.

Utilizing this more compute-like approach to rendering makes it easier implement GPU driven rendering and makes it trivial to do stuff such as culling or LOD selection on the GPU instead.
Mesh shaders can also be used for efficient multi mesh rendering or procedural geometry.
For more in depth information I would suggest one takes a look at the following link and the other resources linked there.

NOTE: this proposal is only about exposing mesh shaders and not about actually using them in one of the built in renderers. This is merely about laying the foundation for future proposals and allowing interested developers to use mesh shaders in their own forks of the engine or any plugins/extensions they develop.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Logic needs to be added added to the rendering device, the graph and the drivers to expose the already existing "mesh shader" functionality. Luckily all three major graphics APIs (Vulkan, DX12, Metal) support mesh shaders in a fairly similar way. Furthermore thimenesup has already taken the time to write a PR that exposes this functionality: https://github.com/godotengine/godot/pull/88934/files

Given that this has been pretty much standardized across all major vendors and there is only really one way to expose this I don't expect this to need any major updates or maintenance once it has been approved & merged.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, this needs to be exposed at the lowest level of our rendering code.

Is there a reason why this should be core and not an add-on in the asset library?

No, rendering device, graph & drivers are core.

@tetrapod00
Copy link

tetrapod00 commented Dec 1, 2024

Duplicate of #6822, consolidating there. Thanks for the suggestion, please feel free to comment in the other proposal if you have additional input

@tetrapod00
Copy link

@Ansraer you may want to copy and paste your proposal as a comment to the existing proposal, since it differs in some places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants