From 7e369fdd573f2d6f46cbe60357eea8c702ce094f Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Mon, 4 Jul 2022 17:37:19 -0400 Subject: [PATCH] Fix texture multi-sample-ability check with TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES --- wgpu-core/src/device/mod.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index cf95f61b8b..68a012eced 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -751,6 +751,10 @@ impl Device { } } + let format_features = self + .describe_format_features(adapter, desc.format) + .map_err(|error| CreateTextureError::MissingFeatures(desc.format, error))?; + if desc.sample_count > 1 { if desc.mip_level_count != 1 { return Err(CreateTextureError::InvalidMipLevelCount { @@ -775,8 +779,7 @@ impl Device { return Err(CreateTextureError::MultisampledNotRenderAttachment); } - if !format_desc - .guaranteed_format_features + if !format_features .flags .contains(wgt::TextureFormatFeatureFlags::MULTISAMPLE) { @@ -793,10 +796,6 @@ impl Device { }); } - let format_features = self - .describe_format_features(adapter, desc.format) - .map_err(|error| CreateTextureError::MissingFeatures(desc.format, error))?; - let missing_allowed_usages = desc.usage - format_features.allowed_usages; if !missing_allowed_usages.is_empty() { return Err(CreateTextureError::InvalidFormatUsages(