libobs-d3d11: Split InitFactory to InitAdapter
Splits off the adapter initialization to its own function so we can modify what happens in between those actions. (-Jim)master
parent
85334d562f
commit
1e106c8bb8
|
@ -478,7 +478,8 @@ try {
|
|||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
InitFactory(adpIdx);
|
||||
InitFactory();
|
||||
InitAdapter(adpIdx);
|
||||
|
||||
uint32_t createFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
|
||||
hr = D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
|
||||
|
|
|
@ -232,7 +232,7 @@ void gs_device::InitCompiler()
|
|||
"DirectX components</a> that OBS Studio requires.";
|
||||
}
|
||||
|
||||
void gs_device::InitFactory(uint32_t adapterIdx)
|
||||
void gs_device::InitFactory()
|
||||
{
|
||||
HRESULT hr;
|
||||
IID factoryIID = (GetWinVer() >= 0x602) ? dxgiFactory2
|
||||
|
@ -241,8 +241,11 @@ void gs_device::InitFactory(uint32_t adapterIdx)
|
|||
hr = CreateDXGIFactory1(factoryIID, (void **)factory.Assign());
|
||||
if (FAILED(hr))
|
||||
throw UnsupportedHWError("Failed to create DXGIFactory", hr);
|
||||
}
|
||||
|
||||
hr = factory->EnumAdapters1(adapterIdx, &adapter);
|
||||
void gs_device::InitAdapter(uint32_t adapterIdx)
|
||||
{
|
||||
HRESULT hr = factory->EnumAdapters1(adapterIdx, &adapter);
|
||||
if (FAILED(hr))
|
||||
throw UnsupportedHWError("Failed to enumerate DXGIAdapter", hr);
|
||||
}
|
||||
|
@ -787,7 +790,8 @@ gs_device::gs_device(uint32_t adapterIdx)
|
|||
}
|
||||
|
||||
InitCompiler();
|
||||
InitFactory(adapterIdx);
|
||||
InitFactory();
|
||||
InitAdapter(adapterIdx);
|
||||
InitDevice(adapterIdx);
|
||||
device_set_render_target(this, NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -1004,7 +1004,8 @@ struct gs_device {
|
|||
gs_obj *first_obj = nullptr;
|
||||
|
||||
void InitCompiler();
|
||||
void InitFactory(uint32_t adapterIdx);
|
||||
void InitFactory();
|
||||
void InitAdapter(uint32_t adapterIdx);
|
||||
void InitDevice(uint32_t adapterIdx);
|
||||
|
||||
ID3D11DepthStencilState *AddZStencilState();
|
||||
|
|
Loading…
Reference in New Issue