You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Improve binding error
* Introduce a new BindingTypeName enum
* Fix formatting
* Use From trait instead of map functions for BindingTypeName
* Update CHANGELOG.md
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -116,6 +116,7 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148]
116
116
117
117
- Make `Surface::as_hal` take an immutable reference to the surface. By @jerzywilczek in [#9999](https://github.com/gfx-rs/wgpu/pull/9999)
118
118
- Add actual sample type to `CreateBindGroupError::InvalidTextureSampleType` error message. By @ErichDonGubler in [#6530](https://github.com/gfx-rs/wgpu/pull/6530).
119
+
- Improve binding error to give a clearer message when there is a mismatch between resource binding as it is in the shader and as it is in the binding layout. By @eliemichel in [#6553](https://github.com/gfx-rs/wgpu/pull/6553).
#[error("Buffer structure size {buffer_size}, added to one element of an unbound array, if it's the last field, ended up greater than the given `min_binding_size`, which is {min_binding_size}")]
151
189
WrongBufferSize{
152
190
buffer_size: wgt::BufferSize,
@@ -378,7 +416,12 @@ impl Resource {
378
416
}
379
417
min_binding_size
380
418
}
381
-
_ => returnErr(BindingError::WrongType),
419
+
_ => {
420
+
returnErr(BindingError::WrongType{
421
+
binding:(&entry.ty).into(),
422
+
shader:(&self.ty).into(),
423
+
})
424
+
}
382
425
};
383
426
match min_size {
384
427
Some(non_zero)if non_zero < size => {
@@ -396,7 +439,12 @@ impl Resource {
396
439
returnErr(BindingError::WrongSamplerComparison);
397
440
}
398
441
}
399
-
_ => returnErr(BindingError::WrongType),
442
+
_ => {
443
+
returnErr(BindingError::WrongType{
444
+
binding:(&entry.ty).into(),
445
+
shader:(&self.ty).into(),
446
+
})
447
+
}
400
448
},
401
449
ResourceType::Texture{
402
450
dim,
@@ -478,7 +526,12 @@ impl Resource {
478
526
access: naga_access,
479
527
}
480
528
}
481
-
_ => returnErr(BindingError::WrongType),
529
+
_ => {
530
+
returnErr(BindingError::WrongType{
531
+
binding:(&entry.ty).into(),
532
+
shader:(&self.ty).into(),
533
+
})
534
+
}
482
535
};
483
536
if class != expected_class {
484
537
returnErr(BindingError::WrongTextureClass{
@@ -487,7 +540,15 @@ impl Resource {
487
540
});
488
541
}
489
542
}
490
-
ResourceType::AccelerationStructure => (),
543
+
ResourceType::AccelerationStructure => match entry.ty{
0 commit comments