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) {
|
for (const dawn_native::Adapter& adapter : adapters) {
|
||||||
if (adapter.GetBackendType() == backendType) {
|
if (adapter.GetBackendType() == backendType) {
|
||||||
|
if (adapter.GetDeviceType() == dawn_native::DeviceType::CPU) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter adapter by vendor id
|
||||||
if (HasVendorIdFilter()) {
|
if (HasVendorIdFilter()) {
|
||||||
if (adapter.GetPCIInfo().vendorId == GetVendorIdFilter()) {
|
if (adapter.GetPCIInfo().vendorId == GetVendorIdFilter()) {
|
||||||
mBackendAdapter = adapter;
|
mBackendAdapter = adapter;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
continue;
|
||||||
mBackendAdapter = adapter;
|
}
|
||||||
|
|
||||||
// On Metal, select the last adapter so that the discrete GPU is tested on
|
// Prefer discrete GPU on multi-GPU systems, otherwise get integrated GPU.
|
||||||
// multi-GPU systems.
|
mBackendAdapter = adapter;
|
||||||
// TODO(cwallez@chromium.org): Replace this with command line arguments
|
if (mBackendAdapter.GetDeviceType() == dawn_native::DeviceType::DiscreteGPU) {
|
||||||
// requesting a specific device / vendor ID once the macOS 10.13 SDK is rolled
|
break;
|
||||||
// and correct PCI info collection is implemented on Metal.
|
|
||||||
if (backendType != dawn_native::BackendType::Metal) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -484,6 +485,10 @@ bool DawnTestBase::EndExpectDeviceError() {
|
||||||
return mError;
|
return mError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dawn_native::PCIInfo DawnTestBase::GetPCIInfo() const {
|
||||||
|
return mPCIInfo;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void DawnTestBase::OnDeviceError(DawnErrorType type, const char* message, void* userdata) {
|
void DawnTestBase::OnDeviceError(DawnErrorType type, const char* message, void* userdata) {
|
||||||
ASSERT(type != DAWN_ERROR_TYPE_NO_ERROR);
|
ASSERT(type != DAWN_ERROR_TYPE_NO_ERROR);
|
||||||
|
|
|
@ -175,6 +175,8 @@ class DawnTestBase {
|
||||||
bool HasVendorIdFilter() const;
|
bool HasVendorIdFilter() const;
|
||||||
uint32_t GetVendorIdFilter() const;
|
uint32_t GetVendorIdFilter() const;
|
||||||
|
|
||||||
|
dawn_native::PCIInfo GetPCIInfo() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
dawn::Device device;
|
dawn::Device device;
|
||||||
dawn::Queue queue;
|
dawn::Queue queue;
|
||||||
|
|
|
@ -19,6 +19,13 @@
|
||||||
class BasicTests : public DawnTest {
|
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
|
// Test Buffer::SetSubData changes the content of the buffer, but really this is the most
|
||||||
// basic test possible, and tests the test harness
|
// basic test possible, and tests the test harness
|
||||||
TEST_P(BasicTests, BufferSetSubData) {
|
TEST_P(BasicTests, BufferSetSubData) {
|
||||||
|
|
Loading…
Reference in New Issue