Prioritize discrete GPU in end2end tests
- Prefer discrete GPU on multi-GPU systems, otherwise get integrated GPU. - Add a test to check adapter filter. BUG=dawn:184 Change-Id: Ib1c3e81e20a15aeaf18746892324ce5144b7fda1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9320 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
fd90d767ba
commit
c7d535bd72
|
@ -378,22 +378,23 @@ void DawnTestBase::SetUp() {
|
|||
|
||||
for (const dawn_native::Adapter& adapter : adapters) {
|
||||
if (adapter.GetBackendType() == backendType) {
|
||||
if (adapter.GetDeviceType() == dawn_native::DeviceType::CPU) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Filter adapter by vendor id
|
||||
if (HasVendorIdFilter()) {
|
||||
if (adapter.GetPCIInfo().vendorId == GetVendorIdFilter()) {
|
||||
mBackendAdapter = adapter;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
mBackendAdapter = adapter;
|
||||
|
||||
// On Metal, select the last adapter so that the discrete GPU is tested on
|
||||
// multi-GPU systems.
|
||||
// TODO(cwallez@chromium.org): Replace this with command line arguments
|
||||
// requesting a specific device / vendor ID once the macOS 10.13 SDK is rolled
|
||||
// and correct PCI info collection is implemented on Metal.
|
||||
if (backendType != dawn_native::BackendType::Metal) {
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Prefer discrete GPU on multi-GPU systems, otherwise get integrated GPU.
|
||||
mBackendAdapter = adapter;
|
||||
if (mBackendAdapter.GetDeviceType() == dawn_native::DeviceType::DiscreteGPU) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -484,6 +485,10 @@ bool DawnTestBase::EndExpectDeviceError() {
|
|||
return mError;
|
||||
}
|
||||
|
||||
dawn_native::PCIInfo DawnTestBase::GetPCIInfo() const {
|
||||
return mPCIInfo;
|
||||
}
|
||||
|
||||
// static
|
||||
void DawnTestBase::OnDeviceError(DawnErrorType type, const char* message, void* userdata) {
|
||||
ASSERT(type != DAWN_ERROR_TYPE_NO_ERROR);
|
||||
|
|
|
@ -175,6 +175,8 @@ class DawnTestBase {
|
|||
bool HasVendorIdFilter() const;
|
||||
uint32_t GetVendorIdFilter() const;
|
||||
|
||||
dawn_native::PCIInfo GetPCIInfo() const;
|
||||
|
||||
protected:
|
||||
dawn::Device device;
|
||||
dawn::Queue queue;
|
||||
|
|
|
@ -19,6 +19,13 @@
|
|||
class BasicTests : public DawnTest {
|
||||
};
|
||||
|
||||
// Test adapter filter by vendor id.
|
||||
TEST_P(BasicTests, VendorIdFilter) {
|
||||
DAWN_SKIP_TEST_IF(!HasVendorIdFilter());
|
||||
|
||||
ASSERT_EQ(GetPCIInfo().vendorId, GetVendorIdFilter());
|
||||
}
|
||||
|
||||
// Test Buffer::SetSubData changes the content of the buffer, but really this is the most
|
||||
// basic test possible, and tests the test harness
|
||||
TEST_P(BasicTests, BufferSetSubData) {
|
||||
|
|
Loading…
Reference in New Issue