diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 9bef06da55..d52ab168b2 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -1262,6 +1262,16 @@ impl Global { let device = device_guard .get(device_id) .map_err(|_| DeviceError::Invalid)?; + + let texture_features = conv::texture_features(desc.format); + if texture_features != wgt::Features::empty() && !device.features.contains(texture_features) + { + return Err(resource::CreateTextureError::MissingFeature( + texture_features, + desc.format, + )); + } + let texture = device.create_texture(device_id, desc)?; let num_levels = texture.full_range.levels.end; let num_layers = texture.full_range.layers.end; @@ -1276,15 +1286,6 @@ impl Global { None => (), }; - let texture_features = conv::texture_features(desc.format); - if texture_features != wgt::Features::empty() && !device.features.contains(texture_features) - { - return Err(resource::CreateTextureError::MissingFeature( - texture_features, - desc.format, - )); - } - device .trackers .lock()