Skip to content

Commit

Permalink
Don't case the dynamic offsets count to u8 (#5026)
Browse files Browse the repository at this point in the history
  • Loading branch information
nical authored Jan 9, 2024
1 parent 1bc71eb commit 58fe7ea
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions wgpu-core/src/command/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl RenderBundleEncoder {
}

// Identify the next `num_dynamic_offsets` entries from `base.dynamic_offsets`.
let num_dynamic_offsets = num_dynamic_offsets as usize;
let num_dynamic_offsets = num_dynamic_offsets;
let offsets_range =
next_dynamic_offset..next_dynamic_offset + num_dynamic_offsets;
next_dynamic_offset = offsets_range.end;
Expand Down Expand Up @@ -819,10 +819,10 @@ impl<A: HalApi> RenderBundle<A> {
pipeline_layout.as_ref().unwrap().raw(),
index,
raw_bg,
&offsets[..num_dynamic_offsets as usize],
&offsets[..num_dynamic_offsets],
)
};
offsets = &offsets[num_dynamic_offsets as usize..];
offsets = &offsets[num_dynamic_offsets..];
}
RenderCommand::SetPipeline(pipeline_id) => {
let render_pipelines = trackers.render_pipelines.read();
Expand Down Expand Up @@ -1404,7 +1404,7 @@ impl<A: HalApi> State<A> {
return Some(RenderCommand::SetBindGroup {
index: i.try_into().unwrap(),
bind_group_id: contents.bind_group.as_info().id(),
num_dynamic_offsets: (offsets.end - offsets.start) as u8,
num_dynamic_offsets: offsets.end - offsets.start,
});
}
}
Expand Down Expand Up @@ -1507,7 +1507,7 @@ pub mod bundle_ffi {

bundle.base.commands.push(RenderCommand::SetBindGroup {
index,
num_dynamic_offsets: offset_length.try_into().unwrap(),
num_dynamic_offsets: offset_length,
bind_group_id,
});
}
Expand Down
10 changes: 5 additions & 5 deletions wgpu-core/src/command/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use std::{fmt, mem, str};
pub enum ComputeCommand {
SetBindGroup {
index: u32,
num_dynamic_offsets: u8,
num_dynamic_offsets: usize,
bind_group_id: id::BindGroupId,
},
SetPipeline(id::ComputePipelineId),
Expand Down Expand Up @@ -512,10 +512,10 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {

temp_offsets.clear();
temp_offsets.extend_from_slice(
&base.dynamic_offsets[dynamic_offset_count
..dynamic_offset_count + (num_dynamic_offsets as usize)],
&base.dynamic_offsets
[dynamic_offset_count..dynamic_offset_count + num_dynamic_offsets],
);
dynamic_offset_count += num_dynamic_offsets as usize;
dynamic_offset_count += num_dynamic_offsets;

let bind_group = tracker
.bind_groups
Expand Down Expand Up @@ -924,7 +924,7 @@ pub mod compute_ffi {

pass.base.commands.push(ComputeCommand::SetBindGroup {
index,
num_dynamic_offsets: offset_length.try_into().unwrap(),
num_dynamic_offsets: offset_length,
bind_group_id,
});
}
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/command/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub struct Rect<T> {
pub enum RenderCommand {
SetBindGroup {
index: u32,
num_dynamic_offsets: u8,
num_dynamic_offsets: usize,
bind_group_id: id::BindGroupId,
},
SetPipeline(id::RenderPipelineId),
Expand Down
8 changes: 4 additions & 4 deletions wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1435,10 +1435,10 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {

temp_offsets.clear();
temp_offsets.extend_from_slice(
&base.dynamic_offsets[dynamic_offset_count
..dynamic_offset_count + (num_dynamic_offsets as usize)],
&base.dynamic_offsets
[dynamic_offset_count..dynamic_offset_count + num_dynamic_offsets],
);
dynamic_offset_count += num_dynamic_offsets as usize;
dynamic_offset_count += num_dynamic_offsets;

let bind_group = tracker
.bind_groups
Expand Down Expand Up @@ -2452,7 +2452,7 @@ pub mod render_ffi {

pass.base.commands.push(RenderCommand::SetBindGroup {
index,
num_dynamic_offsets: offset_length.try_into().unwrap(),
num_dynamic_offsets: offset_length,
bind_group_id,
});
}
Expand Down

0 comments on commit 58fe7ea

Please sign in to comment.