-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Allow UiMaterial to provide a custom draw function #10816
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty straightforward :) Should we make similar changes to other material code?
I honestly don't know, which is why I didn't do it. I would need to try it to see how it interacts with meshes, which parts of the pipelines need to be made public, and if it is usable in the end. I think they deserve their own PRs. Also, while this PR is sufficient to add vertex buffers, I was too optimistic in the description. It seems that more will be needed to allow for additional bind groups. I'm not sure if this should block this PR or not, since it's already useful on its own. |
I tried to gather my thoughts. Vertex buffersThe Bind groupsThe 3d materials have Other thoughtsDraw functions were always meant to be a building block, it's unfortunate that the materials currently hard-code them. It would be great in the future to de-duplicate the three material traits (and I wouldn't mind doing the groundwork myself if there is consensus that we want it now). TL;DRI'm fine with the current PR 😄 |
@Davier Sorry, never saw that PR when it was made. Wouldn't it be possible to have a |
Objective
The
UiMaterial
abstraction can currently be used to have custom shaders and one custom bind group. By allowing the material to select its own draw function, it could freely define allbind groups andvertex buffers, while reusing all the parts of the pipeline that it wants. (Edit: adding more bind groups will require more than this PR)Solution
Add a method to the
UiMaterial
trait that returns the draw function's ID, with a default implementation.Make the members of
UiMaterialMeta
public so that they can be reused.Changelog
Allow
UiMaterial
s to provide a custom draw function