Detect integrated device type on Intel iGPUs.

Fix to prevent incorrectly reporting the device type.

BUG=dawn:144

Change-Id: Ie1956d908b20649787aef785cd29f0f63f524431
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6980
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
This commit is contained in:
Bryan Bernhart 2019-05-10 02:18:49 +00:00 committed by Commit Bot service account
parent 974a150327
commit efef0e4b1f
3 changed files with 25 additions and 9 deletions

View File

@ -38,4 +38,11 @@ static constexpr uint32_t kTextureRowPitchAlignment = 256u;
static constexpr float kLodMin = 0.0;
static constexpr float kLodMax = 1000.0;
static constexpr uint32_t kVendorID_AMD = 0x1002;
static constexpr uint32_t kVendorID_ARM = 0x13B5;
static constexpr uint32_t kVendorID_ImgTec = 0x1010;
static constexpr uint32_t kVendorID_Intel = 0x8086;
static constexpr uint32_t kVendorID_Nvidia = 0x10DE;
static constexpr uint32_t kVendorID_Qualcomm = 0x5143;
#endif // COMMON_CONSTANTS_H_

View File

@ -14,6 +14,7 @@
#include "dawn_native/d3d12/AdapterD3D12.h"
#include "common/Constants.h"
#include "dawn_native/d3d12/BackendD3D12.h"
#include "dawn_native/d3d12/DeviceD3D12.h"
#include "dawn_native/d3d12/PlatformFunctions.h"
@ -46,8 +47,23 @@ namespace dawn_native { namespace d3d12 {
if (adapterDesc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) {
mDeviceType = DeviceType::CPU;
} else {
// TODO(cwallez@chromium.org): properly detect integrated vs. discrete.
mDeviceType = DeviceType::DiscreteGPU;
// Using DXGI_ADAPTER_DESC1 approach to determine integrated vs dedicated is
// vendor-specific.
switch (mPCIInfo.vendorId) {
case kVendorID_Intel: {
// On Intel GPUs, dedicated video memory is always set to 128MB when the GPU is
// integrated.
static constexpr uint64_t kDedicatedVideoMemory = 128 * 1024 * 1024;
mDeviceType = (adapterDesc.DedicatedVideoMemory == kDedicatedVideoMemory)
? DeviceType::IntegratedGPU
: DeviceType::DiscreteGPU;
break;
}
default:
// TODO: Support additional GPU vendors.
mDeviceType = DeviceType::Unknown;
break;
}
}
std::wstring_convert<DeletableFacet<std::codecvt<wchar_t, char, std::mbstate_t>>> converter(

View File

@ -78,13 +78,6 @@ namespace {
size_t slot;
};
constexpr uint32_t kVendorID_AMD = 0x1002;
constexpr uint32_t kVendorID_ARM = 0x13B5;
constexpr uint32_t kVendorID_ImgTec = 0x1010;
constexpr uint32_t kVendorID_Intel = 0x8086;
constexpr uint32_t kVendorID_Nvidia = 0x10DE;
constexpr uint32_t kVendorID_Qualcomm = 0x5143;
DawnTestEnvironment* gTestEnv = nullptr;
} // namespace