_Use_decl_annotations_ HRESULT WINAPI DXUTGetD3D11AdapterDisplayMode( UINT AdapterOrdinal, UINT nOutput, DXGI_MODE_DESC* pModeDesc ) { if( !pModeDesc ) return E_INVALIDARG; CD3D11Enumeration* pD3DEnum = DXUTGetD3D11Enumeration(); if ( !pD3DEnum ) return E_POINTER; CD3D11EnumOutputInfo* pOutputInfo = pD3DEnum->GetOutputInfo( AdapterOrdinal, nOutput ); if( pOutputInfo ) { pModeDesc->Width = 640; pModeDesc->Height = 480; pModeDesc->RefreshRate.Numerator = 60; pModeDesc->RefreshRate.Denominator = 1; pModeDesc->Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; pModeDesc->Scaling = DXGI_MODE_SCALING_UNSPECIFIED; pModeDesc->ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; DXGI_OUTPUT_DESC Desc; if ( FAILED(pOutputInfo->m_pOutput->GetDesc(&Desc))) memset( &Desc, 0, sizeof(Desc) ); pModeDesc->Width = Desc.DesktopCoordinates.right - Desc.DesktopCoordinates.left; pModeDesc->Height = Desc.DesktopCoordinates.bottom - Desc.DesktopCoordinates.top; // This should not be required with DXGI 1.1 support for BGRA... if( pModeDesc->Format == DXGI_FORMAT_B8G8R8A8_UNORM ) pModeDesc->Format = DXGI_FORMAT_R8G8B8A8_UNORM; } return S_OK; }
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { // Enable run-time memory check for debug builds. #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif Initialize(); // Set DXUT callbacks DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackKeyboard( OnKeyboard ); DXUTSetCallbackMouse( OnMouse, true ); DXUTSetCallbackD3D11DeviceAcceptable( IsD3D11DeviceAcceptable ); DXUTSetCallbackD3D11DeviceCreated( OnD3D11CreateDevice ); DXUTSetCallbackD3D11SwapChainResized( OnD3D11ResizedSwapChain ); DXUTSetCallbackD3D11FrameRender( OnD3D11FrameRender ); DXUTSetCallbackD3D11SwapChainReleasing( OnD3D11ReleasingSwapChain ); DXUTSetCallbackD3D11DeviceDestroyed( OnD3D11DestroyDevice ); InitApp(); if (gMultithreaded) { InitWin32Threads(); } DXUTInit( true, true, NULL ); DXUTSetCursorSettings( true, true ); DXUTCreateWindow( L"ISPC HDR Texture Compressor" ); // Try to create a device with DX11 feature set DXUTCreateDevice (D3D_FEATURE_LEVEL_11_0, true, 1280, 1024 ); BOOL DX11Available = false; // If we don't have an adequate driver, then we revert to DX10 feature set... DXUTDeviceSettings settings = DXUTGetDeviceSettings(); if(settings.d3d11.DriverType == D3D_DRIVER_TYPE_UNKNOWN || settings.d3d11.DriverType == D3D_DRIVER_TYPE_NULL) { DXUTCreateDevice(D3D_FEATURE_LEVEL_10_1, true, 1280, 1024); // !HACK! Force enumeration here in order to relocate hardware with new feature level DXUTGetD3D11Enumeration(true); DXUTCreateDevice(D3D_FEATURE_LEVEL_10_1, true, 1280, 1024); const TCHAR *noDx11msg = _T("Your hardware does not seem to support DX11. BC7 Compression is disabled."); MessageBox(NULL, noDx11msg, _T("Error"), MB_OK); } else { DX11Available = true; } FillProfiles(DX11Available); DXUTMainLoop(); // Destroy all of the threads... DestroyThreads(); return DXUTGetExitCode(); }