diff --git a/trinityal/dx11/Tr2PrimaryRenderContextDx11.cpp b/trinityal/dx11/Tr2PrimaryRenderContextDx11.cpp index 123c291b2..830b62b03 100644 --- a/trinityal/dx11/Tr2PrimaryRenderContextDx11.cpp +++ b/trinityal/dx11/Tr2PrimaryRenderContextDx11.cpp @@ -39,6 +39,7 @@ extern NullContext s_nullContext; Tr2PrimaryRenderContextAL::Tr2PrimaryRenderContextAL() : m_usingEXDevice( false ), + m_softwareAdapter( false ), m_recodingFrame( 1 ), m_renderedFrame( 0 ), m_vsyncInterval( 0 ), @@ -82,6 +83,7 @@ void Tr2PrimaryRenderContextAL::Destroy() m_defaultBackBuffer.m_texture->Destroy(); m_usingEXDevice = false; + m_softwareAdapter = false; m_deviceStatistics = nullptr; m_d3dDevice11 = nullptr; @@ -164,11 +166,14 @@ ALResult Tr2PrimaryRenderContextAL::CreateDevice( uint32_t adapter, D3D_FEATURE_LEVEL levelSupported; CComPtr adapterPtr; + m_softwareAdapter = pp.software; + if( !isWindowless ) { if( FAILED( Tr2VideoAdapterInfo::GetVideoAdapterDX11( adapter, &adapterPtr, &m_dxgiOutput ) ) ) { + m_softwareAdapter = false; return E_FAIL; } @@ -178,6 +183,11 @@ ALResult Tr2PrimaryRenderContextAL::CreateDevice( uint32_t adapter, { CCP_AL_LOG( "DX11 creating device for adapter %s", (LPCTSTR)CW2A( desc1.Description ) ); m_adapterVendorId = uint32_t( desc1.VendorId ); + + if( desc1.Flags & DXGI_ADAPTER_FLAG_SOFTWARE ) + { + m_softwareAdapter = true; + } } } @@ -310,6 +320,7 @@ ALResult Tr2PrimaryRenderContextAL::CreateDevice( uint32_t adapter, m_swapChain = nullptr; m_d3dDevice11 = nullptr; m_dxgiOutput = nullptr; + m_softwareAdapter = false; m_context.Attach( (ID3D11DeviceContext*)&Tr2RenderContextImpl::s_nullContext ); return E_FAIL; } diff --git a/trinityal/dx11/Tr2PrimaryRenderContextDx11.h b/trinityal/dx11/Tr2PrimaryRenderContextDx11.h index 6f0a5ba0a..7643bcd18 100644 --- a/trinityal/dx11/Tr2PrimaryRenderContextDx11.h +++ b/trinityal/dx11/Tr2PrimaryRenderContextDx11.h @@ -64,6 +64,7 @@ class Tr2PrimaryRenderContextAL : public Tr2RenderContextAL CComPtr m_swapChain; CComPtr m_dxgiFactory; CComPtr m_dxgiOutput; + bool m_softwareAdapter; Tr2TextureAL m_defaultBackBuffer; diff --git a/trinityal/dx11/Tr2TextureALDx11.cpp b/trinityal/dx11/Tr2TextureALDx11.cpp index 3b3840a3d..d81165d4c 100644 --- a/trinityal/dx11/Tr2TextureALDx11.cpp +++ b/trinityal/dx11/Tr2TextureALDx11.cpp @@ -485,7 +485,7 @@ ALResult Tr2TextureAL::Create( const Tr2BitmapDimensions& desc, const Tr2MsaaDes } // Behold! A workaround for WARP device crash when creating multiple SRVs into a BC7 texture! - if( !renderContext.m_dxgiOutput && desc.GetFormat() == Tr2RenderContextEnum::PIXEL_FORMAT_BC7_UNORM ) + if( renderContext.m_softwareAdapter && desc.GetFormat() == Tr2RenderContextEnum::PIXEL_FORMAT_BC7_UNORM ) { // Create a single linear view into the texture FORWARD_HR( CreateViews( texture, desc, msaa, gpuUsage, cpuUsage, false, renderContext ) );