mirror of https://github.com/PCSX2/pcsx2.git
GS/Vulkan: Fix clear order in Merge/Interlace
Fixes blank frame when changing resolutions.
This commit is contained in:
parent
ac02bcbe33
commit
5b88e637d8
|
@ -657,12 +657,6 @@ void GSDevice12::DoStretchRect(GSTexture12* sTex, const GSVector4& sRect, GSText
|
|||
BeginRenderPassForStretchRect(dTex, dtex_rc, dst_rc);
|
||||
|
||||
DrawStretchRect(sRect, dRect, size);
|
||||
|
||||
if (!drawing_to_current_rt)
|
||||
{
|
||||
EndRenderPass();
|
||||
static_cast<GSTexture12*>(dTex)->TransitionToState(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
|
||||
}
|
||||
}
|
||||
|
||||
void GSDevice12::DrawStretchRect(const GSVector4& sRect, const GSVector4& dRect, const GSVector2i& ds)
|
||||
|
@ -772,6 +766,7 @@ void GSDevice12::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex,
|
|||
BeginRenderPass(D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE,
|
||||
D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS,
|
||||
D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS, c);
|
||||
dTex->SetState(GSTexture::State::Dirty);
|
||||
}
|
||||
else if (!InRenderPass())
|
||||
{
|
||||
|
@ -828,15 +823,13 @@ void GSDevice12::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool
|
|||
OMSetRenderTargets(dTex, nullptr, rc);
|
||||
SetUtilityRootSignature();
|
||||
SetUtilityTexture(sTex, linear ? m_linear_sampler_cpu : m_point_sampler_cpu);
|
||||
BeginRenderPass(D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE,
|
||||
D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS);
|
||||
BeginRenderPassForStretchRect(static_cast<GSTexture12*>(dTex), rc, rc, false);
|
||||
SetPipeline(m_interlace[shader].get());
|
||||
SetUtilityPushConstants(&cb, sizeof(cb));
|
||||
DrawStretchRect(sRect, dRect, dTex->GetSize());
|
||||
EndRenderPass();
|
||||
|
||||
// this texture is going to get used as an input, so make sure we don't read undefined data
|
||||
static_cast<GSTexture12*>(dTex)->CommitClear();
|
||||
static_cast<GSTexture12*>(dTex)->TransitionToState(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
|
||||
}
|
||||
|
||||
|
@ -850,6 +843,7 @@ void GSDevice12::DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float para
|
|||
SetUtilityTexture(sTex, m_point_sampler_cpu);
|
||||
BeginRenderPass(D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_DISCARD, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE,
|
||||
D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS);
|
||||
dTex->SetState(GSTexture::State::Dirty);
|
||||
SetPipeline(m_shadeboost_pipeline.get());
|
||||
SetUtilityPushConstants(params, sizeof(float) * 4);
|
||||
DrawStretchRect(sRect, GSVector4(dRect), dTex->GetSize());
|
||||
|
@ -868,6 +862,7 @@ void GSDevice12::DoFXAA(GSTexture* sTex, GSTexture* dTex)
|
|||
SetUtilityTexture(sTex, m_linear_sampler_cpu);
|
||||
BeginRenderPass(D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_DISCARD, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE,
|
||||
D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS);
|
||||
dTex->SetState(GSTexture::State::Dirty);
|
||||
SetPipeline(m_fxaa_pipeline.get());
|
||||
DrawStretchRect(sRect, GSVector4(dRect), dTex->GetSize());
|
||||
EndRenderPass();
|
||||
|
|
|
@ -730,7 +730,7 @@ void GSDeviceVK::DoStretchRect(GSTextureVK* sTex, const GSVector4& sRect, GSText
|
|||
if (!is_present)
|
||||
{
|
||||
OMSetRenderTargets(depth ? nullptr : dTex, depth ? dTex : nullptr, dst_rc, false);
|
||||
if (InRenderPass() && !CheckRenderPassArea(dst_rc))
|
||||
if (InRenderPass() && (!CheckRenderPassArea(dst_rc) || dTex->GetState() == GSTexture::State::Cleared))
|
||||
EndRenderPass();
|
||||
}
|
||||
else
|
||||
|
@ -739,17 +739,10 @@ void GSDeviceVK::DoStretchRect(GSTextureVK* sTex, const GSVector4& sRect, GSText
|
|||
m_dirty_flags &= ~(DIRTY_FLAG_VIEWPORT | DIRTY_FLAG_SCISSOR);
|
||||
}
|
||||
|
||||
const bool drawing_to_current_rt = (is_present || InRenderPass());
|
||||
if (!drawing_to_current_rt)
|
||||
if (!is_present && !InRenderPass())
|
||||
BeginRenderPassForStretchRect(dTex, dtex_rc, dst_rc);
|
||||
|
||||
DrawStretchRect(sRect, dRect, size);
|
||||
|
||||
if (!drawing_to_current_rt)
|
||||
{
|
||||
EndRenderPass();
|
||||
static_cast<GSTextureVK*>(dTex)->TransitionToLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||
}
|
||||
}
|
||||
|
||||
void GSDeviceVK::DrawStretchRect(const GSVector4& sRect, const GSVector4& dRect, const GSVector2i& ds)
|
||||
|
@ -889,6 +882,7 @@ void GSDeviceVK::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex,
|
|||
EndRenderPass();
|
||||
OMSetRenderTargets(dTex, nullptr, darea, false);
|
||||
BeginClearRenderPass(m_utility_color_render_pass_clear, darea, c);
|
||||
dTex->SetState(GSTexture::State::Dirty);
|
||||
}
|
||||
else if (!InRenderPass())
|
||||
{
|
||||
|
@ -944,14 +938,12 @@ void GSDeviceVK::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool
|
|||
EndRenderPass();
|
||||
OMSetRenderTargets(dTex, nullptr, rc, false);
|
||||
SetUtilityTexture(sTex, linear ? m_linear_sampler : m_point_sampler);
|
||||
BeginRenderPass(m_utility_color_render_pass_load, rc);
|
||||
BeginRenderPassForStretchRect(static_cast<GSTextureVK*>(dTex), rc, rc, false);
|
||||
SetPipeline(m_interlace[shader]);
|
||||
SetUtilityPushConstants(&cb, sizeof(cb));
|
||||
DrawStretchRect(sRect, dRect, dTex->GetSize());
|
||||
EndRenderPass();
|
||||
|
||||
// this texture is going to get used as an input, so make sure we don't read undefined data
|
||||
static_cast<GSTextureVK*>(dTex)->CommitClear();
|
||||
static_cast<GSTextureVK*>(dTex)->TransitionToLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||
}
|
||||
|
||||
|
@ -963,6 +955,7 @@ void GSDeviceVK::DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float para
|
|||
OMSetRenderTargets(dTex, nullptr, dRect, false);
|
||||
SetUtilityTexture(sTex, m_point_sampler);
|
||||
BeginRenderPass(m_utility_color_render_pass_discard, dRect);
|
||||
dTex->SetState(GSTexture::State::Dirty);
|
||||
SetPipeline(m_shadeboost_pipeline);
|
||||
SetUtilityPushConstants(params, sizeof(float) * 4);
|
||||
DrawStretchRect(sRect, GSVector4(dRect), dTex->GetSize());
|
||||
|
@ -979,6 +972,7 @@ void GSDeviceVK::DoFXAA(GSTexture* sTex, GSTexture* dTex)
|
|||
OMSetRenderTargets(dTex, nullptr, dRect, false);
|
||||
SetUtilityTexture(sTex, m_linear_sampler);
|
||||
BeginRenderPass(m_utility_color_render_pass_discard, dRect);
|
||||
dTex->SetState(GSTexture::State::Dirty);
|
||||
SetPipeline(m_fxaa_pipeline);
|
||||
DrawStretchRect(sRect, GSVector4(dRect), dTex->GetSize());
|
||||
EndRenderPass();
|
||||
|
@ -2434,7 +2428,7 @@ void GSDeviceVK::PSSetShaderResource(int i, GSTexture* sr, bool check_state)
|
|||
{
|
||||
if (vkTex->GetTexture().GetLayout() != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL && InRenderPass())
|
||||
{
|
||||
// Console.Warning("Ending render pass due to resource transition");
|
||||
GL_INS("Ending render pass due to resource transition");
|
||||
EndRenderPass();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue