-
Notifications
You must be signed in to change notification settings - Fork 244
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
Add Const Generic Image Type #359
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
21c3a51
to
d5dcee5
Compare
afd1ab8
to
93c683b
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ed67d48
to
8ccad08
Compare
25a5bb9
to
bb6ae0a
Compare
e775214
to
724cee2
Compare
724cee2
to
28001b4
Compare
Alright, I've implemented all of the feedback.
Well if we nuke the old system, we can't upgrade rust-gpu in Ark until C-like enums are stabilised or we change the parts of Ark to not use reflection for entry points. So I do think it's worth keeping them both for a short time, I've also added a deprecated message if you have the const generics feature enabled, so if you can use it, it warns to move to the new 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.
LGTM pending nits.
Just realized, do we want to export common type aliases? Say, for all the types we already have explicitly defined, e.g. pub type Image2D = Image!(2d, type=f32, sampled)
- might be nice for both examples for users of how to use the macro, plus saves users having to figure out e.g. what the heck sampled
means and if they want it or not.
Oh yeah, also adding docs to the rust-gpu book on the macro syntax would be good, but that can be done in a follow-up if you'd like (file an issue if so). |
The syntax is documented on the macro itself so when you visit the |
People look at the book instead of the API docs when trying to figure out language constructs (where language = DSL in this case), e.g. |
3c1ef3c
to
6e7d846
Compare
6e7d846
to
0ab505c
Compare
0ab505c
to
4aca806
Compare
* Add parameterized Image type * nits * Update crates/spirv-std/src/lib.rs * Update crates/rustc_codegen_spirv/src/symbols.rs * Update crates/rustc_codegen_spirv/src/symbols.rs * Update symbols.rs
This PR refactors
Image
in the backend to not use attributes to determine things like dimensionality and depth, and to instead accept them as const generics as parameters. This has the advantage of only needing a singleImage
type as opposed previously to requiring a new type for each combination, and also allows us to have enums to represent all of the possibilities rather than usingu32
s directly.Additions
macros::Image
a new procedural macro for definingImage
types.image::SampleType
a trait that allows us to be generic of the underlying sampled type of the image.image::ImageCoordinate
a trait built on top ofVector
for parameterising image coordinate vectors based on the sampled type, dimensionality, and arrayed-ness of the Image.spirv_types
crate for holding types that are useful in bothspirv-std
andspirv-std-macros
.Re-works
crate/spirv-std-macros
has been moved into thespirv-std
folder asmacros
beside theshared
crate, this keeps the folder structure cleaner.