mirror of https://github.com/PCSX2/pcsx2.git
GSdx-d3d: Add support to write in depth buffer.
Add support for dss_write. Enable writing in depth buffer for dss_write, when depth conversion is active data will be writen in the depth buffer, if not then use the old method (don't write).
This commit is contained in:
parent
9a5bf12c0b
commit
4328d099c4
|
@ -221,11 +221,14 @@ bool GSDevice11::Create(const std::shared_ptr<GSWnd> &wnd)
|
|||
|
||||
memset(&dsd, 0, sizeof(dsd));
|
||||
|
||||
dsd.DepthEnable = false;
|
||||
dsd.StencilEnable = false;
|
||||
|
||||
hr = m_dev->CreateDepthStencilState(&dsd, &m_convert.dss);
|
||||
|
||||
dsd.DepthEnable = true;
|
||||
dsd.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
|
||||
dsd.DepthFunc = D3D11_COMPARISON_ALWAYS;
|
||||
|
||||
hr = m_dev->CreateDepthStencilState(&dsd, &m_convert.dss_write);
|
||||
|
||||
memset(&bsd, 0, sizeof(bsd));
|
||||
|
||||
bsd.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
|
||||
|
@ -634,7 +637,7 @@ GSTexture* GSDevice11::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int
|
|||
format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
}
|
||||
|
||||
if(format != DXGI_FORMAT_R8G8B8A8_UNORM && format != DXGI_FORMAT_R16_UINT)
|
||||
if(format != DXGI_FORMAT_R8G8B8A8_UNORM && format != DXGI_FORMAT_R16_UINT && format != DXGI_FORMAT_R32_UINT)
|
||||
{
|
||||
ASSERT(0);
|
||||
|
||||
|
@ -696,15 +699,27 @@ void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
|||
return;
|
||||
}
|
||||
|
||||
bool draw_in_depth = (ps == m_convert.ps[ShaderConvert_RGBA8_TO_FLOAT32] || ps == m_convert.ps[ShaderConvert_RGBA8_TO_FLOAT24] ||
|
||||
ps == m_convert.ps[ShaderConvert_RGBA8_TO_FLOAT16] || ps == m_convert.ps[ShaderConvert_RGB5A1_TO_FLOAT16]);
|
||||
|
||||
BeginScene();
|
||||
|
||||
GSVector2i ds = dTex->GetSize();
|
||||
|
||||
// om
|
||||
|
||||
OMSetDepthStencilState(m_convert.dss, 0);
|
||||
|
||||
if (draw_in_depth)
|
||||
OMSetDepthStencilState(m_convert.dss_write, 0);
|
||||
else
|
||||
OMSetDepthStencilState(m_convert.dss, 0);
|
||||
|
||||
OMSetBlendState(bs, 0);
|
||||
OMSetRenderTargets(dTex, NULL);
|
||||
|
||||
if (draw_in_depth)
|
||||
OMSetRenderTargets(NULL, dTex);
|
||||
else
|
||||
OMSetRenderTargets(dTex, NULL);
|
||||
|
||||
// ia
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ public: // TODO
|
|||
CComPtr<ID3D11SamplerState> ln;
|
||||
CComPtr<ID3D11SamplerState> pt;
|
||||
CComPtr<ID3D11DepthStencilState> dss;
|
||||
CComPtr<ID3D11DepthStencilState> dss_write;
|
||||
CComPtr<ID3D11BlendState> bs;
|
||||
} m_convert;
|
||||
|
||||
|
|
Loading…
Reference in New Issue