Remove legacy adapter info compatibilityMode and featureLevel
Bug: 366151404 , 395855516 , 395855517
Change-Id: I4d0f73d616bece51a53a60176ee108c0ff06766b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/228414
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Shrek Shao <shrekshao@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json
index e4cee37..5f468fd 100644
--- a/src/dawn/dawn.json
+++ b/src/dawn/dawn.json
@@ -191,8 +191,7 @@
{"name": "vendor ID", "type": "uint32_t"},
{"name": "device ID", "type": "uint32_t"},
{"name": "subgroup min size", "type": "uint32_t"},
- {"name": "subgroup max size", "type": "uint32_t"},
- {"name": "compatibility mode", "type": "bool", "default": "false", "tags": ["dawn", "emscripten"]}
+ {"name": "subgroup max size", "type": "uint32_t"}
]
},
"adapter type": {
diff --git a/src/dawn/native/Adapter.cpp b/src/dawn/native/Adapter.cpp
index db5eed5..c63acb2 100644
--- a/src/dawn/native/Adapter.cpp
+++ b/src/dawn/native/Adapter.cpp
@@ -262,7 +262,6 @@
info->deviceID = mPhysicalDevice->GetDeviceId();
info->subgroupMinSize = mPhysicalDevice->GetSubgroupMinSize();
info->subgroupMaxSize = mPhysicalDevice->GetSubgroupMaxSize();
- info->compatibilityMode = mFeatureLevel == wgpu::FeatureLevel::Compatibility;
if (mPhysicalDevice->GetBackendType() == wgpu::BackendType::D3D12 &&
mTogglesState.IsEnabled(Toggle::D3D12RelaxMinSubgroupSizeTo8)) {
diff --git a/src/dawn/node/binding/GPUAdapter.cpp b/src/dawn/node/binding/GPUAdapter.cpp
index 8281412..65e2360 100644
--- a/src/dawn/node/binding/GPUAdapter.cpp
+++ b/src/dawn/node/binding/GPUAdapter.cpp
@@ -139,22 +139,6 @@
return adapterInfo.adapterType == wgpu::AdapterType::CPU;
}
-bool GPUAdapter::getIsCompatibilityMode(Napi::Env) {
- wgpu::AdapterInfo adapterInfo = {};
- adapter_.GetInfo(&adapterInfo);
- return adapterInfo.compatibilityMode;
-}
-
-std::string GPUAdapter::getFeatureLevel(Napi::Env) {
- wgpu::AdapterInfo adapterInfo = {};
- // TODO(crbug.com/382291443): Report feature level from wgpu::Adapter.
- adapter_.GetInfo(&adapterInfo);
- if (adapterInfo.compatibilityMode) {
- return "compatibility";
- }
- return "core";
-}
-
namespace {
// Returns a string representation of the wgpu::ErrorType
const char* str(wgpu::ErrorType ty) {
diff --git a/src/dawn/node/binding/GPUAdapter.h b/src/dawn/node/binding/GPUAdapter.h
index efffbe6..1d88a92 100644
--- a/src/dawn/node/binding/GPUAdapter.h
+++ b/src/dawn/node/binding/GPUAdapter.h
@@ -53,8 +53,6 @@
interop::Interface<interop::GPUSupportedLimits> getLimits(Napi::Env) override;
interop::Interface<interop::GPUAdapterInfo> getInfo(Napi::Env) override;
bool getIsFallbackAdapter(Napi::Env) override;
- bool getIsCompatibilityMode(Napi::Env) override;
- std::string getFeatureLevel(Napi::Env) override;
private:
wgpu::Adapter adapter_;
diff --git a/src/dawn/node/interop/DawnExtensions.idl b/src/dawn/node/interop/DawnExtensions.idl
index 4c4e3ed..39ed74a 100644
--- a/src/dawn/node/interop/DawnExtensions.idl
+++ b/src/dawn/node/interop/DawnExtensions.idl
@@ -35,11 +35,6 @@
"core-features-and-limits",
};
-interface GPUAdapter {
- readonly attribute boolean isCompatibilityMode;
- readonly attribute DOMString featureLevel;
-};
-
enum GPUSubgroupMatrixComponentType {
"f32",
"f16",
diff --git a/src/dawn/tests/AdapterTestConfig.cpp b/src/dawn/tests/AdapterTestConfig.cpp
index 04796ef..22ecd3b 100644
--- a/src/dawn/tests/AdapterTestConfig.cpp
+++ b/src/dawn/tests/AdapterTestConfig.cpp
@@ -85,7 +85,9 @@
forceDisabledWorkarounds);
}
-TestAdapterProperties::TestAdapterProperties(const wgpu::AdapterInfo& info, bool selected)
+TestAdapterProperties::TestAdapterProperties(const wgpu::AdapterInfo& info,
+ bool selected,
+ bool compatibilityMode)
: vendorID(info.vendorID),
vendorName(info.vendor),
architecture(info.architecture),
@@ -94,7 +96,7 @@
driverDescription(info.description),
adapterType(info.adapterType),
backendType(info.backendType),
- compatibilityMode(info.compatibilityMode),
+ compatibilityMode(compatibilityMode),
selected(selected) {}
std::string TestAdapterProperties::ParamName() const {
diff --git a/src/dawn/tests/AdapterTestConfig.h b/src/dawn/tests/AdapterTestConfig.h
index 44a2c2a..3295815 100644
--- a/src/dawn/tests/AdapterTestConfig.h
+++ b/src/dawn/tests/AdapterTestConfig.h
@@ -48,7 +48,7 @@
};
struct TestAdapterProperties {
- TestAdapterProperties(const wgpu::AdapterInfo& info, bool selected);
+ TestAdapterProperties(const wgpu::AdapterInfo& info, bool selected, bool compatibilityMode);
uint32_t vendorID;
std::string vendorName;
std::string architecture;
diff --git a/src/dawn/tests/DawnTest.cpp b/src/dawn/tests/DawnTest.cpp
index 582f0f6..7c68ce0 100644
--- a/src/dawn/tests/DawnTest.cpp
+++ b/src/dawn/tests/DawnTest.cpp
@@ -488,7 +488,9 @@
// Skip non-OpenGLES/D3D11 compat adapters. Metal/Vulkan/D3D12 support
// core WebGPU.
- if (info.compatibilityMode && info.backendType != wgpu::BackendType::OpenGLES &&
+ bool isDefaultingCompatibilityMode =
+ !adapter.HasFeature(wgpu::FeatureName::CoreFeaturesAndLimits);
+ if (isDefaultingCompatibilityMode && info.backendType != wgpu::BackendType::OpenGLES &&
info.backendType != wgpu::BackendType::D3D11) {
continue;
}
@@ -532,11 +534,11 @@
// In Windows Remote Desktop sessions we may be able to discover multiple adapters that
// have the same name and backend type. We will just choose one adapter from them in our
// tests.
- const auto adapterTypeAndName =
- std::tuple(info.backendType, std::string(info.device), info.compatibilityMode);
+ const auto adapterTypeAndName = std::tuple(info.backendType, std::string(info.device),
+ isDefaultingCompatibilityMode);
if (adapterNameSet.find(adapterTypeAndName) == adapterNameSet.end()) {
adapterNameSet.insert(adapterTypeAndName);
- mAdapterProperties.emplace_back(info, selected);
+ mAdapterProperties.emplace_back(info, selected, isDefaultingCompatibilityMode);
}
}
}
diff --git a/src/dawn/tests/end2end/AdapterCreationTests.cpp b/src/dawn/tests/end2end/AdapterCreationTests.cpp
index 3fd5908..75f6509 100644
--- a/src/dawn/tests/end2end/AdapterCreationTests.cpp
+++ b/src/dawn/tests/end2end/AdapterCreationTests.cpp
@@ -70,7 +70,7 @@
wgpu::AdapterInfo info;
wgpu::Adapter adapter = wgpu::Adapter(nativeAdapter.Get());
adapter.GetInfo(&info);
- if (info.compatibilityMode) {
+ if (!adapter.HasFeature(wgpu::FeatureName::CoreFeaturesAndLimits)) {
continue;
}
swiftShaderAvailable |= gpu_info::IsGoogleSwiftshader(info.vendorID, info.deviceID);
@@ -133,7 +133,7 @@
wgpu::AdapterInfo info;
adapter.GetInfo(&info);
- EXPECT_FALSE(info.compatibilityMode);
+ EXPECT_TRUE(adapter.HasFeature(wgpu::FeatureName::CoreFeaturesAndLimits));
}
// Test that passing nullptr for the options gets the default adapter
@@ -236,9 +236,6 @@
RequestAdapter(instance, &options);
EXPECT_EQ(adapter != nullptr, anyAdapterAvailable);
- wgpu::AdapterInfo info;
- adapter.GetInfo(&info);
- EXPECT_TRUE(info.compatibilityMode);
}
// Test that GetInstance() returns the correct Instance.
@@ -311,7 +308,6 @@
wgpu::AdapterType adapterType = info1.adapterType;
uint32_t vendorID = info1.vendorID;
uint32_t deviceID = info1.deviceID;
- bool compatibilityMode = info1.compatibilityMode;
info2 = std::move(info1);
@@ -324,7 +320,6 @@
EXPECT_EQ(info2.adapterType, adapterType);
EXPECT_EQ(info2.vendorID, vendorID);
EXPECT_EQ(info2.deviceID, deviceID);
- EXPECT_EQ(info2.compatibilityMode, compatibilityMode);
// Expect info1 to be empty.
EXPECT_EQ(info1.vendor.data, nullptr);
@@ -339,7 +334,6 @@
EXPECT_EQ(info1.adapterType, static_cast<wgpu::AdapterType>(0));
EXPECT_EQ(info1.vendorID, 0u);
EXPECT_EQ(info1.deviceID, 0u);
- EXPECT_EQ(info1.compatibilityMode, false);
}
// Test move construction of the adapter info.
@@ -367,7 +361,6 @@
wgpu::AdapterType adapterType = info1.adapterType;
uint32_t vendorID = info1.vendorID;
uint32_t deviceID = info1.deviceID;
- bool compatibilityMode = info1.compatibilityMode;
wgpu::AdapterInfo info2(std::move(info1));
@@ -380,7 +373,6 @@
EXPECT_EQ(info2.adapterType, adapterType);
EXPECT_EQ(info2.vendorID, vendorID);
EXPECT_EQ(info2.deviceID, deviceID);
- EXPECT_EQ(info2.compatibilityMode, compatibilityMode);
// Expect info1 to be empty.
EXPECT_EQ(info1.vendor.data, nullptr);
@@ -395,7 +387,6 @@
EXPECT_EQ(info1.adapterType, static_cast<wgpu::AdapterType>(0));
EXPECT_EQ(info1.vendorID, 0u);
EXPECT_EQ(info1.deviceID, 0u);
- EXPECT_EQ(info1.compatibilityMode, false);
}
// Test that the adapter info can outlive the adapter.
diff --git a/src/dawn/tests/end2end/AdapterEnumerationTests.cpp b/src/dawn/tests/end2end/AdapterEnumerationTests.cpp
index f9d78aa..59cbd4b 100644
--- a/src/dawn/tests/end2end/AdapterEnumerationTests.cpp
+++ b/src/dawn/tests/end2end/AdapterEnumerationTests.cpp
@@ -171,7 +171,6 @@
EXPECT_EQ(info.adapterType, infoAgain.adapterType);
EXPECT_EQ(info.vendorID, infoAgain.vendorID);
EXPECT_EQ(info.deviceID, infoAgain.deviceID);
- EXPECT_EQ(info.compatibilityMode, infoAgain.compatibilityMode);
}
}
#endif // defined(DAWN_ENABLE_BACKEND_D3D11)
@@ -248,7 +247,6 @@
EXPECT_EQ(info.adapterType, infoAgain.adapterType);
EXPECT_EQ(info.vendorID, infoAgain.vendorID);
EXPECT_EQ(info.deviceID, infoAgain.deviceID);
- EXPECT_EQ(info.compatibilityMode, infoAgain.compatibilityMode);
}
}
#endif // defined(DAWN_ENABLE_BACKEND_D3D12)