Fix implicit storage texture access

This commit is contained in:
Dzmitry Malyshau 2021-08-26 11:16:16 -04:00 committed by Dzmitry Malyshau
parent 2fbb71a6d7
commit 9666967daf

View File

@ -563,7 +563,7 @@ impl Resource {
multisampled: multi, multisampled: multi,
}, },
naga::ImageClass::Storage { format, .. } => BindingType::StorageTexture { naga::ImageClass::Storage { format, .. } => BindingType::StorageTexture {
access: if shader_usage == GlobalUse::WRITE || shader_usage.is_empty() { access: if !shader_usage.contains(GlobalUse::READ) {
wgt::StorageTextureAccess::WriteOnly wgt::StorageTextureAccess::WriteOnly
} else if !features } else if !features
.contains(wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES) .contains(wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES)
@ -571,10 +571,10 @@ impl Resource {
return Err(BindingError::UnsupportedTextureStorageAccess( return Err(BindingError::UnsupportedTextureStorageAccess(
shader_usage, shader_usage,
)); ));
} else if shader_usage == GlobalUse::READ { } else if shader_usage.contains(GlobalUse::WRITE) {
wgt::StorageTextureAccess::ReadOnly
} else {
wgt::StorageTextureAccess::ReadWrite wgt::StorageTextureAccess::ReadWrite
} else {
wgt::StorageTextureAccess::ReadOnly
}, },
view_dimension, view_dimension,
format: { format: {