Skip to content

Commit eab8b92

Browse files
GS/DX11: Cleanup some multidraw fb copy code.
Remove skip first barrier check, rely on the one barrier parameter being set to false. Other misc cleanup.
1 parent 4aa72d9 commit eab8b92

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

pcsx2/GS/Renderers/DX11/GSDevice11.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2864,9 +2864,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
28642864
if (draw_rt && (config.require_one_barrier || (config.require_full_barrier && m_features.multidraw_fb_copy) || (config.tex && config.tex == config.rt)))
28652865
{
28662866
// Requires a copy of the RT.
2867-
// Used as "bind rt" flag when texture barrier is unsupported for tex is fb.
28682867
draw_rt_clone = CreateTexture(rtsize.x, rtsize.y, 1, draw_rt->GetFormat(), true);
2869-
28702868
if (!draw_rt_clone)
28712869
Console.Warning("D3D11: Failed to allocate temp texture for RT copy.");
28722870
}
@@ -2875,9 +2873,8 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
28752873
config.ps.IsFeedbackLoopDepth())
28762874
{
28772875
// Requires a copy of the DS.
2878-
// Used as "bind ds" flag when texture barrier is unsupported for tex is fb.
28792876
draw_ds_clone = CreateTexture(rtsize.x, rtsize.y, 1, draw_ds->GetFormat(), true);
2880-
if (!draw_rt_clone)
2877+
if (!draw_ds_clone)
28812878
Console.Warning("D3D11: Failed to allocate temp texture for DS copy.");
28822879
}
28832880

@@ -2889,7 +2886,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
28892886
m_ctx->ClearDepthStencilView(*static_cast<GSTexture11*>(draw_ds), D3D11_CLEAR_STENCIL, 0.0f, 1);
28902887

28912888
SendHWDraw(config, draw_rt_clone, draw_rt, draw_ds_clone, draw_ds,
2892-
config.require_one_barrier, config.require_full_barrier, false);
2889+
config.require_one_barrier, config.require_full_barrier);
28932890

28942891
if (config.blend_multi_pass.enable)
28952892
{
@@ -2916,7 +2913,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
29162913

29172914
SetupOM(config.alpha_second_pass.depth, OMBlendSelector(config.alpha_second_pass.colormask, config.blend), config.blend.constant);
29182915
SendHWDraw(config, draw_rt_clone, draw_rt, draw_ds_clone, draw_ds,
2919-
config.alpha_second_pass.require_one_barrier, config.alpha_second_pass.require_full_barrier, true);
2916+
false, config.alpha_second_pass.require_full_barrier);
29202917
}
29212918

29222919
if (colclip_rt)
@@ -2938,7 +2935,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
29382935

29392936
void GSDevice11::SendHWDraw(const GSHWDrawConfig& config,
29402937
GSTexture* draw_rt_clone, GSTexture* draw_rt, GSTexture* draw_ds_clone, GSTexture* draw_ds,
2941-
const bool one_barrier, const bool full_barrier, const bool skip_first_barrier)
2938+
const bool one_barrier, const bool full_barrier)
29422939
{
29432940
if (draw_rt_clone || draw_ds_clone)
29442941
{
@@ -2956,13 +2953,13 @@ void GSDevice11::SendHWDraw(const GSHWDrawConfig& config,
29562953
PSSetShaderResource(2, draw_rt_clone);
29572954
if ((one_barrier || full_barrier) && draw_ds_clone)
29582955
PSSetShaderResource(4, draw_ds_clone);
2959-
if (config.tex && config.tex == config.rt)
2956+
if (config.tex && config.tex == draw_rt)
29602957
PSSetShaderResource(0, draw_rt_clone);
29612958
};
29622959

2963-
const GSVector4i rtsize(0, 0, draw_rt->GetWidth(), draw_rt->GetHeight());
2960+
const GSVector4i rtsize(0, 0, (draw_rt ? draw_rt : draw_ds)->GetWidth(), (draw_rt ? draw_rt : draw_ds)->GetHeight());
29642961

2965-
if (m_features.multidraw_fb_copy && full_barrier)
2962+
if (full_barrier)
29662963
{
29672964
const u32 draw_list_size = static_cast<u32>(config.drawlist->size());
29682965
const u32 indices_per_prim = config.indices_per_prim;
@@ -2985,8 +2982,7 @@ void GSDevice11::SendHWDraw(const GSHWDrawConfig& config,
29852982
}
29862983

29872984
// Optimization: For alpha second pass we can reuse the copy snapshot from the first pass.
2988-
if (!skip_first_barrier)
2989-
CopyAndBind(ProcessCopyArea(rtsize, config.drawarea));
2985+
CopyAndBind(ProcessCopyArea(rtsize, config.drawarea));
29902986
}
29912987

29922988
DrawIndexedPrimitive();

pcsx2/GS/Renderers/DX11/GSDevice11.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ class GSDevice11 final : public GSDevice
356356
void RenderHW(GSHWDrawConfig& config) override;
357357
void SendHWDraw(const GSHWDrawConfig& config,
358358
GSTexture* draw_rt_clone, GSTexture* draw_rt, GSTexture* draw_ds_clone, GSTexture* draw_ds,
359-
const bool one_barrier, const bool full_barrier, const bool skip_first_barrier);
359+
const bool one_barrier, const bool full_barrier);
360360

361361
void ClearSamplerCache() override;
362362

0 commit comments

Comments
 (0)