mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Merge #766
766: Validate set_bind_group is within bounds of limit r=kvark a=cwfitzgerald **Connections** ~~Don't think there are any.~~ Would provide a nicer error message for https://github.com/gfx-rs/wgpu-rs/issues/411. **Description** Implements checks related to our only limit. **Testing** Untested Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
This commit is contained in:
@@ -528,6 +528,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
num_dynamic_offsets,
|
||||
bind_group_id,
|
||||
} => {
|
||||
assert!(
|
||||
(index as u32) < device.limits.max_bind_groups,
|
||||
"Bind group index {0} is out of range 0..{1} provided by requested max_bind_group limit {1}",
|
||||
index,
|
||||
device.limits.max_bind_groups
|
||||
);
|
||||
|
||||
let offsets = &base.dynamic_offsets[..num_dynamic_offsets as usize];
|
||||
base.dynamic_offsets =
|
||||
&base.dynamic_offsets[num_dynamic_offsets as usize..];
|
||||
|
||||
@@ -157,6 +157,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
num_dynamic_offsets,
|
||||
bind_group_id,
|
||||
} => {
|
||||
assert!(
|
||||
(index as u32) < cmb.limits.max_bind_groups,
|
||||
"Bind group index {0} is out of range 0..{1} provided by requested max_bind_group limit {1}",
|
||||
index,
|
||||
cmb.limits.max_bind_groups
|
||||
);
|
||||
|
||||
let offsets = &base.dynamic_offsets[..num_dynamic_offsets as usize];
|
||||
base.dynamic_offsets = &base.dynamic_offsets[num_dynamic_offsets as usize..];
|
||||
|
||||
|
||||
@@ -875,6 +875,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
num_dynamic_offsets,
|
||||
bind_group_id,
|
||||
} => {
|
||||
assert!(
|
||||
(index as u32) < device.limits.max_bind_groups,
|
||||
"Bind group index {0} is out of range 0..{1} provided by requested max_bind_group limit {1}",
|
||||
index,
|
||||
device.limits.max_bind_groups
|
||||
);
|
||||
|
||||
let offsets = &base.dynamic_offsets[..num_dynamic_offsets as usize];
|
||||
base.dynamic_offsets = &base.dynamic_offsets[num_dynamic_offsets as usize..];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user