-
-
Notifications
You must be signed in to change notification settings - Fork 40
Basic support for HLSL templating #434
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
Basic support for HLSL templating #434
Conversation
parse and pass through class inheritance fix templated struct declaration add unit test
github isn't letting me request a review for some reason - @laurentlb @eldritchconundrum |
Support for accepting (and mostly ignoring for now) templates (and inheritance)... Interesting!
That looks good! |
template<> | ||
struct is_floating_point<float>:true_type{}; |
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.
@eldritchconundrum should the template defn be emitted on the same line? does that matter for minification? same char count. '\n' or ' '
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.
It matters a little because it affects the compression of the generated shader.
In the printer, we use \n when the newline is mandatory (the shader won't work without it), and we use \0 to mean "unessential" newline that can be removed by the formatter when no indentation is needed (e.g. with --format text
).
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.
ah got it, i guess that would require not having the template definition in a verbatim block though
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.
Looks good to me. I have improvements ideas, hopefully I'll do them next week.
sweet tag me in the PR(s) if you're down i'd love to help - i'm tryna get stuff like |
Thanks a lot! |
Support parsing & pass-through of basic HLSL templating introduced in HLSL 2021: https://devblogs.microsoft.com/directx/announcing-hlsl-2021/
Let me know if there's a way to do this that makes more sense, not too familiar with the codebase