-
Notifications
You must be signed in to change notification settings - Fork 13
Make shader registration more modular #42
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
Open
raldone01
wants to merge
7
commits into
Rust-GPU:main
Choose a base branch
from
raldone01:changeset/shader_registration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b1b7921
Move shaders into subfolder.
raldone01 443de13
* Get rid of shared crate.
raldone01 8fc3f63
Clippy lints and code quality.
raldone01 511ccfd
Minor consistency change.
raldone01 994e8db
Use shader trait.
raldone01 ebbce16
Semantic improvements.
raldone01 569d75c
Add another shader.
raldone01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'd prefer enums with u32 reprs if possible.
Uh oh!
There was an error while loading. Please reload this page.
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.
Something like this right?
I am not very familiar with bytemuck and it seems to not support enums at first glance.
At least for the
Pod
guarantee.Maybe a lesser one would suffice here?
I assume bytemuck is needed to ensure that the struct layout between spirv and cpu matches right?
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.
There is some activity on Lokathor/bytemuck#292. Maybe if it gets merged in the next week this will become possible by using
NoUninit
instead ofPod
. @LegNeato do you know if thePod
guarantees are really necessary? What is important when sharing data with the gpu? How different is the layout of spirv and rust?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.
Unlikely given that just having bytemuck traits would/does not guarantee that. Instead it's probably used to allow casting to a
&[u8]
when copying to a GPU buffer. That would only requireNoUninit
, notPod
orZeroable
, so would be possible when that PR lands.Technically, being able to cast to
&[u8]
is not a requirement to copy data to the GPU safely, but it may practically be a requirement depending on howwgpu
exposes interfaces to copy into buffers which I don't know off the top of my head.Uh oh!
There was an error while loading. Please reload this page.
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.
this is the call that makes bytemuck traits needed. Indeed
NoUninit
is the only requirement forbytemuck::bytes_of
, andwgpu
does enforce a fully-initialized byte slice here so we do indeed need to ensureNoUninit
Uh oh!
There was an error while loading. Please reload this page.
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.
Awesome thanks. This is addressed in
ebbce16
.