summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-11-10 06:17:46 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-11-10 06:17:46 +0000
commit9e62ec0d4b9c7ea9d6fc3d19b9d29481dffb697c (patch)
treef9f26c569259ec3b83c9b19dbe0c40f472243ce6 /Graphics/GraphicsEngineD3D11
parentAllowed swap chains without the depth buffer (diff)
downloadDiligentCore-9e62ec0d4b9c7ea9d6fc3d19b9d29481dffb697c.tar.gz
DiligentCore-9e62ec0d4b9c7ea9d6fc3d19b9d29481dffb697c.zip
Added 'ResolveTextureSubresource' device context command (API Version 240041) (not yet implemented in OpenGL backend)
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rwxr-xr-xGraphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h5
-rwxr-xr-xGraphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp21
-rw-r--r--Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp2
3 files changed, 27 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h
index 3ecb3388..81d40cb4 100755
--- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h
+++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h
@@ -184,6 +184,11 @@ public:
/// Implementation of IDeviceContext::TransitionResourceStates() in Direct3D11 backend.
virtual void TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers)override final;
+ /// Implementation of IDeviceContext::ResolveTextureSubresource() in Direct3D11 backend.
+ virtual void ResolveTextureSubresource(ITexture* pSrcTexture,
+ ITexture* pDstTexture,
+ const ResolveTextureSubresourceAttribs& ResolveAttribs)override final;
+
/// Implementation of IDeviceContext::FinishCommandList() in Direct3D11 backend.
void FinishCommandList(class ICommandList** ppCommandList)override final;
diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
index 7a4c1762..93e7362c 100755
--- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
@@ -2051,6 +2051,27 @@ namespace Diligent
}
}
+ void DeviceContextD3D11Impl::ResolveTextureSubresource(ITexture* pSrcTexture,
+ ITexture* pDstTexture,
+ const ResolveTextureSubresourceAttribs& ResolveAttribs)
+ {
+ TDeviceContextBase::ResolveTextureSubresource(pSrcTexture, pDstTexture, ResolveAttribs);
+
+ auto* pSrcTexD3D11 = ValidatedCast<TextureBaseD3D11>(pSrcTexture);
+ auto* pDstTexD3D11 = ValidatedCast<TextureBaseD3D11>(pDstTexture);
+ const auto& SrcTexDesc = pSrcTexD3D11->GetDesc();
+ const auto& DstTexDesc = pDstTexD3D11->GetDesc();
+
+ auto Format = ResolveAttribs.Format;
+ if (Format == TEX_FORMAT_UNKNOWN)
+ Format = SrcTexDesc.Format;
+
+ auto DXGIFmt = TexFormatToDXGI_Format(Format);
+ auto SrcSubresIndex = D3D11CalcSubresource(ResolveAttribs.SrcMipLevel, ResolveAttribs.SrcSlice, SrcTexDesc.MipLevels);
+ auto DstSubresIndex = D3D11CalcSubresource(ResolveAttribs.DstMipLevel, ResolveAttribs.DstSlice, DstTexDesc.MipLevels);
+ m_pd3d11DeviceContext->ResolveSubresource(pDstTexD3D11->GetD3D11Texture(), DstSubresIndex, pSrcTexD3D11->GetD3D11Texture(), SrcSubresIndex, DXGIFmt);
+ }
+
#ifdef VERIFY_CONTEXT_BINDINGS
DEFINE_D3D11CTX_FUNC_POINTERS(GetCBMethods, GetConstantBuffers)
DEFINE_D3D11CTX_FUNC_POINTERS(GetSRVMethods, GetShaderResources)
diff --git a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp
index 4b6797e4..b11955f5 100644
--- a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp
@@ -91,7 +91,7 @@ void SwapChainD3D11Impl::CreateRTVandDSV()
DepthBufferDesc.MipLevels = 1;
DepthBufferDesc.ArraySize = 1;
DepthBufferDesc.Format = m_SwapChainDesc.DepthBufferFormat;
- DepthBufferDesc.SampleCount = m_SwapChainDesc.SamplesCount;
+ DepthBufferDesc.SampleCount = 1;
DepthBufferDesc.Usage = USAGE_DEFAULT;
DepthBufferDesc.BindFlags = BIND_DEPTH_STENCIL;
DepthBufferDesc.CPUAccessFlags = CPU_ACCESS_NONE;