| 207 | } |
| 208 | |
| 209 | bool Dxgi::init(Caps& _caps) |
| 210 | { |
| 211 | #if BX_PLATFORM_LINUX || BX_PLATFORM_WINDOWS |
| 212 | |
| 213 | const char* dxgiDllName = |
| 214 | #if BX_PLATFORM_LINUX |
| 215 | "dxgi.so" |
| 216 | #else |
| 217 | "dxgi.dll" |
| 218 | #endif // BX_PLATFORM_LINUX |
| 219 | ; |
| 220 | m_dxgiDll = bx::dlopen(dxgiDllName); |
| 221 | |
| 222 | if (NULL == m_dxgiDll) |
| 223 | { |
| 224 | BX_TRACE("Init error: Failed to load %s.", dxgiDllName); |
| 225 | return false; |
| 226 | } |
| 227 | |
| 228 | # if BX_PLATFORM_WINDOWS |
| 229 | m_dxgiDebugDll = bx::dlopen("dxgidebug.dll"); |
| 230 | |
| 231 | if (NULL != m_dxgiDebugDll) |
| 232 | { |
| 233 | DXGIGetDebugInterface = (PFN_GET_DEBUG_INTERFACE )bx::dlsym(m_dxgiDebugDll, "DXGIGetDebugInterface"); |
| 234 | DXGIGetDebugInterface1 = (PFN_GET_DEBUG_INTERFACE1)bx::dlsym(m_dxgiDebugDll, "DXGIGetDebugInterface1"); |
| 235 | if (NULL == DXGIGetDebugInterface |
| 236 | && NULL == DXGIGetDebugInterface1) |
| 237 | { |
| 238 | bx::dlclose(m_dxgiDebugDll); |
| 239 | m_dxgiDebugDll = NULL; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | CreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY)bx::dlsym(m_dxgiDll, "CreateDXGIFactory1"); |
| 244 | |
| 245 | if (NULL == CreateDXGIFactory) |
| 246 | { |
| 247 | CreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY)bx::dlsym(m_dxgiDll, "CreateDXGIFactory"); |
| 248 | } |
| 249 | |
| 250 | if (NULL == CreateDXGIFactory) |
| 251 | { |
| 252 | BX_TRACE("Init error: Function CreateDXGIFactory not found."); |
| 253 | return false; |
| 254 | } |
| 255 | # endif // BX_PLATFORM_WINDOWS |
| 256 | #endif // BX_PLATFORM_WINDOWS |
| 257 | |
| 258 | HRESULT hr = S_OK; |
| 259 | #if BX_PLATFORM_WINRT |
| 260 | // WinRT requires the IDXGIFactory2 interface, which isn't supported on older platforms |
| 261 | hr = CreateDXGIFactory1(IID_IDXGIFactory2, (void**)&m_factory); |
| 262 | #elif BX_PLATFORM_WINDOWS |
| 263 | hr = CreateDXGIFactory(IID_IDXGIFactory, (void**)&m_factory); |
| 264 | #endif // BX_PLATFORM_* |
| 265 | |
| 266 | if (FAILED(hr)) |