1717// may be used to endorse or promote products derived from this software
1818// without specific prior written permission.
1919//
20- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “ AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
20+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS � AS IS� AND ANY EXPRESS OR IMPLIED WARRANTIES,
2121// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2222// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
2323// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
@@ -316,24 +316,15 @@ void RendererImplDx::swapBuffers() const
316316 parameters.pScrollOffset = nullptr ;
317317
318318 HRESULT hr;
319- #if ( _WIN32_WINNT >= 0x0602 )
320319 if ( mVsyncEnable )
321320 hr = mSwapChain ->Present1 ( 1 , 0 , ¶meters );
322321 else
323322 hr = mSwapChain ->Present1 ( 0 , 0 , ¶meters );
324- #else
325- if ( mVsyncEnable )
326- hr = mSwapChain ->Present ( 1 , 0 );
327- else
328- hr = mSwapChain ->Present ( 0 , 0 );
329- #endif
330323 // handle device lost
331324 if (hr == DXGI_ERROR_DEVICE_REMOVED)
332325 const_cast <RendererImplDx*>(this )->handleLostDevice ();
333- #if ( _WIN32_WINNT >= 0x0602 )
334326 mDeviceContext ->DiscardView ( mMainFramebuffer );
335327 mDeviceContext ->DiscardView ( mDepthStencilView );
336- #endif
337328}
338329
339330void RendererImplDx::makeCurrentContext ()
@@ -597,10 +588,7 @@ bool RendererImplDx::createDevice( UINT createDeviceFlags )
597588{
598589 D3D_FEATURE_LEVEL featureLevels[] =
599590 {
600- #if (_WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8*/ )
601- // This requires Windows 8.
602591 D3D_FEATURE_LEVEL_11_1,
603- #endif
604592 D3D_FEATURE_LEVEL_11_0,
605593 D3D_FEATURE_LEVEL_10_1,
606594 D3D_FEATURE_LEVEL_10_0,
@@ -625,19 +613,11 @@ bool RendererImplDx::createDevice( UINT createDeviceFlags )
625613 );
626614
627615 if ( hr == S_OK ) {
628- #if ( _WIN32_WINNT >= 0x0602 )
629616 hr = device->QueryInterface (__uuidof (ID3D11Device1), (void **)&md3dDevice);
630- #else
631- hr = device->QueryInterface (__uuidof (ID3D11Device), (void **)&md3dDevice);
632- #endif
633617 }
634618
635619 if ( hr == S_OK ) {
636- #if ( _WIN32_WINNT >= 0x0602 )
637620 hr = context->QueryInterface (__uuidof (ID3D11DeviceContext1), (void **)&mDeviceContext );
638- #else
639- hr = context->QueryInterface (__uuidof (ID3D11DeviceContext), (void **)&mDeviceContext );
640- #endif
641621 }
642622
643623 if ( context )
@@ -689,7 +669,6 @@ bool RendererImplDx::createFramebufferResources()
689669 if ( hr != S_OK )
690670 return false ;
691671
692- #if ( _WIN32_WINNT >= 0x0602 )
693672 IDXGIFactory2 *dxgiFactory;
694673 hr = dxgiAdapter->GetParent (__uuidof (IDXGIFactory2), (void **)&dxgiFactory);
695674 if ( hr != S_OK )
@@ -704,57 +683,11 @@ bool RendererImplDx::createFramebufferResources()
704683 swapChainDesc.SampleDesc .Quality = 0 ;
705684 swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
706685 swapChainDesc.BufferCount = 2 ; // Use double-buffering to minimize latency.
707-
708- // Check to see if the OS is Windows 8 or later. If it's not, then that means
709- // compiling/running on Windows 7 SP1. We use this to set the appropriate
710- // flags for Windows7 SP 1's DirectX 11.1 support.
711- //
712- OSVERSIONINFOEX osver;
713- ZeroMemory ( &osver, sizeof (OSVERSIONINFOEX) );
714- osver.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
715- GetVersionEx ( (OSVERSIONINFO*)&osver );
716- bool isWin8 = (osver.dwMajorVersion >= 6 ) && (osver.dwMinorVersion >= 2 );
717-
718- if ( isWin8 ) {
719- swapChainDesc.Scaling = DXGI_SCALING_NONE;
720- }
721- else {
722- //
723- // Win7 doesn't support DXGI_SCALING_NONE:
724- // http://msdn.microsoft.com/en-us/library/windows/desktop/hh404557(v=vs.85).aspx
725- //
726- swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
727- }
728-
686+ swapChainDesc.Scaling = DXGI_SCALING_NONE;
729687 swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // All Windows Store apps must use this SwapEffect.
730688 swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
731689
732690 hr = dxgiFactory->CreateSwapChainForHwnd ( md3dDevice, mWnd , &swapChainDesc, NULL , NULL , &mSwapChain );
733- #else
734- IDXGIFactory1 *dxgiFactory;
735- hr = dxgiAdapter->GetParent (__uuidof (IDXGIFactory1), (void **)&dxgiFactory);
736- if ( hr != S_OK )
737- return false ;
738-
739- DXGI_SWAP_CHAIN_DESC swapChainDesc = {0 };
740- swapChainDesc.BufferDesc .Width = static_cast <UINT>(width); // Match the size of the window.
741- swapChainDesc.BufferDesc .Height = static_cast <UINT>(height);
742- swapChainDesc.BufferDesc .RefreshRate .Numerator = 60 ;
743- swapChainDesc.BufferDesc .RefreshRate .Denominator = 1 ;
744- swapChainDesc.BufferDesc .Format = DXGI_FORMAT_R8G8B8A8_UNORM; // This is the most common swap chain format.
745- swapChainDesc.BufferDesc .ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
746- swapChainDesc.BufferDesc .Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
747- swapChainDesc.SampleDesc .Count = 1 ; // Don't use multi-sampling.
748- swapChainDesc.SampleDesc .Quality = 0 ;
749- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
750- swapChainDesc.BufferCount = 2 ; // Use double-buffering to minimize latency.
751- swapChainDesc.OutputWindow = mWnd ;
752- swapChainDesc.Windowed = TRUE ;
753- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
754- swapChainDesc.Flags = 0 ;
755-
756- hr = dxgiFactory->CreateSwapChain ( md3dDevice, &swapChainDesc, &mSwapChain );
757- #endif
758691 if ( hr != S_OK )
759692 return false ;
760693 hr = dxgiDevice->SetMaximumFrameLatency (1 );
0 commit comments