Don't case the dynamic offsets count to u8 (#5026)

This commit is contained in:
Nicolas Silva 2024-01-09 15:41:39 +01:00 committed by GitHub
parent 1bc71eb8b2
commit 58fe7eac48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 15 deletions

View File

@ -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;
@ -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();
@ -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,
});
}
}
@ -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,
});
}

View File

@ -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),
@ -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
@ -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,
});
}

View File

@ -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),

View File

@ -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
@ -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,
});
}