Skip to content

Commit

Permalink
Web backend: call set_vertex_buffer with size as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
afiedler authored and kvark committed Nov 22, 2021
1 parent 385d9ca commit 8196b75
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions wgpu/src/backend/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,20 @@ impl crate::RenderInner<Context> for RenderPass {
offset: wgt::BufferAddress,
size: Option<wgt::BufferSize>,
) {
let mapped_size = match size {
Some(s) => s.get() as f64,
None => 0f64,
match size {
Some(s) => {
self.0.set_vertex_buffer_with_f64_and_f64(
slot,
&buffer.0,
offset as f64,
s.get() as f64,
);
}
None => {
self.0
.set_vertex_buffer_with_f64(slot, &buffer.0, offset as f64);
}
};
self.0
.set_vertex_buffer_with_f64_and_f64(slot, &buffer.0, offset as f64, mapped_size);
}
fn set_push_constants(&mut self, _stages: wgt::ShaderStages, _offset: u32, _data: &[u8]) {
panic!("PUSH_CONSTANTS feature must be enabled to call multi_draw_indexed_indirect")
Expand Down Expand Up @@ -324,12 +332,20 @@ impl crate::RenderInner<Context> for RenderBundleEncoder {
offset: wgt::BufferAddress,
size: Option<wgt::BufferSize>,
) {
let mapped_size = match size {
Some(s) => s.get() as f64,
None => 0f64,
match size {
Some(s) => {
self.0.set_vertex_buffer_with_f64_and_f64(
slot,
&buffer.0,
offset as f64,
s.get() as f64,
);
}
None => {
self.0
.set_vertex_buffer_with_f64(slot, &buffer.0, offset as f64);
}
};
self.0
.set_vertex_buffer_with_f64_and_f64(slot, &buffer.0, offset as f64, mapped_size);
}
fn set_push_constants(&mut self, _stages: wgt::ShaderStages, _offset: u32, _data: &[u8]) {
panic!("PUSH_CONSTANTS feature must be enabled to call multi_draw_indexed_indirect")
Expand Down

0 comments on commit 8196b75

Please sign in to comment.