Fixes to GPU system information. Fixes #9434

This commit is contained in:
Henrik Rydgård 2017-03-16 09:48:10 +01:00
parent 892a7a5caa
commit f4a0c4504f
7 changed files with 37 additions and 18 deletions

View File

@ -375,8 +375,11 @@ void SystemInfoScreen::CreateViews() {
DrawContext *draw = screenManager()->getDrawContext();
deviceSpecs->Add(new InfoItem("3D API", std::string(draw->GetInfoString(InfoField::APINAME))));
deviceSpecs->Add(new InfoItem("Vendor", std::string(draw->GetInfoString(InfoField::VENDORSTRING)) + " (" + draw->GetInfoString(InfoField::VENDOR) + ")"));
deviceSpecs->Add(new InfoItem("Model", draw->GetInfoString(InfoField::RENDERER)));
deviceSpecs->Add(new InfoItem("Vendor", std::string(draw->GetInfoString(InfoField::VENDORSTRING))));
std::string vendor = draw->GetInfoString(InfoField::VENDOR);
if (vendor.size())
deviceSpecs->Add(new InfoItem("Vendor (detected)", vendor));
deviceSpecs->Add(new InfoItem("Driver", draw->GetInfoString(InfoField::DRIVER)));
#ifdef _WIN32
deviceSpecs->Add(new InfoItem("Driver Version", System_GetProperty(SYSPROP_GPUDRIVER_VERSION)));
#if !PPSSPP_PLATFORM(UWP)

View File

@ -86,17 +86,17 @@ bool D3D9Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
return false;
}
}
adapterId_ = D3DADAPTER_DEFAULT;
D3DCAPS9 d3dCaps;
D3DDISPLAYMODE d3ddm;
if (FAILED(d3d_->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm))) {
if (FAILED(d3d_->GetAdapterDisplayMode(adapterId_, &d3ddm))) {
*error_message = "GetAdapterDisplayMode failed";
d3d_->Release();
return false;
}
adapterId_ = D3DADAPTER_DEFAULT;
if (FAILED(d3d_->GetDeviceCaps(adapterId_, D3DDEVTYPE_HAL, &d3dCaps))) {
*error_message = "GetDeviceCaps failed (???)";
d3d_->Release();
@ -104,7 +104,7 @@ bool D3D9Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
}
HRESULT hr;
if (FAILED(hr = d3d_->CheckDeviceFormat(D3DADAPTER_DEFAULT,
if (FAILED(hr = d3d_->CheckDeviceFormat(adapterId_,
D3DDEVTYPE_HAL,
d3ddm.Format,
D3DUSAGE_DEPTHSTENCIL,
@ -164,7 +164,7 @@ bool D3D9Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
// TODO: This makes it slower?
//deviceEx->SetMaximumFrameLatency(1);
}
draw_ = Draw::T3DCreateDX9Context(d3d_, d3dEx_, -1, device_, deviceEx_);
draw_ = Draw::T3DCreateDX9Context(d3d_, d3dEx_, adapterId_, device_, deviceEx_);
if (draw_)
draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, 0, 0, nullptr);
return true;

View File

@ -308,7 +308,7 @@ enum InfoField {
VENDORSTRING,
VENDOR,
SHADELANGVERSION,
RENDERER,
DRIVER,
};
enum class NativeObject {

View File

@ -94,9 +94,9 @@ public:
std::string GetInfoString(InfoField info) const override {
switch (info) {
case APIVERSION: return "Direct3D 11";
case VENDORSTRING: return "N/A";
case VENDOR: return "-";
case RENDERER: return adapterDesc_;
case VENDORSTRING: return adapterDesc_;
case VENDOR: return "";
case DRIVER: return "-";
case SHADELANGVERSION:
switch (featureLevel_) {
case D3D_FEATURE_LEVEL_9_1: return "Feature Level 9.1"; break;
@ -221,7 +221,21 @@ D3D11DrawContext::D3D11DrawContext(ID3D11Device *device, ID3D11DeviceContext *de
// caps_.logicOpSupported = true;
}
}
// Obtain DXGI factory from device (since we used nullptr for pAdapter above)
IDXGIFactory1* dxgiFactory = nullptr;
IDXGIDevice* dxgiDevice = nullptr;
IDXGIAdapter* adapter = nullptr;
HRESULT hr = device_->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void**>(&dxgiDevice));
if (SUCCEEDED(hr)) {
hr = dxgiDevice->GetAdapter(&adapter);
if (SUCCEEDED(hr)) {
DXGI_ADAPTER_DESC desc;
adapter->GetDesc(&desc);
adapterDesc_ = ConvertWStringToUTF8(desc.Description);
adapter->Release();
}
dxgiDevice->Release();
}
CreatePresets();
}

View File

@ -548,8 +548,8 @@ public:
switch (info) {
case APIVERSION: return "DirectX 9.0";
case VENDORSTRING: return identifier_.Description;
case VENDOR: return "-";
case RENDERER: return identifier_.Driver; // eh, sort of
case VENDOR: return "";
case DRIVER: return identifier_.Driver; // eh, sort of
case SHADELANGVERSION: return shadeLangVersion_;
case APINAME: return "Direct3D 9";
default: return "?";
@ -564,9 +564,9 @@ private:
LPDIRECT3DDEVICE9 device_;
LPDIRECT3DDEVICE9EX deviceEx_;
int adapterId_ = -1;
D3DADAPTER_IDENTIFIER9 identifier_;
D3DADAPTER_IDENTIFIER9 identifier_{};
D3DCAPS9 d3dCaps_;
char shadeLangVersion_[64];
char shadeLangVersion_[64]{};
DeviceCaps caps_{};
// Bound state
@ -588,7 +588,9 @@ private:
D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx)
: d3d_(d3d), d3dEx_(d3dEx), adapterId_(adapterId), device_(device), deviceEx_(deviceEx), caps_{} {
CreatePresets();
d3d->GetAdapterIdentifier(adapterId, 0, &identifier_);
if (FAILED(d3d->GetAdapterIdentifier(adapterId, 0, &identifier_))) {
ELOG("Failed to get adapter identifier: %d", adapterId);
}
if (!FAILED(device->GetDeviceCaps(&d3dCaps_))) {
sprintf(shadeLangVersion_, "PS: %04x VS: %04x", d3dCaps_.PixelShaderVersion & 0xFFFF, d3dCaps_.VertexShaderVersion & 0xFFFF);
} else {

View File

@ -542,7 +542,7 @@ public:
return "VENDOR_UNKNOWN";
}
break;
case RENDERER: return (const char *)glGetString(GL_RENDERER);
case DRIVER: return (const char *)glGetString(GL_RENDERER);
case SHADELANGVERSION: return (const char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
case APIVERSION: return (const char *)glGetString(GL_VERSION);
default: return "?";

View File

@ -394,7 +394,7 @@ public:
case APINAME: return "Vulkan";
case VENDORSTRING: return vulkan_->GetPhysicalDeviceProperties().deviceName;
case VENDOR: return StringFromFormat("%08x", vulkan_->GetPhysicalDeviceProperties().vendorID);
case RENDERER: return StringFromFormat("%08x", vulkan_->GetPhysicalDeviceProperties().driverVersion);
case DRIVER: return StringFromFormat("%08x", vulkan_->GetPhysicalDeviceProperties().driverVersion);
case SHADELANGVERSION: return "N/A";;
case APIVERSION:
{