-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support dynamic offsets #131
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
@@ -776,8 +776,8 @@ impl CommandEncoder { | |||
} | |||
|
|||
impl<'a> RenderPass<'a> { | |||
pub fn set_bind_group(&mut self, index: u32, bind_group: &BindGroup) { | |||
wgn::wgpu_render_pass_set_bind_group(self.id, index, bind_group.id); | |||
pub fn set_bind_group(&mut self, index: u32, bind_group: &BindGroup, offsets: &[u32]) { |
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 API spec states an optional sequence of u64, however gfx-hal
expects u32
, so that's why I used that here. I also opted for a slice instead of an Option
, as that seems more idiomatic, and the underlying API also expects a slice.
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.
slice is good here, no need for Option
Thank you! bors r+ Note: travis seems to experience outage on macOS, unfortunately |
Build failed |
I'll look into this - indeed the descriptor type has to be set to |
Yes, that is correct.
… On Apr 23, 2019, at 18:24, Alexis Sellier ***@***.***> wrote:
I'll look into this - indeed the descriptor type has to be set to UniformBufferDynamic, and I don't think you want to default to that for all Uniform buffers. If I understand correctly, the offsets list will offset into all dynamic buffers, in order. So if the bind group has 5 bindings and 2 of those are dynamic uniform buffers, then the offsets slice will contain 2 elements.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
7727098
to
5c8ce4e
Compare
@@ -25,6 +25,7 @@ pub enum BindingType { | |||
Sampler = 1, | |||
SampledTexture = 2, | |||
StorageBuffer = 3, | |||
UniformBufferDynamic = 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.
can we add StorageBufferDynamic
please since we are at 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.
Certainly!
I'm making progress, however the one issue I'm encountering now is that |
Put differently: bind groups with at least one dynamic buffer in them always get re-set. Otherwise it looks like we have to keep track of the offsets in |
Yes, I agree. let's always re-set bind groups containing any dynamic offsets |
9e873e2
to
25bbf96
Compare
1543ab2
to
6ee8cb6
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.
Looks great to me, thank you!
Might need a bit of squashing, so that each individual commit is buildable.
wgpu-native/src/device.rs
Outdated
binding_model::BindingType::StorageBuffer => { | ||
device.limits.min_storage_buffer_offset_alignment | ||
} | ||
_ => panic!("Mismatched buffer binding for {:?}", decl), | ||
binding_model::BindingType::StorageBufferDynamic => { |
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.
nit: merge the arm with the one above?
@@ -776,8 +776,8 @@ impl CommandEncoder { | |||
} | |||
|
|||
impl<'a> RenderPass<'a> { | |||
pub fn set_bind_group(&mut self, index: u32, bind_group: &BindGroup) { | |||
wgn::wgpu_render_pass_set_bind_group(self.id, index, bind_group.id); | |||
pub fn set_bind_group(&mut self, index: u32, bind_group: &BindGroup, offsets: &[u32]) { |
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.
slice is good here, no need for Option
e06a50d
to
81acd73
Compare
Closes gfx-rs#125 * Add support for dynamic offsets when setting a bind group. * Add new binding types: `UniformBufferDynamic` and `StorageBufferDynamic`
81acd73
to
c468840
Compare
Merged the arms and squashed to one commit 👍 |
Bors r+
… On Apr 26, 2019, at 16:50, Alexis Sellier ***@***.***> wrote:
Merged the arms and squashed to one commit 👍
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Build succeeded |
Fix `Subscription` missing in `iced_web`
Closes #125
Adds support for dynamic offsets when setting a bind group.
I haven't actually tried if this works with my use-case, but it's fairly straight forward. 😅