Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wgpu-core: Inform user about possible fix #5298

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion wgpu-core/src/binding_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,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,
Expand All @@ -240,6 +240,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,
Expand Down
Loading