Trait based shader implementation #212
LouChiSoft
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
We've been discussing this a lot! Personally, I want everything in types and traits rather than annotated with proc macros. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, first off I would like to say how excited I am to see this project get a new lease of life. Having seen that it wasn't getting much progress before Embark handed it over I was starting to think it wasn't going to go anywhere. Now onto my idea.
Having read through the examples in the repository, while I can see mostly how everything works I did find it a bit inconsistent. For example a vertex shader needs macros for vertex id and positions, etc. whereas fragmet shaders only need to be marked as a fragment shader. Compute shaders then also need on top of that things like the size of the workgroup in the Compute shader macro etc. It's just a bit messy to me.
This led me to wonder if trait based shaders have been considered? The way I see it, you could have a trait for each supported shader stage where trait types/data could be used for the "meta data" of a shader stage, and they would all have a "process" or "shader" function that is the actual shader that get's compiled. I won't pretend to know all the answers to the questions needed to make this a fully fledged out spec, but it just seems a better way to organise your shader code. It would also let you group certain shaders that work together, e.g. a vertex shader and a fragment shader that are used together could both be from the same struct that implements Vertex and Fragment
Beta Was this translation helpful? Give feedback.
All reactions