Skip to content

Commit

Permalink
Update av_cef_app.cpp
Browse files Browse the repository at this point in the history
Changed CAardvarkCefApp to only create a debug DX device when building in debug.
Added check for failure to create the device and log that so it's easier to diagnose in the future.

fixes #149
  • Loading branch information
JoeLudwig committed Sep 13, 2020
1 parent e8bcc70 commit ef1f040
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/avrenderer/av_cef_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,14 @@ void CAardvarkCefApp::OnContextInitialized()

D3D_FEATURE_LEVEL featureLevel[] = { D3D_FEATURE_LEVEL_11_1 };
D3D_FEATURE_LEVEL createdFeatureLevel;

UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
#if defined( _DEBUG )
flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

D3D11CreateDevice( pAdapter, D3D_DRIVER_TYPE_HARDWARE, nullptr,
D3D11_CREATE_DEVICE_DEBUG | D3D11_CREATE_DEVICE_BGRA_SUPPORT,
featureLevel, 1, D3D11_SDK_VERSION,
HRESULT hres = D3D11CreateDevice( pAdapter, D3D_DRIVER_TYPE_HARDWARE, nullptr,
flags, featureLevel, 1, D3D11_SDK_VERSION,
&m_pD3D11Device, &createdFeatureLevel, &m_pD3D11ImmediateContext );

if ( pAdapter )
Expand All @@ -141,6 +145,12 @@ void CAardvarkCefApp::OnContextInitialized()
pAdapter = nullptr;
}

if ( !SUCCEEDED( hres ) )
{
LOG( FATAL ) << "Failed to create D3D device" << std::hex << hres;
return;
}

aardvark::GadgetParams_t params = { "http://localhost:23842/gadgets/aardvark_renderer", "", aardvark::EndpointAddr_t() };
startGadget( params );
}
Expand Down

0 comments on commit ef1f040

Please sign in to comment.