Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1431,11 +1431,10 @@ impl Device {
});
}

if desc.size.depth_or_array_layers != 1 {
return Err(CreateTextureError::InvalidDimension(
TextureDimensionError::MultisampledDepthOrArrayLayer(
desc.size.depth_or_array_layers,
),
if desc.dimension != wgt::TextureDimension::D2 {
return Err(CreateTextureError::InvalidMultisampledDimension(
desc.dimension,
desc.sample_count,
));
}

Expand Down
9 changes: 6 additions & 3 deletions wgpu-core/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1551,8 +1551,6 @@ pub enum TextureDimensionError {
multiple: u32,
format: wgt::TextureFormat,
},
#[error("Multisampled texture depth or array layers must be 1, got {0}")]
MultisampledDepthOrArrayLayer(u32),
}

impl WebGpuError for TextureDimensionError {
Expand Down Expand Up @@ -1597,6 +1595,10 @@ pub enum CreateTextureError {
InvalidMultisampledFormat(wgt::TextureFormat),
#[error("Sample count {0} is not supported by format {1:?} on this device. The WebGPU spec guarantees {2:?} samples are supported by this format. With the TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES feature your device supports {3:?}.")]
InvalidSampleCount(u32, wgt::TextureFormat, Vec<u32>, Vec<u32>),
#[error(
"Textures of dimension {0:?} cannot be multisampled, but the multisample count is {1}"
)]
InvalidMultisampledDimension(wgt::TextureDimension, u32),
#[error("Multisampled textures must have RENDER_ATTACHMENT usage")]
MultisampledNotRenderAttachment,
#[error("Texture format {0:?} can't be used due to missing features")]
Expand Down Expand Up @@ -1637,7 +1639,8 @@ impl WebGpuError for CreateTextureError {
| Self::InvalidMultisampledStorageBinding
| Self::InvalidMultisampledFormat(_)
| Self::InvalidSampleCount(..)
| Self::MultisampledNotRenderAttachment => return ErrorType::Validation,
| Self::MultisampledNotRenderAttachment
| Self::InvalidMultisampledDimension(..) => return ErrorType::Validation,
};
e.webgpu_error_type()
}
Expand Down