Skip to content

Commit de7765b

Browse files
jimblandyErichDonGubler
authored andcommitted
[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.
1 parent 9ebc50f commit de7765b

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

wgpu-core/src/device/resource.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,6 @@ impl Device {
18901890
dynamic_binding_info: &mut Vec<binding_model::BindGroupDynamicBindingData>,
18911891
late_buffer_binding_sizes: &mut FastHashMap<u32, wgt::BufferSize>,
18921892
used: &mut BindGroupStates,
1893-
limits: &wgt::Limits,
18941893
snatch_guard: &'a SnatchGuard<'a>,
18951894
) -> Result<hal::BufferBinding<'a, dyn hal::DynBuffer>, binding_model::CreateBindGroupError>
18961895
{
@@ -1915,7 +1914,7 @@ impl Device {
19151914
wgt::BufferBindingType::Uniform => (
19161915
wgt::BufferUsages::UNIFORM,
19171916
hal::BufferUses::UNIFORM,
1918-
limits.max_uniform_buffer_binding_size,
1917+
self.limits.max_uniform_buffer_binding_size,
19191918
),
19201919
wgt::BufferBindingType::Storage { read_only } => (
19211920
wgt::BufferUsages::STORAGE,
@@ -1924,12 +1923,12 @@ impl Device {
19241923
} else {
19251924
hal::BufferUses::STORAGE_READ_WRITE
19261925
},
1927-
limits.max_storage_buffer_binding_size,
1926+
self.limits.max_storage_buffer_binding_size,
19281927
),
19291928
};
19301929

19311930
let (align, align_limit_name) =
1932-
binding_model::buffer_binding_type_alignment(limits, binding_ty);
1931+
binding_model::buffer_binding_type_alignment(&self.limits, binding_ty);
19331932
if bb.offset % align as u64 != 0 {
19341933
return Err(Error::UnalignedBufferOffset(
19351934
bb.offset,
@@ -2167,7 +2166,6 @@ impl Device {
21672166
&mut dynamic_binding_info,
21682167
&mut late_buffer_binding_sizes,
21692168
&mut used,
2170-
&self.limits,
21712169
&snatch_guard,
21722170
)?;
21732171

@@ -2189,7 +2187,6 @@ impl Device {
21892187
&mut dynamic_binding_info,
21902188
&mut late_buffer_binding_sizes,
21912189
&mut used,
2192-
&self.limits,
21932190
&snatch_guard,
21942191
)?;
21952192
hal_buffers.push(bb);
@@ -3449,10 +3446,7 @@ impl Device {
34493446
Ok(cache)
34503447
}
34513448

3452-
fn get_texture_format_features(
3453-
&self,
3454-
format: TextureFormat,
3455-
) -> wgt::TextureFormatFeatures {
3449+
fn get_texture_format_features(&self, format: TextureFormat) -> wgt::TextureFormatFeatures {
34563450
// Variant of adapter.get_texture_format_features that takes device features into account
34573451
use wgt::TextureFormatFeatureFlags as tfsc;
34583452
let mut format_features = self.adapter.get_texture_format_features(format);

0 commit comments

Comments
 (0)