Remove dawn::native::Instance::GetFeatureInfo
In favor of dawn::native::GetFeatureInfo that doesn't need an instance
to be created.
Bug: None
Change-Id: Ibf27c7b68516a8fe25099cf86489159ce621b276
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/166145
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/include/dawn/native/DawnNative.h b/include/dawn/native/DawnNative.h
index a11283d..4b4c147 100644
--- a/include/dawn/native/DawnNative.h
+++ b/include/dawn/native/DawnNative.h
@@ -171,7 +171,6 @@
const wgpu::RequestAdapterOptions* options = nullptr) const;
const ToggleInfo* GetToggleInfo(const char* toggleName);
- const FeatureInfo* GetFeatureInfo(WGPUFeatureName feature);
// Enables backend validation layers
void EnableBackendValidation(bool enableBackendValidation);
diff --git a/src/dawn/native/CommandValidation.cpp b/src/dawn/native/CommandValidation.cpp
index 38af679..ea5d05b 100644
--- a/src/dawn/native/CommandValidation.cpp
+++ b/src/dawn/native/CommandValidation.cpp
@@ -98,10 +98,9 @@
Feature requiredFeature) {
DAWN_TRY(device->ValidateObject(querySet));
- DAWN_INVALID_IF(
- !device->HasFeature(requiredFeature),
- "Timestamp queries used without the %s feature enabled.",
- device->GetPhysicalDevice()->GetInstance()->GetFeatureInfo(ToAPI(requiredFeature))->name);
+ DAWN_INVALID_IF(!device->HasFeature(requiredFeature),
+ "Timestamp queries used without the %s feature enabled.",
+ ToAPI(requiredFeature));
DAWN_INVALID_IF(querySet->GetQueryType() != wgpu::QueryType::Timestamp,
"The type of %s is not %s.", querySet, wgpu::QueryType::Timestamp);
diff --git a/src/dawn/native/DawnNative.cpp b/src/dawn/native/DawnNative.cpp
index 4ea32c5..0ba5011 100644
--- a/src/dawn/native/DawnNative.cpp
+++ b/src/dawn/native/DawnNative.cpp
@@ -189,10 +189,6 @@
return mImpl->GetToggleInfo(toggleName);
}
-const FeatureInfo* Instance::GetFeatureInfo(WGPUFeatureName feature) {
- return mImpl->GetFeatureInfo(static_cast<wgpu::FeatureName>(feature));
-}
-
void Instance::EnableBackendValidation(bool enableBackendValidation) {
if (enableBackendValidation) {
mImpl->SetBackendValidationLevel(BackendValidationLevel::Full);
diff --git a/src/dawn/native/Instance.cpp b/src/dawn/native/Instance.cpp
index 38d4e9d..eeeaf32 100644
--- a/src/dawn/native/Instance.cpp
+++ b/src/dawn/native/Instance.cpp
@@ -352,10 +352,6 @@
return mTogglesInfo.ToggleNameToEnum(toggleName);
}
-const FeatureInfo* InstanceBase::GetFeatureInfo(wgpu::FeatureName feature) {
- return dawn::native::GetFeatureInfo(feature);
-}
-
std::vector<Ref<AdapterBase>> InstanceBase::EnumerateAdapters(
const RequestAdapterOptions* options) {
static constexpr RequestAdapterOptions kDefaultOptions = {};
diff --git a/src/dawn/native/Instance.h b/src/dawn/native/Instance.h
index 8e0b01d..f243abb 100644
--- a/src/dawn/native/Instance.h
+++ b/src/dawn/native/Instance.h
@@ -124,10 +124,6 @@
const ToggleInfo* GetToggleInfo(const char* toggleName);
Toggle ToggleNameToEnum(const char* toggleName);
- // Used to query the details of an feature. Return nullptr if featureName is not a valid
- // name of an feature supported in Dawn.
- const FeatureInfo* GetFeatureInfo(wgpu::FeatureName feature);
-
// TODO(dawn:2166): Move this method to PhysicalDevice to better detect that the backend
// validation is actually enabled or not when a physical device is created. Sometimes it is
// enabled externally via command line or environment variables.
diff --git a/src/dawn/native/PhysicalDevice.cpp b/src/dawn/native/PhysicalDevice.cpp
index 1a153c5..6f8bd55 100644
--- a/src/dawn/native/PhysicalDevice.cpp
+++ b/src/dawn/native/PhysicalDevice.cpp
@@ -177,7 +177,7 @@
absl::StrFormat("Requested feature %s is not supported.", feature));
}
- const FeatureInfo* featureInfo = GetInstance()->GetFeatureInfo(feature);
+ const FeatureInfo* featureInfo = GetFeatureInfo(feature);
// Experimental features are guarded by the AllowUnsafeAPIs toggle.
if (featureInfo->featureState == FeatureInfo::FeatureState::Experimental) {
// AllowUnsafeAPIs toggle is by default disabled if not explicitly enabled.
diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
index 1e02b79..cedf13a 100644
--- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
+++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
@@ -402,8 +402,7 @@
case wgpu::FeatureName::ShaderF16:
case wgpu::FeatureName::ChromiumExperimentalSubgroups:
return FeatureValidationResult(
- absl::StrFormat("Feature %s requires DXC for D3D12.",
- GetInstance()->GetFeatureInfo(feature)->name));
+ absl::StrFormat("Feature %s requires DXC for D3D12.", feature));
default:
break;
}
@@ -413,9 +412,8 @@
// The feature `shader-f16` requires using shader model 6.2 or higher.
case wgpu::FeatureName::ShaderF16: {
if (!(GetAppliedShaderModelUnderToggles(toggles) >= 62)) {
- return FeatureValidationResult(
- absl::StrFormat("Feature %s requires shader model 6.2 or higher for D3D12.",
- GetInstance()->GetFeatureInfo(feature)->name));
+ return FeatureValidationResult(absl::StrFormat(
+ "Feature %s requires shader model 6.2 or higher for D3D12.", feature));
}
break;
}