diff --git a/plugins/GSdx/Renderers/DX11/GSDevice11.cpp b/plugins/GSdx/Renderers/DX11/GSDevice11.cpp index a99537e756..5316c9ae25 100644 --- a/plugins/GSdx/Renderers/DX11/GSDevice11.cpp +++ b/plugins/GSdx/Renderers/DX11/GSDevice11.cpp @@ -552,7 +552,7 @@ GSTexture* GSDevice11::CreateSurface(int type, int w, int h, bool msaa, int form desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE; break; case GSTexture::DepthStencil: - desc.BindFlags = D3D11_BIND_DEPTH_STENCIL; + desc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE; break; case GSTexture::Texture: desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; @@ -599,7 +599,7 @@ GSTexture* GSDevice11::CreateRenderTarget(int w, int h, bool msaa, int format) GSTexture* GSDevice11::CreateDepthStencil(int w, int h, bool msaa, int format) { - return __super::CreateDepthStencil(w, h, msaa, format ? format : DXGI_FORMAT_D32_FLOAT_S8X24_UINT); // DXGI_FORMAT_R32G8X24_TYPELESS + return __super::CreateDepthStencil(w, h, msaa, format ? format : DXGI_FORMAT_R32G8X24_TYPELESS); } GSTexture* GSDevice11::CreateTexture(int w, int h, int format) @@ -637,12 +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 && format != DXGI_FORMAT_R32_UINT) - { - ASSERT(0); - - return false; - } + ASSERT(format == DXGI_FORMAT_R8G8B8A8_UNORM || format == DXGI_FORMAT_R16_UINT || format == DXGI_FORMAT_R32_UINT); if(GSTexture* rt = CreateRenderTarget(w, h, false, format)) { diff --git a/plugins/GSdx/Renderers/DX11/GSTexture11.cpp b/plugins/GSdx/Renderers/DX11/GSTexture11.cpp index 41068b7498..7d19c9d372 100644 --- a/plugins/GSdx/Renderers/DX11/GSTexture11.cpp +++ b/plugins/GSdx/Renderers/DX11/GSTexture11.cpp @@ -210,7 +210,20 @@ GSTexture11::operator ID3D11ShaderResourceView*() { ASSERT(!m_msaa); - m_dev->CreateShaderResourceView(m_texture, NULL, &m_srv); + if(m_desc.Format == DXGI_FORMAT_R32G8X24_TYPELESS) + { + D3D11_SHADER_RESOURCE_VIEW_DESC srvd = {}; + + srvd.Format = DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS; + srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + srvd.Texture2D.MipLevels = 1; + + m_dev->CreateShaderResourceView(m_texture, &srvd, &m_srv); + } + else + { + m_dev->CreateShaderResourceView(m_texture, NULL, &m_srv); + } } return m_srv; @@ -244,7 +257,19 @@ GSTexture11::operator ID3D11DepthStencilView*() { if(!m_dsv && m_dev && m_texture) { - m_dev->CreateDepthStencilView(m_texture, NULL, &m_dsv); + if(m_desc.Format == DXGI_FORMAT_R32G8X24_TYPELESS) + { + D3D11_DEPTH_STENCIL_VIEW_DESC dsvd = {}; + + dsvd.Format = DXGI_FORMAT_D32_FLOAT_S8X24_UINT; + dsvd.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; + + m_dev->CreateDepthStencilView(m_texture, &dsvd, &m_dsv); + } + else + { + m_dev->CreateDepthStencilView(m_texture, NULL, &m_dsv); + } } return m_dsv;