Revert "GS/DX11: Optimize shader copies states."

This reverts commit d178c451d8.
This commit is contained in:
lightningterror
2026-03-05 14:46:12 +01:00
parent 22cdc36aff
commit 96a6cfbf6f
2 changed files with 23 additions and 16 deletions
+21 -15
View File
@@ -495,6 +495,16 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
m_dev->CreateDepthStencilState(&dsd, m_date.dss.put());
// blend
{
D3D11_BLEND_DESC blend;
memset(&blend, 0, sizeof(blend));
m_dev->CreateBlendState(&blend, m_date.bs.put());
}
for (size_t i = 0; i < std::size(m_date.primid_init_ps); i++)
{
const std::string entry_point(StringUtil::StdStringFromFormat("ps_stencil_image_init_%zu", i));
@@ -1336,7 +1346,9 @@ void GSDevice11::DoStretchRect(GSTexture* sTex, const GSVector4& sRect, GSTextur
if (draw_in_depth)
OMSetDepthStencilState(m_convert.dss_write.get(), 0);
else
OMSetBlendState(bs, 0);
OMSetDepthStencilState(m_convert.dss.get(), 0);
OMSetBlendState(bs, 0);
// ia
@@ -1408,6 +1420,7 @@ void GSDevice11::PresentRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
// om
OMSetDepthStencilState(m_convert.dss.get(), 0);
OMSetBlendState(m_convert.bs[D3D11_COLOR_WRITE_ENABLE_ALL].get(), 0);
// ia
@@ -1513,15 +1526,8 @@ void GSDevice11::DrawMultiStretchRects(const MultiStretchRect* rects, u32 num_re
PSSetShader(m_convert.ps[static_cast<int>(shader)].get(), nullptr);
PSUnbindConflictingSRVs(dTex);
const bool draw_in_depth = dTex->IsDepthStencil();
if (draw_in_depth)
{
OMSetDepthStencilState(m_convert.dss_write.get(), 0);
OMSetRenderTargets(nullptr, dTex);
}
else
OMSetRenderTargets(dTex, nullptr);
OMSetDepthStencilState(dTex->IsRenderTarget() ? m_convert.dss.get() : m_convert.dss_write.get(), 0);
OMSetRenderTargets(dTex->IsRenderTarget() ? dTex : nullptr, dTex->IsDepthStencil() ? dTex : nullptr);
const GSVector2 ds(static_cast<float>(dTex->GetWidth()), static_cast<float>(dTex->GetHeight()));
GSTexture* last_tex = rects[0].src;
@@ -1539,7 +1545,7 @@ void GSDevice11::DrawMultiStretchRects(const MultiStretchRect* rects, u32 num_re
continue;
}
DoMultiStretchRects(rects + first, count, ds, draw_in_depth);
DoMultiStretchRects(rects + first, count, ds);
last_tex = rects[i].src;
last_linear = rects[i].linear;
last_wmask = rects[i].wmask.wrgba;
@@ -1547,10 +1553,10 @@ void GSDevice11::DrawMultiStretchRects(const MultiStretchRect* rects, u32 num_re
count = 1;
}
DoMultiStretchRects(rects + first, count, ds, draw_in_depth);
DoMultiStretchRects(rects + first, count, ds);
}
void GSDevice11::DoMultiStretchRects(const MultiStretchRect* rects, u32 num_rects, const GSVector2& ds, const bool draw_in_depth)
void GSDevice11::DoMultiStretchRects(const MultiStretchRect* rects, u32 num_rects, const GSVector2& ds)
{
g_perfmon.Put(GSPerfMon::TextureCopies, 1);
@@ -1598,8 +1604,7 @@ void GSDevice11::DoMultiStretchRects(const MultiStretchRect* rects, u32 num_rect
PSSetShaderResource(0, rects[0].src);
PSSetSamplerState(rects[0].linear ? m_convert.ln.get() : m_convert.pt.get());
if (!draw_in_depth)
OMSetBlendState(m_convert.bs[rects[0].wmask.wrgba].get(), 0.0f);
OMSetBlendState(m_convert.bs[rects[0].wmask.wrgba].get(), 0.0f);
DrawIndexedPrimitive();
}
@@ -2220,6 +2225,7 @@ void GSDevice11::SetupDATE(GSTexture* rt, GSTexture* ds, SetDATM datm, const GSV
// om
OMSetDepthStencilState(m_date.dss.get(), 1);
OMSetBlendState(m_date.bs.get(), 0);
OMSetRenderTargets(nullptr, ds);
// ia
+2 -1
View File
@@ -221,6 +221,7 @@ private:
struct
{
wil::com_ptr_nothrow<ID3D11DepthStencilState> dss;
wil::com_ptr_nothrow<ID3D11BlendState> bs;
wil::com_ptr_nothrow<ID3D11PixelShader> primid_init_ps[4];
} m_date;
@@ -315,7 +316,7 @@ public:
void ConvertToIndexedTexture(GSTexture* sTex, float sScale, u32 offsetX, u32 offsetY, u32 SBW, u32 SPSM, GSTexture* dTex, u32 DBW, u32 DPSM) override;
void FilteredDownsampleTexture(GSTexture* sTex, GSTexture* dTex, u32 downsample_factor, const GSVector2i& clamp_min, const GSVector4& dRect) override;
void DrawMultiStretchRects(const MultiStretchRect* rects, u32 num_rects, GSTexture* dTex, ShaderConvert shader) override;
void DoMultiStretchRects(const MultiStretchRect* rects, u32 num_rects, const GSVector2& ds, const bool draw_in_depth);
void DoMultiStretchRects(const MultiStretchRect* rects, u32 num_rects, const GSVector2& ds);
void SetupDATE(GSTexture* rt, GSTexture* ds, SetDATM datm, const GSVector4i& bbox);