Skip to content

Commit a315925

Browse files
authored
wgpu-core: Inform user about possible fix (#5298)
1 parent 5b9ade8 commit a315925

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

wgpu-core/src/binding_model.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ pub enum BindingZone {
221221
}
222222

223223
#[derive(Clone, Debug, Error)]
224-
#[error("Too many bindings of type {kind:?} in {zone}, limit is {limit}, count was {count}")]
224+
#[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())]
225225
pub struct BindingTypeMaxCountError {
226226
pub kind: BindingTypeMaxCountErrorKind,
227227
pub zone: BindingZone,
@@ -240,6 +240,28 @@ pub enum BindingTypeMaxCountErrorKind {
240240
UniformBuffers,
241241
}
242242

243+
impl BindingTypeMaxCountErrorKind {
244+
fn to_config_str(&self) -> &'static str {
245+
match self {
246+
BindingTypeMaxCountErrorKind::DynamicUniformBuffers => {
247+
"max_dynamic_uniform_buffers_per_pipeline_layout"
248+
}
249+
BindingTypeMaxCountErrorKind::DynamicStorageBuffers => {
250+
"max_dynamic_storage_buffers_per_pipeline_layout"
251+
}
252+
BindingTypeMaxCountErrorKind::SampledTextures => {
253+
"max_sampled_textures_per_shader_stage"
254+
}
255+
BindingTypeMaxCountErrorKind::Samplers => "max_samplers_per_shader_stage",
256+
BindingTypeMaxCountErrorKind::StorageBuffers => "max_storage_buffers_per_shader_stage",
257+
BindingTypeMaxCountErrorKind::StorageTextures => {
258+
"max_storage_textures_per_shader_stage"
259+
}
260+
BindingTypeMaxCountErrorKind::UniformBuffers => "max_uniform_buffers_per_shader_stage",
261+
}
262+
}
263+
}
264+
243265
#[derive(Debug, Default)]
244266
pub(crate) struct PerStageBindingTypeCounter {
245267
vertex: u32,

0 commit comments

Comments
 (0)