Skip to content

Commit 38a4440

Browse files
committed
End render pass in UpdateDepthUAV(). Cleaner code.
1 parent fce9d68 commit 38a4440

File tree

4 files changed

+5
-26
lines changed

4 files changed

+5
-26
lines changed

pcsx2/GS/Renderers/DX12/GSDevice12.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,14 +1349,12 @@ void GSDevice12::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r,
13491349
{
13501350
GL_INS("Target mode transition UAV -> Standard in CopyRect()");
13511351
sTex->SetTargetModeStandard();
1352-
EndRenderPass();
13531352
}
13541353

13551354
if (dTex && dTex->IsTargetModeUAV())
13561355
{
13571356
GL_INS("Target mode transition UAV -> Standard in CopyRect()");
13581357
dTex->SetTargetModeStandard();
1359-
EndRenderPass();
13601358
}
13611359

13621360
// Empty rect, abort copy.
@@ -1559,7 +1557,6 @@ void GSDevice12::DrawMultiStretchRects(
15591557
{
15601558
GL_INS("Target mode transition UAV -> Standard in DrawMultiStretchRects()");
15611559
stex->SetTargetModeStandard();
1562-
EndRenderPass();
15631560
}
15641561

15651562
stex->CommitClear();
@@ -1574,7 +1571,6 @@ void GSDevice12::DrawMultiStretchRects(
15741571
{
15751572
GL_INS("Target mode transition UAV -> Standard in DrawMultiStretchRects()");
15761573
dTex->SetTargetModeStandard();
1577-
EndRenderPass();
15781574
}
15791575

15801576
for (u32 i = 1; i < num_rects; i++)
@@ -1706,14 +1702,12 @@ void GSDevice12::DoStretchRect(GSTexture12* sTex, const GSVector4& sRect, GSText
17061702
{
17071703
GL_INS("Target mode transition UAV -> Standard in DoStretchRect()");
17081704
sTex->SetTargetModeStandard();
1709-
EndRenderPass();
17101705
}
17111706

17121707
if (dTex && dTex->IsTargetModeUAV())
17131708
{
17141709
GL_INS("Target mode transition UAV -> Standard in DoStretchRect()");
17151710
dTex->SetTargetModeStandard();
1716-
EndRenderPass();
17171711
}
17181712

17191713
if (sTex->GetResourceState() != D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE)
@@ -1793,7 +1787,6 @@ void GSDevice12::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex,
17931787
{
17941788
GL_INS("Target mode transition UAV -> Standard in DoMerge()");
17951789
sTex[i]->SetTargetModeStandard();
1796-
EndRenderPass();
17971790
}
17981791
}
17991792

@@ -2264,7 +2257,6 @@ void GSDevice12::OMSetRenderTargets(GSTexture* rt, GSTexture* ds_as_rt, GSTextur
22642257
GL_INS("Target mode transition UAV -> Standard in OMSetRenderTarget()");
22652258
EndRenderPass();
22662259
tex->SetTargetModeStandard();
2267-
EndRenderPass(); // Updating depth <-> UAV might have started a render pass
22682260
}
22692261
}
22702262

@@ -3410,7 +3402,6 @@ void GSDevice12::PSSetUnorderedAccess(int i, GSTexture* uav, bool check_state)
34103402
{
34113403
GL_INS("Target mode transition * -> UAV in PSSetUnorderedAccess()");
34123404
dtex->SetTargetModeUAV();
3413-
EndRenderPass(); // We may have used a render pass for depth -> UAV conversion.
34143405
// Clears will be handled in SendHWDraw().
34153406
}
34163407

@@ -3462,7 +3453,6 @@ void GSDevice12::SetUtilityTexture(GSTexture* dtex, const D3D12DescriptorHandle&
34623453
{
34633454
GL_INS("Target mode transition UAV -> Standard in SetUtilityTexture()");
34643455
d12tex->SetTargetModeStandard();
3465-
EndRenderPass();
34663456
}
34673457
d12tex->CommitClear();
34683458
d12tex->TransitionToState(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
@@ -4190,7 +4180,6 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
41904180
{
41914181
GL_INS("Target mode transition UAV -> Standard in RenderHW() (read-only depth SRV)");
41924182
draw_ds->SetTargetModeStandard();
4193-
EndRenderPass();
41944183
}
41954184

41964185
// Transition dsv as read only.

pcsx2/GS/Renderers/DX12/GSTexture12.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ bool GSTexture12::Update(const GSVector4i& r, const void* data, int pitch, int l
508508
{
509509
GL_INS("Target mode transition UAV -> Standard in Update()");
510510
SetTargetModeStandard();
511-
GSDevice12::GetInstance()->EndRenderPass();
512511
}
513512

514513
g_perfmon.Put(GSPerfMon::TextureUploads, 1);
@@ -603,7 +602,6 @@ bool GSTexture12::Map(GSMap& m, const GSVector4i* r, int layer)
603602
{
604603
GL_INS("Target mode transition UAV -> Standard in Map()");
605604
SetTargetModeStandard();
606-
GSDevice12::GetInstance()->EndRenderPass();
607605
}
608606

609607
// map for writing
@@ -907,15 +905,15 @@ void GSTexture12::UpdateDepthUAV(bool uav_to_ds)
907905
{
908906
// UAV to DS
909907

910-
// Using the depth UAV like this bypasses its status as UAV so we must
911-
// issue UAV barrier explicitly here.
908+
// Using the depth UAV like this bypasses its status as UAV so we must issue UAV barrier explicitly here.
912909
IssueUAVBarrierInternal(device->GetCommandList());
913910

914911
static_cast<GSTexture12*>(m_uav_depth.get())->TransitionToState(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
915912
TransitionToState(D3D12_RESOURCE_STATE_DEPTH_WRITE);
916913

917914
GSVector4 dRect(0.0f, 0.0f, static_cast<float>(GetWidth()), static_cast<float>(GetHeight()));
918915
device->StretchRect(m_uav_depth.get(), this, dRect, ShaderConvert::FLOAT32_COLOR_TO_DEPTH, false);
916+
device->EndRenderPass();
919917
}
920918
else
921919
{
@@ -925,6 +923,7 @@ void GSTexture12::UpdateDepthUAV(bool uav_to_ds)
925923

926924
GSVector4 dRect(0.0f, 0.0f, static_cast<float>(GetWidth()), static_cast<float>(GetHeight()));
927925
device->StretchRect(this, m_uav_depth.get(), dRect, ShaderConvert::FLOAT32_DEPTH_TO_COLOR, false);
926+
device->EndRenderPass();
928927
}
929928
}
930929

pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2869,14 +2869,12 @@ void GSDeviceVK::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r,
28692869
{
28702870
GL_INS("Target mode transition UAV -> Standard in CopyRect()");
28712871
sTex->SetTargetModeStandard();
2872-
EndRenderPass();
28732872
}
28742873

28752874
if (dTex && dTex->IsTargetModeUAV())
28762875
{
28772876
GL_INS("Target mode transition UAV -> Standard in CopyRect()");
28782877
dTex->SetTargetModeStandard();
2879-
EndRenderPass();
28802878
}
28812879

28822880
GSTextureVK* const sTexVK = static_cast<GSTextureVK*>(sTex);
@@ -2992,7 +2990,6 @@ void GSDeviceVK::DrawMultiStretchRects(
29922990
{
29932991
GL_INS("Target mode transition UAV -> Standard in DrawMultiStretchRects()");
29942992
stex->SetTargetModeStandard();
2995-
EndRenderPass();
29962993
}
29972994

29982995
stex->CommitClear();
@@ -3007,7 +3004,6 @@ void GSDeviceVK::DrawMultiStretchRects(
30073004
{
30083005
GL_INS("Target mode transition UAV -> Standard in DrawMultiStretchRects()");
30093006
dTex->SetTargetModeStandard();
3010-
EndRenderPass();
30113007
}
30123008

30133009
for (u32 i = 1; i < num_rects; i++)
@@ -3152,14 +3148,12 @@ void GSDeviceVK::DoStretchRect(GSTextureVK* sTex, const GSVector4& sRect, GSText
31523148
{
31533149
GL_INS("Target mode transition UAV -> Standard in DoStretchRect()");
31543150
sTex->SetTargetModeStandard();
3155-
EndRenderPass();
31563151
}
31573152

31583153
if (dTex && dTex->IsTargetModeUAV())
31593154
{
31603155
GL_INS("Target mode transition UAV -> Standard in DoStretchRect()");
31613156
dTex->SetTargetModeStandard();
3162-
EndRenderPass();
31633157
}
31643158

31653159
if (sTex->GetLayout() != GSTextureVK::Layout::ShaderReadOnly)
@@ -3331,7 +3325,6 @@ void GSDeviceVK::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex,
33313325
{
33323326
GL_INS("Target mode transition UAV -> Standard in DoMerge()");
33333327
sTex[i]->SetTargetModeStandard();
3334-
EndRenderPass();
33353328
}
33363329
}
33373330

@@ -3542,7 +3535,6 @@ void GSDeviceVK::OMSetRenderTargets(
35423535
GL_INS("Target mode transition UAV -> Standard in OMSetRenderTarget()");
35433536
EndRenderPass();
35443537
tex->SetTargetModeStandard();
3545-
EndRenderPass(); // Updating depth <-> UAV might have started a render pass
35463538
}
35473539
}
35483540

@@ -5305,7 +5297,6 @@ void GSDeviceVK::PSSetUnorderedAccess(int i, GSTexture* tex, bool check_state, b
53055297
{
53065298
GL_INS("Target mode transition * -> UAV in PSSetUnorderedAccess()");
53075299
tex->SetTargetModeUAV();
5308-
EndRenderPass(); // In case we started a render pass to update/resolve depth UAV.
53095300
}
53105301

53115302
PSSetShaderResource(i, tex, true, false);
@@ -5392,7 +5383,6 @@ void GSDeviceVK::SetUtilityTexture(GSTexture* tex, VkSampler sampler)
53925383
{
53935384
GL_INS("Target mode transition UAV -> Standard in SetUtilityTexture()");
53945385
vkTex->SetTargetModeStandard();
5395-
EndRenderPass();
53965386
}
53975387
vkTex->CommitClear();
53985388
vkTex->TransitionToLayout(GSTextureVK::Layout::ShaderReadOnly);

pcsx2/GS/Renderers/Vulkan/GSTextureVK.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ void GSTextureVK::UpdateDepthUAV(bool uav_to_ds)
634634

635635
GSVector4 dRect(0.0f, 0.0f, static_cast<float>(GetWidth()), static_cast<float>(GetHeight()));
636636
device->StretchRect(m_uav_depth.get(), this, dRect, ShaderConvert::FLOAT32_COLOR_TO_DEPTH, false);
637+
device->EndRenderPass();
637638
}
638639
else
639640
{
@@ -643,6 +644,7 @@ void GSTextureVK::UpdateDepthUAV(bool uav_to_ds)
643644

644645
GSVector4 dRect(0.0f, 0.0f, static_cast<float>(GetWidth()), static_cast<float>(GetHeight()));
645646
device->StretchRect(this, m_uav_depth.get(), dRect, ShaderConvert::FLOAT32_DEPTH_TO_COLOR, false);
647+
device->EndRenderPass();
646648
}
647649
}
648650

@@ -981,7 +983,6 @@ void GSDownloadTextureVK::CopyFromTexture(
981983
{
982984
GL_INS("Target mode transition UAV -> Standard in CopyFromTexture()");
983985
vkTex->SetTargetModeStandard();
984-
GSDeviceVK::GetInstance()->EndRenderPass();
985986
}
986987

987988
pxAssert(vkTex->GetFormat() == m_format);

0 commit comments

Comments
 (0)