Show feature levels in System Info, allow lower D3D11 feature levels

This commit is contained in:
Henrik Rydgard 2017-03-05 11:05:36 +01:00
parent 340f0cff2c
commit 85717a981c
2 changed files with 22 additions and 4 deletions

View file

@ -52,10 +52,15 @@ HRESULT D3D11Context::CreateTheDevice() {
const UINT numDriverTypes = ARRAYSIZE(driverTypes);
static const D3D_FEATURE_LEVEL featureLevels[] = {
D3D_FEATURE_LEVEL_12_1,
D3D_FEATURE_LEVEL_12_0,
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1,
};
const UINT numFeatureLevels = ARRAYSIZE(featureLevels);
@ -68,7 +73,7 @@ HRESULT D3D11Context::CreateTheDevice() {
if (hr == E_INVALIDARG) {
// DirectX 11.0 platforms will not recognize D3D_FEATURE_LEVEL_11_1 so we need to retry without it
hr = ptr_D3D11CreateDevice(nullptr, driverType_, nullptr, createDeviceFlags, (D3D_FEATURE_LEVEL *)&featureLevels[1], numFeatureLevels - 1,
hr = ptr_D3D11CreateDevice(nullptr, driverType_, nullptr, createDeviceFlags, (D3D_FEATURE_LEVEL *)&featureLevels[3], numFeatureLevels - 3,
D3D11_SDK_VERSION, &device_, &featureLevel_, &context_);
}
if (SUCCEEDED(hr))
@ -143,7 +148,7 @@ bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
}
#endif
draw_ = Draw::T3DCreateD3D11Context(device_, context_, device1_, context1_, hWnd_);
draw_ = Draw::T3DCreateD3D11Context(device_, context_, device1_, context1_, featureLevel_, hWnd_);
int width;
int height;

View file

@ -10,6 +10,7 @@
#include "math/dataconv.h"
#include "util/text/utf8.h"
#include <D3DCommon.h>
#include <d3d11.h>
#include <d3d11_1.h>
#include <d3dcompiler.h>
@ -92,11 +93,23 @@ public:
std::string GetInfoString(InfoField info) const override {
switch (info) {
case APIVERSION: return "Direct3D 11.0";
case APIVERSION: return "Direct3D 11";
case VENDORSTRING: return "N/A";
case VENDOR: return "-";
case RENDERER: return adapterDesc_;
case SHADELANGVERSION: return "HLSL 5";
case SHADELANGVERSION:
switch (featureLevel_) {
case D3D_FEATURE_LEVEL_9_1: return "Feature Level 9.1"; break;
case D3D_FEATURE_LEVEL_9_2: return "Feature Level 9.2"; break;
case D3D_FEATURE_LEVEL_9_3: return "Feature Level 9.3"; break;
case D3D_FEATURE_LEVEL_10_0: return "Feature Level 10.0"; break;
case D3D_FEATURE_LEVEL_10_1: return "Feature Level 10.1"; break;
case D3D_FEATURE_LEVEL_11_0: return "Feature Level 11.0"; break;
case D3D_FEATURE_LEVEL_11_1: return "Feature Level 11.1"; break;
case D3D_FEATURE_LEVEL_12_0: return "Feature Level 12.0"; break;
case D3D_FEATURE_LEVEL_12_1: return "Feature Level 12.1"; break;
}
return "Unknown feature level";
case APINAME: return "Direct3D 11";
default: return "?";
}