-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implement PUSH_CONSTANTS feature #777
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
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.
The .monocodus
config not found in your repo. Default config is used.
Check config documentation here
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.
The .monocodus
config not found in your repo. Default config is used.
Check config documentation here
1e54766
to
f2d8222
Compare
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 think this looks great! A few concerns so far, and I would like to take another look for correctness after the next iteration
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 think this is almost good to go. Just a few fixes are needed, nothing major.
f2d8222
to
3d05aa1
Compare
Alright, I think this is good to go, will update the wgpu-rs PR shortly. |
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.
Ok, one last round!
wgpu-core/src/command/render.rs
Outdated
/// None means there is no data and the data should be an array of zeros. | ||
/// | ||
/// Facilitates clears in renderbundles which explicitly do their clears. | ||
values_offset: Option<usize>, |
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.
does this need to be usize
? I.e. can we say that you aren't going to have more than 64k of push constants ever, and have this offset being u16
instead? We'd want to keep the enum RenderCommand
size to be small. Even though right now it may not be the enum variant that makes it big, we don't want to face this later down the road when we try to shrink it.
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'm going to make this a u32, as this index can be as large as the sum of all push constants used in a render pass, and if someone sets a lot of push constants (or used metal's 4k to their full advantage), it would overrun a u16 pretty quickly.
wgpu-core/src/command/render.rs
Outdated
); | ||
for range in non_overlapping { | ||
let clear_bytes = | ||
vec![0_u32; (range.range.end - range.range.start) as usize / 4]; |
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 think the way we'd set this up in the near future (or now?) is: having a fixed-size zero vector somewhere, say in Device
, say of 256 bytes. Then this code would have a loop that re-uses the same vector and calls push_graphics_constants
as many times as needed to fill in zeroes.
3d05aa1
to
e721984
Compare
Alrighty, should be good, rebasing... |
e721984
to
c7c4c3e
Compare
That was a pretty nasty rebase, let me get wgpu-rs up to date to make sure I didn't break anything. |
c7c4c3e
to
c8bcc50
Compare
Fixed! |
435: Implement PUSH_CONSTANTS feature r=kvark a=cwfitzgerald The rust half of the push constant extensions, continuing from gfx-rs/wgpu#777. Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
435: Implement PUSH_CONSTANTS feature r=kvark a=cwfitzgerald The rust half of the push constant extensions, continuing from gfx-rs#777. Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
778: Return None from get_swap_chain_preferred_format if the adapter does not support the surface r=kvark a=OlegOAndreev Fixes gfx-rs#777 Almost every other method in wgpu panics on failure, so I decided to make the return value an `Option<TextureFormat>`, not a `Result<Option<TextureFormat>>` Co-authored-by: Oleg Andreev <ooandreev@yandex-team.ru>
Connections
Closes #734. Makes minor progress on #689.
Description
This one is a doozy.
Implements Push Constant support in wgpu.
Implementation Notes:
Code Notes:
Other Work:
PipelineLayoutDescriptor
was moved into wgt from wgpu-rs with a generic.Testing
I have modified the wgpu-rs example to use push constants for its uniform fallback, which is a perfect use case for push constants. I have not tested compute constants, but I expect no issues with them.
gfx-rs/wgpu-rs#435