Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions trinityal/dx11/Tr2PrimaryRenderContextDx11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ),
Expand Down Expand Up @@ -82,6 +83,7 @@ void Tr2PrimaryRenderContextAL::Destroy()
m_defaultBackBuffer.m_texture->Destroy();

m_usingEXDevice = false;
m_softwareAdapter = false;
m_deviceStatistics = nullptr;

m_d3dDevice11 = nullptr;
Expand Down Expand Up @@ -164,11 +166,14 @@ ALResult Tr2PrimaryRenderContextAL::CreateDevice( uint32_t adapter,
D3D_FEATURE_LEVEL levelSupported;
CComPtr<IDXGIAdapter1> adapterPtr;

m_softwareAdapter = pp.software;

if( !isWindowless )
{

if( FAILED( Tr2VideoAdapterInfo::GetVideoAdapterDX11( adapter, &adapterPtr, &m_dxgiOutput ) ) )
{
m_softwareAdapter = false;
return E_FAIL;
}

Expand All @@ -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;
}
}
}

Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions trinityal/dx11/Tr2PrimaryRenderContextDx11.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Tr2PrimaryRenderContextAL : public Tr2RenderContextAL
CComPtr<IDXGISwapChain> m_swapChain;
CComPtr<IDXGIFactory> m_dxgiFactory;
CComPtr<IDXGIOutput> m_dxgiOutput;
bool m_softwareAdapter;

Tr2TextureAL m_defaultBackBuffer;

Expand Down
2 changes: 1 addition & 1 deletion trinityal/dx11/Tr2TextureALDx11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down
Loading