diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index 3dd78787..0c41d50a 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -2506,50 +2506,6 @@ static void SetRootDescriptor(const UploadAllocation& allocation, size_t index) commandList->setGraphicsRootDescriptor(allocation.buffer->at(allocation.offset), index); } -static bool PopulateBarriersForStretchRect(GuestSurface* renderTarget, GuestSurface* depthStencil) -{ - bool addedAny = false; - - for (const auto surface : { renderTarget, depthStencil }) - { - if (surface != nullptr && !surface->destinationTextures.empty()) - { - const bool multiSampling = surface->sampleCount != RenderSampleCount::COUNT_1; - - RenderTextureLayout srcLayout; - RenderTextureLayout dstLayout; - - if (multiSampling) - { - if (surface == depthStencil) - { - srcLayout = RenderTextureLayout::SHADER_READ; - dstLayout = RenderTextureLayout::DEPTH_WRITE; - } - else - { - srcLayout = RenderTextureLayout::RESOLVE_SOURCE; - dstLayout = RenderTextureLayout::RESOLVE_DEST; - } - } - else - { - srcLayout = RenderTextureLayout::COPY_SOURCE; - dstLayout = RenderTextureLayout::COPY_DEST; - } - - AddBarrier(surface, srcLayout); - - for (const auto texture : surface->destinationTextures) - AddBarrier(texture, dstLayout); - - addedAny = true; - } - } - - return addedAny; -} - static void ProcExecuteCommandList(const RenderCommand& cmd) { if (g_swapChainValid) @@ -3018,6 +2974,50 @@ static void ProcSetDepthStencilSurface(const RenderCommand& cmd) SetDirtyValue(g_dirtyStates.pipelineState, g_pipelineState.depthStencilFormat, args.depthStencil != nullptr ? args.depthStencil->format : RenderFormat::UNKNOWN); } +static bool PopulateBarriersForStretchRect(GuestSurface* renderTarget, GuestSurface* depthStencil) +{ + bool addedAny = false; + + for (const auto surface : { renderTarget, depthStencil }) + { + if (surface != nullptr && !surface->destinationTextures.empty()) + { + const bool multiSampling = surface->sampleCount != RenderSampleCount::COUNT_1; + + RenderTextureLayout srcLayout; + RenderTextureLayout dstLayout; + + if (multiSampling) + { + if (surface == depthStencil) + { + srcLayout = RenderTextureLayout::SHADER_READ; + dstLayout = RenderTextureLayout::DEPTH_WRITE; + } + else + { + srcLayout = RenderTextureLayout::RESOLVE_SOURCE; + dstLayout = RenderTextureLayout::RESOLVE_DEST; + } + } + else + { + srcLayout = RenderTextureLayout::COPY_SOURCE; + dstLayout = RenderTextureLayout::COPY_DEST; + } + + AddBarrier(surface, srcLayout); + + for (const auto texture : surface->destinationTextures) + AddBarrier(texture, dstLayout); + + addedAny = true; + } + } + + return addedAny; +} + static void ExecutePendingStretchRectCommands(GuestSurface* renderTarget, GuestSurface* depthStencil) { auto& commandList = g_commandLists[g_frame];