@@ -819,7 +819,7 @@ enum class CsdFilterState
819819static CsdFilterState g_csdFilterState;
820820
821821static ankerl::unordered_dense::set<GuestSurface*> g_pendingSurfaceCopies;
822- static ankerl::unordered_dense::set<GuestSurface*> g_pendingMsaaResolves ;
822+ static ankerl::unordered_dense::set<GuestSurface*> g_pendingResolves ;
823823
824824enum class RenderCommandType
825825{
@@ -3365,11 +3365,13 @@ static void ProcStretchRect(const RenderCommand& cmd)
33653365 {
33663366 if (g_textures[i] == args.texture )
33673367 {
3368- // Set the original texture for MSAA textures as they always get resolved.
3369- if (surface->sampleCount != RenderSampleCount::COUNT_1 )
3368+ // TODO: Render depth directly to slice and avoid copy
3369+ // Set the original texture for MSAA and depth textures as they always get resolved.
3370+ if (surface->sampleCount != RenderSampleCount::COUNT_1 ||
3371+ surface->format == RenderFormat::D32_FLOAT_S8_UINT )
33703372 {
33713373 SetTextureInRenderThread (i, args.texture );
3372- g_pendingMsaaResolves .emplace (surface);
3374+ g_pendingResolves .emplace (surface);
33733375 }
33743376 else
33753377 {
@@ -3679,7 +3681,7 @@ static void ProcExecutePendingStretchRectCommands(const RenderCommand& cmd)
36793681 }
36803682
36813683 g_pendingSurfaceCopies.clear ();
3682- g_pendingMsaaResolves .clear ();
3684+ g_pendingResolves .clear ();
36833685}
36843686
36853687static void SetFramebuffer (GuestSurface* renderTarget, GuestSurface* depthStencil, bool settingForClear)
@@ -3902,10 +3904,12 @@ static void ProcSetTexture(const RenderCommand& cmd)
39023904 bool shouldSetTexture = true ;
39033905 if (args.texture != nullptr && args.texture ->sourceSurface != nullptr )
39043906 {
3905- // MSAA surfaces need to be resolved and cannot be used directly.
3906- if (args.texture ->sourceSurface ->sampleCount != RenderSampleCount::COUNT_1 )
3907+ // TODO: Render depth directly to slice and avoid copy
3908+ // MSAA and depth surfaces need to be resolved and cannot be used directly.
3909+ if (args.texture ->sourceSurface ->sampleCount != RenderSampleCount::COUNT_1 ||
3910+ args.texture ->format == RenderFormat::D32_FLOAT_S8_UINT )
39073911 {
3908- g_pendingMsaaResolves .emplace (args.texture ->sourceSurface );
3912+ g_pendingResolves .emplace (args.texture ->sourceSurface );
39093913 }
39103914 else
39113915 {
@@ -4594,7 +4598,7 @@ static void FlushRenderStateForRenderThread()
45944598
45954599 bool foundAny = PopulateBarriersForStretchRect (renderTarget, depthStencil);
45964600
4597- for (const auto surface : g_pendingMsaaResolves )
4601+ for (const auto surface : g_pendingResolves )
45984602 {
45994603 bool isDepthStencil = RenderFormatIsDepth (surface->format );
46004604 foundAny |= PopulateBarriersForStretchRect (isDepthStencil ? nullptr : surface, isDepthStencil ? surface : nullptr );
@@ -4605,15 +4609,15 @@ static void FlushRenderStateForRenderThread()
46054609 FlushBarriers ();
46064610 ExecutePendingStretchRectCommands (renderTarget, depthStencil);
46074611
4608- for (const auto surface : g_pendingMsaaResolves )
4612+ for (const auto surface : g_pendingResolves )
46094613 {
46104614 bool isDepthStencil = RenderFormatIsDepth (surface->format );
46114615 ExecutePendingStretchRectCommands (isDepthStencil ? nullptr : surface, isDepthStencil ? surface : nullptr );
46124616 }
46134617 }
46144618
4615- if (!g_pendingMsaaResolves .empty ())
4616- g_pendingMsaaResolves .clear ();
4619+ if (!g_pendingResolves .empty ())
4620+ g_pendingResolves .clear ();
46174621
46184622 AddBarrier (renderTarget, RenderTextureLayout::COLOR_WRITE );
46194623 AddBarrier (depthStencil, RenderTextureLayout::DEPTH_WRITE );
0 commit comments