From de7765bd28adaf909e4b813d33d8fbb717d15578 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Mon, 2 Sep 2024 12:24:22 -0700 Subject: [PATCH] [core]: Let `Device::create_buffer_binding` get `limits` from `self`. Rather than passing `self.limits` to `Device::create_buffer_binding` as an argument, let it simply refer to `self.limits` itself. --- wgpu-core/src/device/resource.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index b10c2f63c..9f10104ee 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -1890,7 +1890,6 @@ impl Device { dynamic_binding_info: &mut Vec, late_buffer_binding_sizes: &mut FastHashMap, used: &mut BindGroupStates, - limits: &wgt::Limits, snatch_guard: &'a SnatchGuard<'a>, ) -> Result, binding_model::CreateBindGroupError> { @@ -1915,7 +1914,7 @@ impl Device { wgt::BufferBindingType::Uniform => ( wgt::BufferUsages::UNIFORM, hal::BufferUses::UNIFORM, - limits.max_uniform_buffer_binding_size, + self.limits.max_uniform_buffer_binding_size, ), wgt::BufferBindingType::Storage { read_only } => ( wgt::BufferUsages::STORAGE, @@ -1924,12 +1923,12 @@ impl Device { } else { hal::BufferUses::STORAGE_READ_WRITE }, - limits.max_storage_buffer_binding_size, + self.limits.max_storage_buffer_binding_size, ), }; let (align, align_limit_name) = - binding_model::buffer_binding_type_alignment(limits, binding_ty); + binding_model::buffer_binding_type_alignment(&self.limits, binding_ty); if bb.offset % align as u64 != 0 { return Err(Error::UnalignedBufferOffset( bb.offset, @@ -2167,7 +2166,6 @@ impl Device { &mut dynamic_binding_info, &mut late_buffer_binding_sizes, &mut used, - &self.limits, &snatch_guard, )?; @@ -2189,7 +2187,6 @@ impl Device { &mut dynamic_binding_info, &mut late_buffer_binding_sizes, &mut used, - &self.limits, &snatch_guard, )?; hal_buffers.push(bb); @@ -3449,10 +3446,7 @@ impl Device { Ok(cache) } - fn get_texture_format_features( - &self, - format: TextureFormat, - ) -> wgt::TextureFormatFeatures { + fn get_texture_format_features(&self, format: TextureFormat) -> wgt::TextureFormatFeatures { // Variant of adapter.get_texture_format_features that takes device features into account use wgt::TextureFormatFeatureFlags as tfsc; let mut format_features = self.adapter.get_texture_format_features(format);