mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
allow read-write and read-only storage textures without TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES (#7623)
This commit is contained in:
parent
1806414771
commit
195217b269
@ -2,9 +2,9 @@ use std::time::Duration;
|
||||
use wgpu::wgt::BufferDescriptor;
|
||||
use wgpu::{
|
||||
include_wgsl, BindGroupDescriptor, BindGroupEntry, BindingResource, BufferUsages,
|
||||
ComputePassDescriptor, ComputePipelineDescriptor, DownlevelFlags, Extent3d, Features, MapMode,
|
||||
Origin3d, PollType, TexelCopyBufferInfo, TexelCopyBufferLayout, TexelCopyTextureInfo,
|
||||
TextureAspect, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages,
|
||||
ComputePassDescriptor, ComputePipelineDescriptor, DownlevelFlags, Extent3d, MapMode, Origin3d,
|
||||
PollType, TexelCopyBufferInfo, TexelCopyBufferLayout, TexelCopyTextureInfo, TextureAspect,
|
||||
TextureDescriptor, TextureDimension, TextureFormat, TextureUsages,
|
||||
};
|
||||
use wgpu_macros::gpu_test;
|
||||
use wgpu_test::{GpuTestConfiguration, TestParameters, TestingContext};
|
||||
@ -14,8 +14,7 @@ static TEXTURE_BINDING: GpuTestConfiguration = GpuTestConfiguration::new()
|
||||
.parameters(
|
||||
TestParameters::default()
|
||||
.test_features_limits()
|
||||
.downlevel_flags(DownlevelFlags::WEBGPU_TEXTURE_FORMAT_SUPPORT)
|
||||
.features(Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES),
|
||||
.downlevel_flags(DownlevelFlags::WEBGPU_TEXTURE_FORMAT_SUPPORT),
|
||||
)
|
||||
.run_sync(texture_binding);
|
||||
|
||||
@ -71,8 +70,7 @@ static SINGLE_SCALAR_LOAD: GpuTestConfiguration = GpuTestConfiguration::new()
|
||||
.parameters(
|
||||
TestParameters::default()
|
||||
.test_features_limits()
|
||||
.downlevel_flags(DownlevelFlags::WEBGPU_TEXTURE_FORMAT_SUPPORT)
|
||||
.features(Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES),
|
||||
.downlevel_flags(DownlevelFlags::WEBGPU_TEXTURE_FORMAT_SUPPORT),
|
||||
)
|
||||
.run_sync(single_scalar_load);
|
||||
|
||||
|
||||
@ -37,8 +37,6 @@ use crate::{
|
||||
pub enum BindGroupLayoutEntryError {
|
||||
#[error("Cube dimension is not expected for texture storage")]
|
||||
StorageTextureCube,
|
||||
#[error("Read-write and read-only storage textures are not allowed by baseline webgpu, they require the native only feature TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES")]
|
||||
StorageTextureReadWrite,
|
||||
#[error("Atomic storage textures are not allowed by baseline webgpu, they require the native only feature TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES")]
|
||||
StorageTextureAtomic,
|
||||
#[error("Arrays of bindings unsupported for this type of binding")]
|
||||
|
||||
@ -1989,17 +1989,6 @@ impl Device {
|
||||
error: BindGroupLayoutEntryError::StorageTextureAtomic,
|
||||
});
|
||||
}
|
||||
wgt::StorageTextureAccess::ReadOnly
|
||||
| wgt::StorageTextureAccess::ReadWrite
|
||||
if !self.features.contains(
|
||||
wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES,
|
||||
) =>
|
||||
{
|
||||
return Err(binding_model::CreateBindGroupLayoutError::Entry {
|
||||
binding: entry.binding,
|
||||
error: BindGroupLayoutEntryError::StorageTextureReadWrite,
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
(
|
||||
@ -2009,16 +1998,8 @@ impl Device {
|
||||
),
|
||||
match access {
|
||||
wgt::StorageTextureAccess::WriteOnly => WritableStorage::Yes,
|
||||
wgt::StorageTextureAccess::ReadOnly => {
|
||||
required_features |=
|
||||
wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES;
|
||||
WritableStorage::No
|
||||
}
|
||||
wgt::StorageTextureAccess::ReadWrite => {
|
||||
required_features |=
|
||||
wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES;
|
||||
WritableStorage::Yes
|
||||
}
|
||||
wgt::StorageTextureAccess::ReadOnly => WritableStorage::No,
|
||||
wgt::StorageTextureAccess::ReadWrite => WritableStorage::Yes,
|
||||
wgt::StorageTextureAccess::Atomic => {
|
||||
required_features |= wgt::Features::TEXTURE_ATOMIC;
|
||||
WritableStorage::Yes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user