main: attempt to create non-debug device if D3D10_CREATE_DEVICE_DEBUG fails
This commit is contained in:
parent
6cfa7ec571
commit
b5f3e1c916
19
src/main.cpp
19
src/main.cpp
@ -1006,21 +1006,34 @@ HRESULT InitDirect3DDevice()
|
|||||||
};
|
};
|
||||||
UINT numDriverTypes = (sizeof (driverTypes)) / (sizeof (driverTypes[0]));
|
UINT numDriverTypes = (sizeof (driverTypes)) / (sizeof (driverTypes[0]));
|
||||||
|
|
||||||
|
D3D10_CREATE_DEVICE_FLAG flags[] = {
|
||||||
|
D3D10_CREATE_DEVICE_DEBUG,
|
||||||
|
(D3D10_CREATE_DEVICE_FLAG)0,
|
||||||
|
};
|
||||||
|
UINT numFlags = (sizeof (flags)) / (sizeof (flags[0]));
|
||||||
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
D3D10_DRIVER_TYPE driverType = D3D10_DRIVER_TYPE_NULL;
|
D3D10_DRIVER_TYPE driverType = D3D10_DRIVER_TYPE_NULL;
|
||||||
for (UINT i = 0; i < numDriverTypes; i++) {
|
for (UINT i = 0; i < numDriverTypes; i++) {
|
||||||
|
for (UINT j = 0; j < numFlags; j++) {
|
||||||
driverType = driverTypes[i];
|
driverType = driverTypes[i];
|
||||||
hr = D3D10CreateDeviceAndSwapChain(NULL,
|
hr = D3D10CreateDeviceAndSwapChain(NULL,
|
||||||
driverType,
|
driverType,
|
||||||
NULL,
|
NULL,
|
||||||
D3D10_CREATE_DEVICE_DEBUG,
|
flags[j],
|
||||||
D3D10_SDK_VERSION,
|
D3D10_SDK_VERSION,
|
||||||
&sd,
|
&sd,
|
||||||
&g_pSwapChain,
|
&g_pSwapChain,
|
||||||
&g_pd3dDevice);
|
&g_pd3dDevice);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr)) {
|
||||||
break;
|
if (j != 0) {
|
||||||
|
print("no debug layers\n");
|
||||||
}
|
}
|
||||||
|
goto end_driver_loop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end_driver_loop:
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
print("D3D10CreateDeviceAndSwapChain\n");
|
print("D3D10CreateDeviceAndSwapChain\n");
|
||||||
return hr;
|
return hr;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user