From 977095957714ee7ff671cfbf50eef42e6c4420a6 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Sat, 2 Jan 2021 15:13:52 +0100 Subject: [PATCH] Fixed error message for BindingTypeMaxCountError Previously, it would incorrectly report the binding count as the violated limit. Now it reports both the limit and the count that violated it. --- wgpu-core/src/binding_model.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index 10126a9b97..683b7ef4ba 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -107,10 +107,11 @@ pub enum BindingZone { } #[derive(Clone, Debug, Error)] -#[error("too many bindings of type {kind:?} in {zone}, limit is {count}")] +#[error("too many bindings of type {kind:?} in {zone}, limit is {limit}, count was {count}")] pub struct BindingTypeMaxCountError { pub kind: BindingTypeMaxCountErrorKind, pub zone: BindingZone, + pub limit: u32, pub count: u32, } @@ -173,7 +174,12 @@ impl PerStageBindingTypeCounter { ) -> Result<(), BindingTypeMaxCountError> { let (zone, count) = self.max(); if limit < count { - Err(BindingTypeMaxCountError { kind, zone, count }) + Err(BindingTypeMaxCountError { + kind, + zone, + limit, + count, + }) } else { Ok(()) } @@ -242,6 +248,7 @@ impl BindingTypeMaxCountValidator { return Err(BindingTypeMaxCountError { kind: BindingTypeMaxCountErrorKind::DynamicUniformBuffers, zone: BindingZone::Pipeline, + limit: limits.max_dynamic_uniform_buffers_per_pipeline_layout, count: self.dynamic_uniform_buffers, }); } @@ -249,6 +256,7 @@ impl BindingTypeMaxCountValidator { return Err(BindingTypeMaxCountError { kind: BindingTypeMaxCountErrorKind::DynamicStorageBuffers, zone: BindingZone::Pipeline, + limit: limits.max_dynamic_storage_buffers_per_pipeline_layout, count: self.dynamic_storage_buffers, }); }