Skip to content

Commit

Permalink
D3D11Renderer: Fixed some crashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonJoker committed Nov 8, 2021
1 parent d75d242 commit cd8bd72
Show file tree
Hide file tree
Showing 36 changed files with 990 additions and 454 deletions.
2 changes: 1 addition & 1 deletion CMake
2 changes: 2 additions & 0 deletions source/ashes/renderer/D3D11Renderer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ source_group( "Source Files\\Command\\Commands" FILES ${${PROJECT_NAME}_FOLDER_S
set( ${PROJECT_NAME}_FOLDER_SRC_FILES
Core/D3D11DebugReportCallback.cpp
Core/D3D11Device.cpp
Core/D3D11DeviceContextLock.cpp
Core/D3D11Display.cpp
Core/D3D11DisplayMode.cpp
Core/D3D11Instance.cpp
Expand All @@ -186,6 +187,7 @@ set( ${PROJECT_NAME}_FOLDER_SRC_FILES
set( ${PROJECT_NAME}_FOLDER_HDR_FILES
Core/D3D11DebugReportCallback.hpp
Core/D3D11Device.hpp
Core/D3D11DeviceContextLock.hpp
Core/D3D11Display.hpp
Core/D3D11DisplayMode.hpp
Core/D3D11DummyIndexBuffer.hpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,29 @@ namespace ashes::d3d11

void BeginSubpassCommand::apply( Context const & context )const
{
if ( context.uavs.empty() )
{
context.context->OMSetRenderTargets( UINT( m_attaches.size() )
, m_attaches.data()
, m_depthAttach );
}
else
auto uavStart = UINT( m_attaches.size() );
context.context->OMSetRenderTargetsAndUnorderedAccessViews( UINT( m_attaches.size() )
, m_attaches.data()
, m_depthAttach
, uavStart
, D3D11_KEEP_UNORDERED_ACCESS_VIEWS
, nullptr
, nullptr );

if ( context.uavStart != uavStart )
{
auto uavs = doListUavs( context.uavs );
context.context->OMSetRenderTargetsAndUnorderedAccessViews( UINT( m_attaches.size() )
, m_attaches.data()
, m_depthAttach
, UINT( m_attaches.size() )
, UINT( uavs.size() )
, uavs.data()
, nullptr );
context.uavStart = uavStart;

if ( !context.rawUavs.empty() )
{
context.context->OMSetRenderTargetsAndUnorderedAccessViews( D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL
, nullptr
, nullptr
, context.uavStart
, UINT( context.rawUavs.size() )
, context.rawUavs.data()
, nullptr );
}
}
}

Expand Down
Loading

0 comments on commit cd8bd72

Please sign in to comment.