summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-09-01 19:02:31 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-09-01 19:02:31 +0000
commit590c98bfe02f1758f3828b8e3cc813c0dbee654e (patch)
treee5072aad7d2944a6b03aa1141b1a5ced90975959 /Graphics/GraphicsEngineD3D11
parentDisabled notification messages in OpenGL (diff)
downloadDiligentCore-590c98bfe02f1758f3828b8e3cc813c0dbee654e.tar.gz
DiligentCore-590c98bfe02f1758f3828b8e3cc813c0dbee654e.zip
Updated texture map/unmap intererface; implemented texture mapping in D3D12
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rw-r--r--Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h11
-rw-r--r--Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp16
2 files changed, 21 insertions, 6 deletions
diff --git a/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h b/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h
index 1284c52e..662220a4 100644
--- a/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h
+++ b/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h
@@ -65,8 +65,15 @@ public:
virtual void UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData )override final;
//virtual void CopyData(CTexture *pSrcTexture, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size);
- virtual void Map( IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags, MappedTextureSubresource &MappedData )override final;
- virtual void Unmap( IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags )override final;
+ virtual void Map( IDeviceContext* pContext,
+ Uint32 MipLevel,
+ Uint32 ArraySlice,
+ MAP_TYPE MapType,
+ Uint32 MapFlags,
+ const Box* pMapRegion,
+ MappedTextureSubresource& MappedData )override final;
+
+ virtual void Unmap(IDeviceContext *pContext, Uint32 MipLevel, Uint32 ArraySlice)override final;
virtual ID3D11Resource* GetD3D11Texture()override final{ return m_pd3d11Texture; }
diff --git a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp
index 625b6668..e672cf86 100644
--- a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp
@@ -213,15 +213,22 @@ void TextureBaseD3D11 :: CopyData(IDeviceContext* pContext,
pd3d11DeviceContext->CopySubresourceRegion(m_pd3d11Texture, DstSubRes, DstX, DstY, DstZ, pSrTextureBaseD3D11->GetD3D11Texture(), SrcSubRes, pD3D11SrcBox);
}
-void TextureBaseD3D11 :: Map( IDeviceContext* pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags, MappedTextureSubresource& MappedData )
+void TextureBaseD3D11 :: Map(IDeviceContext* pContext,
+ Uint32 MipLevel,
+ Uint32 ArraySlice,
+ MAP_TYPE MapType,
+ Uint32 MapFlags,
+ const Box* pMapRegion,
+ MappedTextureSubresource& MappedData)
{
- TTextureBase::Map( pContext, Subresource, MapType, MapFlags, MappedData );
+ TTextureBase::Map(pContext, MipLevel, ArraySlice, MapType, MapFlags, pMapRegion, MappedData);
auto* pd3d11DeviceContext = static_cast<DeviceContextD3D11Impl*>(pContext)->GetD3D11DeviceContext();
D3D11_MAP d3d11MapType = static_cast<D3D11_MAP>(0);
UINT d3d11MapFlags = 0;
MapParamsToD3D11MapParams(MapType, MapFlags, d3d11MapType, d3d11MapFlags);
+ auto Subresource = D3D11CalcSubresource(MipLevel, ArraySlice, m_Desc.MipLevels);
D3D11_MAPPED_SUBRESOURCE MappedTex;
auto hr = pd3d11DeviceContext->Map(m_pd3d11Texture, Subresource, d3d11MapType, d3d11MapFlags, &MappedTex);
if( FAILED(hr) )
@@ -237,11 +244,12 @@ void TextureBaseD3D11 :: Map( IDeviceContext* pContext, Uint32 Subresource, MAP_
}
}
-void TextureBaseD3D11::Unmap( IDeviceContext* pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags )
+void TextureBaseD3D11::Unmap( IDeviceContext* pContext, Uint32 MipLevel, Uint32 ArraySlice)
{
- TTextureBase::Unmap( pContext, Subresource, MapType, MapFlags );
+ TTextureBase::Unmap( pContext, MipLevel, ArraySlice);
auto* pd3d11DeviceContext = static_cast<DeviceContextD3D11Impl*>(pContext)->GetD3D11DeviceContext();
+ auto Subresource = D3D11CalcSubresource(MipLevel, ArraySlice, m_Desc.MipLevels);
pd3d11DeviceContext->Unmap(m_pd3d11Texture, Subresource);
}