wgpu-core: Inform user about possible fix (#5298)

This commit is contained in:
Augusto Hack authored and Connor Fitzgerald committed 2024-02-29 16:26:51 -05:00
1 parent e9720bfb7a
commit a9a4187643
2 files changed
+24 -1

No files matched your search

+1
View File
@@ -74,6 +74,7 @@ Bottom level categories:
- Device lost callbacks are invoked when replaced and when global is dropped. By @bradwerth in [#5168](https://github.com/gfx-rs/wgpu/pull/5168)
- Fix performance regression when allocating a large amount of resources of the same type. By @nical in [#5229](https://github.com/gfx-rs/wgpu/pull/5229)
- Fix docs.rs wasm32 builds. By @cwfitzgerald in [#5310](https://github.com/gfx-rs/wgpu/pull/5310)
- Improve error message when binding count limit hit. By @hackaugusto in [#5298](https://github.com/gfx-rs/wgpu/pull/5298)
#### DX12
- Fix `panic!` when dropping `Instance` without `InstanceFlags::VALIDATION`. By @hakolao in [#5134](https://github.com/gfx-rs/wgpu/pull/5134)
+23 -1
View File
@@ -222,7 +222,7 @@ pub enum BindingZone {
}
#[derive(Clone, Debug, Error)]
#[error("Too many bindings of type {kind:?} in {zone}, limit is {limit}, count was {count}")]
#[error("Too many bindings of type {kind:?} in {zone}, limit is {limit}, count was {count}. Check the limit `{}` passed to `Adapter::request_device`", .kind.to_config_str())]
pub struct BindingTypeMaxCountError {
pub kind: BindingTypeMaxCountErrorKind,
pub zone: BindingZone,
@@ -241,6 +241,28 @@ pub enum BindingTypeMaxCountErrorKind {
UniformBuffers,
}
impl BindingTypeMaxCountErrorKind {
fn to_config_str(&self) -> &'static str {
match self {
BindingTypeMaxCountErrorKind::DynamicUniformBuffers => {
"max_dynamic_uniform_buffers_per_pipeline_layout"
}
BindingTypeMaxCountErrorKind::DynamicStorageBuffers => {
"max_dynamic_storage_buffers_per_pipeline_layout"
}
BindingTypeMaxCountErrorKind::SampledTextures => {
"max_sampled_textures_per_shader_stage"
}
BindingTypeMaxCountErrorKind::Samplers => "max_samplers_per_shader_stage",
BindingTypeMaxCountErrorKind::StorageBuffers => "max_storage_buffers_per_shader_stage",
BindingTypeMaxCountErrorKind::StorageTextures => {
"max_storage_textures_per_shader_stage"
}
BindingTypeMaxCountErrorKind::UniformBuffers => "max_uniform_buffers_per_shader_stage",
}
}
}
#[derive(Debug, Default)]
pub(crate) struct PerStageBindingTypeCounter {
vertex: u32,