1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 13:08:50 +01:00

[d3d9] Transition DS too if there's a feedback loop

This commit is contained in:
Robin Kertels 2023-06-21 16:00:51 +02:00 committed by Joshie
parent a20869fb93
commit 60b6e98529

View File

@ -5592,10 +5592,25 @@ namespace dxvk {
void D3D9DeviceEx::MarkRenderHazards() { void D3D9DeviceEx::MarkRenderHazards() {
EmitCs([](DxvkContext* ctx) { EmitCs([
cActiveHazardsRT = m_activeHazardsRT,
cActiveHazardsDS = m_activeHazardsDS
](DxvkContext* ctx) {
VkPipelineStageFlags srcStages = 0;
VkAccessFlags srcAccess = 0;
if (cActiveHazardsRT != 0) {
srcStages |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
srcAccess |= VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
}
if (cActiveHazardsDS != 0) {
srcStages |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
srcAccess |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
}
ctx->emitGraphicsBarrier( ctx->emitGraphicsBarrier(
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, srcStages,
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, srcAccess,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT); VK_ACCESS_SHADER_READ_BIT);
}); });
@ -5608,6 +5623,15 @@ namespace dxvk {
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer); m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
} }
} }
for (uint32_t samplerIdx : bit::BitMask(m_activeHazardsDS)) {
// Guaranteed to not be nullptr...
auto tex = GetCommonTexture(m_state.textures[samplerIdx]);
if (unlikely(!tex->MarkHazardous())) {
TransitionImage(tex, m_hazardLayout);
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
}
}
} }
@ -6400,7 +6424,7 @@ namespace dxvk {
void D3D9DeviceEx::PrepareDraw(D3DPRIMITIVETYPE PrimitiveType) { void D3D9DeviceEx::PrepareDraw(D3DPRIMITIVETYPE PrimitiveType) {
if (unlikely(m_activeHazardsRT != 0)) if (unlikely(m_activeHazardsRT != 0 || m_activeHazardsDS != 0))
MarkRenderHazards(); MarkRenderHazards();
if (unlikely((!m_lastHazardsDS) != (!m_activeHazardsDS)) if (unlikely((!m_lastHazardsDS) != (!m_activeHazardsDS))