mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 17:05:31 +00:00
Enable the optional feature bgra8unorm-storage on Metal
This patch adds the support of the optional feature "bgra8unorm-storage" and enable it on Metal. Bug: dawn:1641 Test: dawn_end2end_tests Change-Id: Id58cefd8735f46b8d1807376ebcfada10df2890e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111380 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
36c17a9ff0
commit
f5cee3fadf
@@ -79,6 +79,9 @@ static constexpr FeatureEnumAndInfoList kFeatureNameAndInfoList = {{
|
||||
"Allows the RENDER_ATTACHMENT usage on textures with format \"rg11b10ufloat\", and also "
|
||||
"allows textures of that format to be multisampled.",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=1518", FeatureInfo::FeatureState::Stable}},
|
||||
{Feature::BGRA8UnormStorage,
|
||||
{"bgra8unorm-storage", "Allows the STORAGE usage on textures with format \"bgra8unorm\".",
|
||||
"https://bugs.chromium.org/p/dawn/issues/detail?id=1591", FeatureInfo::FeatureState::Stable}},
|
||||
{Feature::DawnInternalUsages,
|
||||
{"dawn-internal-usages",
|
||||
"Add internal usages to resources to affect how the texture is allocated, but not "
|
||||
@@ -134,6 +137,8 @@ Feature FromAPIFeature(wgpu::FeatureName feature) {
|
||||
return Feature::ShaderF16;
|
||||
case wgpu::FeatureName::RG11B10UfloatRenderable:
|
||||
return Feature::RG11B10UfloatRenderable;
|
||||
case wgpu::FeatureName::BGRA8UnormStorage:
|
||||
return Feature::BGRA8UnormStorage;
|
||||
}
|
||||
return Feature::InvalidEnum;
|
||||
}
|
||||
@@ -170,6 +175,8 @@ wgpu::FeatureName ToAPIFeature(Feature feature) {
|
||||
return wgpu::FeatureName::ShaderF16;
|
||||
case Feature::RG11B10UfloatRenderable:
|
||||
return wgpu::FeatureName::RG11B10UfloatRenderable;
|
||||
case Feature::BGRA8UnormStorage:
|
||||
return wgpu::FeatureName::BGRA8UnormStorage;
|
||||
|
||||
case Feature::EnumCount:
|
||||
break;
|
||||
|
||||
@@ -39,6 +39,7 @@ enum class Feature {
|
||||
IndirectFirstInstance,
|
||||
ShaderF16,
|
||||
RG11B10UfloatRenderable,
|
||||
BGRA8UnormStorage,
|
||||
|
||||
// Dawn-specific
|
||||
DawnInternalUsages,
|
||||
|
||||
@@ -368,7 +368,9 @@ FormatTable BuildFormatTable(const DeviceBase* device) {
|
||||
AddColorFormat(wgpu::TextureFormat::RGBA8Snorm, false, true, false, false, 4, kAnyFloat, 4);
|
||||
AddColorFormat(wgpu::TextureFormat::RGBA8Uint, true, true, true, false, 4, SampleTypeBit::Uint, 4, 4, 1);
|
||||
AddColorFormat(wgpu::TextureFormat::RGBA8Sint, true, true, true, false, 4, SampleTypeBit::Sint, 4, 4, 1);
|
||||
AddColorFormat(wgpu::TextureFormat::BGRA8Unorm, true, false, true, true, 4, kAnyFloat, 4, 8, 1);
|
||||
|
||||
bool BGRA8UnormSupportsStorageUsage = device->HasFeature(Feature::BGRA8UnormStorage);
|
||||
AddColorFormat(wgpu::TextureFormat::BGRA8Unorm, true, BGRA8UnormSupportsStorageUsage, true, true, 4, kAnyFloat, 4, 8, 1);
|
||||
AddColorFormat(wgpu::TextureFormat::BGRA8UnormSrgb, true, false, true, true, 4, kAnyFloat, 4, 8, 1, wgpu::TextureFormat::BGRA8Unorm);
|
||||
AddColorFormat(wgpu::TextureFormat::RGB10A2Unorm, true, false, true, true, 4, kAnyFloat, 4, 8, 4);
|
||||
|
||||
|
||||
@@ -730,8 +730,10 @@ ResultOrError<std::unique_ptr<EntryPointMetadata>> ReflectEntryPointUsingTint(
|
||||
info.storageTexture.viewDimension =
|
||||
TintTextureDimensionToTextureViewDimension(resource.dim);
|
||||
|
||||
DAWN_INVALID_IF(info.storageTexture.format == wgpu::TextureFormat::BGRA8Unorm,
|
||||
"BGRA8Unorm storage textures are not yet supported.");
|
||||
DAWN_INVALID_IF(info.storageTexture.format == wgpu::TextureFormat::BGRA8Unorm &&
|
||||
!device->HasFeature(Feature::BGRA8UnormStorage),
|
||||
"BGRA8Unorm storage textures are not supported if optional feature "
|
||||
"bgra8unorm-storage is not supported.");
|
||||
|
||||
break;
|
||||
case BindingInfoType::ExternalTexture:
|
||||
|
||||
@@ -512,6 +512,7 @@ class Adapter : public AdapterBase {
|
||||
mSupportedFeatures.EnableFeature(Feature::IndirectFirstInstance);
|
||||
mSupportedFeatures.EnableFeature(Feature::ShaderF16);
|
||||
mSupportedFeatures.EnableFeature(Feature::RG11B10UfloatRenderable);
|
||||
mSupportedFeatures.EnableFeature(Feature::BGRA8UnormStorage);
|
||||
}
|
||||
|
||||
void InitializeVendorArchitectureImpl() override {
|
||||
|
||||
Reference in New Issue
Block a user