check debug layer before creating
This commit is contained in:
parent
6a91ac26d7
commit
34e433ad90
1 changed files with 11 additions and 1 deletions
|
@ -974,7 +974,17 @@ impl Drop for DirectXResources {
|
|||
#[inline]
|
||||
fn get_dxgi_factory() -> Result<IDXGIFactory6> {
|
||||
#[cfg(debug_assertions)]
|
||||
let factory_flag = DXGI_CREATE_FACTORY_DEBUG;
|
||||
let factory_flag = if unsafe { DXGIGetDebugInterface1::<IDXGIInfoQueue>(0) }
|
||||
.log_err()
|
||||
.is_some()
|
||||
{
|
||||
DXGI_CREATE_FACTORY_DEBUG
|
||||
} else {
|
||||
log::error!(
|
||||
"Failed to get DXGI debug interface. DirectX debugging features will be disabled."
|
||||
);
|
||||
DXGI_CREATE_FACTORY_FLAGS::default()
|
||||
};
|
||||
#[cfg(not(debug_assertions))]
|
||||
let factory_flag = DXGI_CREATE_FACTORY_FLAGS::default();
|
||||
unsafe { Ok(CreateDXGIFactory2(factory_flag)?) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue