Skip to content
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

Don't cast the dynamic offsets count to u8 #5026

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -809,10 +809,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 @@ -1394,7 +1394,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 @@ -1497,7 +1497,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
Loading