summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-11-25 04:31:42 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-11-25 04:31:42 +0000
commit17b24246757390d29be93ce3447745e7b4936f5a (patch)
tree7c0ad81014bd2c61debf7f3b4c89c445eab73beb /Graphics/GraphicsEngine
parentUpdated parameter order of IDeviceContext::CopyBuffer (diff)
downloadDiligentCore-17b24246757390d29be93ce3447745e7b4936f5a.tar.gz
DiligentCore-17b24246757390d29be93ce3447745e7b4936f5a.zip
Renamed/moved ITexture::Map() to IDeviceContext::MapTextureSubresource()
Renamed/moved ITexture::Unmap() to IDeviceContext::UnmapTextureSubresource()
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/DeviceContextBase.h35
-rw-r--r--Graphics/GraphicsEngine/include/TextureBase.h30
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceContext.h25
-rw-r--r--Graphics/GraphicsEngine/interface/Texture.h24
4 files changed, 60 insertions, 54 deletions
diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.h b/Graphics/GraphicsEngine/include/DeviceContextBase.h
index 1345702b..d80eca83 100644
--- a/Graphics/GraphicsEngine/include/DeviceContextBase.h
+++ b/Graphics/GraphicsEngine/include/DeviceContextBase.h
@@ -130,6 +130,18 @@ public:
Uint32 DstY,
Uint32 DstZ )override = 0;
+ /// Base implementaiton of IDeviceContext::MapTextureSubresource()
+ virtual void MapTextureSubresource(ITexture* pTexture,
+ Uint32 MipLevel,
+ Uint32 ArraySlice,
+ MAP_TYPE MapType,
+ Uint32 MapFlags,
+ const Box* pMapRegion,
+ MappedTextureSubresource& MappedData)override = 0;
+
+ /// Base implementaiton of IDeviceContext::UnmapTextureSubresource()
+ virtual void UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice)override = 0;
+
/// Sets the strong pointer to the swap chain
virtual void SetSwapChain( ISwapChain* pSwapChain )override final { m_pSwapChain = pSwapChain; }
@@ -702,6 +714,29 @@ inline void DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType
pDstTexture->GetDesc(), DstMipLevel, DstSlice, DstX, DstY, DstZ );
}
+template<typename BaseInterface, typename BufferImplType, typename TextureViewImplType, typename PipelineStateImplType>
+inline void DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType, PipelineStateImplType> ::
+ MapTextureSubresource(ITexture* pTexture,
+ Uint32 MipLevel,
+ Uint32 ArraySlice,
+ MAP_TYPE MapType,
+ Uint32 MapFlags,
+ const Box* pMapRegion,
+ MappedTextureSubresource& MappedData)
+{
+ VERIFY(pTexture, "pTexture must not be null");
+ ValidateMapTextureParams(pTexture->GetDesc(), MipLevel, ArraySlice, MapType, MapFlags, pMapRegion);
+}
+
+template<typename BaseInterface, typename BufferImplType, typename TextureViewImplType, typename PipelineStateImplType>
+inline void DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType, PipelineStateImplType> ::
+ UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice)
+{
+ VERIFY(pTexture, "pTexture must not be null");
+ DEV_CHECK_ERR(MipLevel < pTexture->GetDesc().MipLevels, "Mip level is out of range");
+ DEV_CHECK_ERR(ArraySlice < pTexture->GetDesc().ArraySize, "Array slice is out of range");
+}
+
#ifdef DEVELOPMENT
template<typename BaseInterface, typename BufferImplType, typename TextureViewImplType, typename PipelineStateImplType>
diff --git a/Graphics/GraphicsEngine/include/TextureBase.h b/Graphics/GraphicsEngine/include/TextureBase.h
index 08598346..1a9e11c1 100644
--- a/Graphics/GraphicsEngine/include/TextureBase.h
+++ b/Graphics/GraphicsEngine/include/TextureBase.h
@@ -141,18 +141,6 @@ public:
CreateViewInternal( ViewDesc, ppView, false );
}
- /// Base implementaiton of ITexture::Map()
- virtual void Map(IDeviceContext* pContext,
- Uint32 MipLevel,
- Uint32 ArraySlice,
- MAP_TYPE MapType,
- Uint32 MapFlags,
- const Box* pMapRegion,
- MappedTextureSubresource& MappedData)override = 0;
-
- /// Base implementaiton of ITexture::Unmap()
- virtual void Unmap( IDeviceContext* pContext, Uint32 MipLevel, Uint32 ArraySlice)override = 0;
-
/// Creates default texture views.
///
@@ -487,22 +475,4 @@ void TextureBase<BaseInterface, TRenderDeviceImpl, TTextureViewImpl, TTexViewObj
}
}
-template<class BaseInterface, class TRenderDeviceImpl,class TTextureViewImpl, class TTexViewObjAllocator>
-void TextureBase<BaseInterface, TRenderDeviceImpl, TTextureViewImpl, TTexViewObjAllocator> :: Map(
- IDeviceContext* pContext,
- Uint32 MipLevel,
- Uint32 ArraySlice,
- MAP_TYPE MapType,
- Uint32 MapFlags,
- const Box* pMapRegion,
- MappedTextureSubresource& MappedData)
-{
- ValidateMapTextureParams(this->GetDesc(), MipLevel, ArraySlice, MapType, MapFlags, pMapRegion);
-}
-
-template<class BaseInterface, class TRenderDeviceImpl,class TTextureViewImpl, class TTexViewObjAllocator>
-void TextureBase<BaseInterface, TRenderDeviceImpl, TTextureViewImpl, TTexViewObjAllocator> :: Unmap(IDeviceContext* pContext, Uint32 MipLevel, Uint32 ArraySlice)
-{
-}
-
}
diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h
index d1bcc4ff..f8f9adb1 100644
--- a/Graphics/GraphicsEngine/interface/DeviceContext.h
+++ b/Graphics/GraphicsEngine/interface/DeviceContext.h
@@ -582,6 +582,31 @@ public:
Uint32 DstZ) = 0;
+ /// Maps the texture subresource
+
+ /// \param [in] pTexture - Pointer to the texture to map.
+ /// \param [in] MipLevel - Mip level to map.
+ /// \param [in] ArraySlice - Array slice to map. This parameter must be 0 for non-array textures.
+ /// \param [in] MapType - Type of the map operation. See Diligent::MAP_TYPE.
+ /// \param [in] MapFlags - Special map flags. See Diligent::MAP_FLAGS.
+ /// \param [in] pMapRegion - Texture region to map. If this parameter is null, the entire subresource is mapped.
+ /// \param [out] MappedData - Mapped texture region data
+ ///
+ /// \remarks This method is supported in D3D11, D3D12 and Vulkan backends. In D3D11 backend, only the entire
+ /// subresource can be mapped, so pMapRegion must either be null, or cover the entire subresource.
+ /// In D3D11 and Vulkan backends, dynamic textures are no different from non-dynamic textures, and mapping
+ /// with MAP_FLAG_DISCARD has exactly the same behavior
+ virtual void MapTextureSubresource( ITexture* pTexture,
+ Uint32 MipLevel,
+ Uint32 ArraySlice,
+ MAP_TYPE MapType,
+ Uint32 MapFlags,
+ const Box* pMapRegion,
+ MappedTextureSubresource& MappedData ) = 0;
+
+ /// Unmaps the texture subresource
+ virtual void UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice) = 0;
+
/// Sets the swap chain in the device context
/// The swap chain is used by the device context to work with the
diff --git a/Graphics/GraphicsEngine/interface/Texture.h b/Graphics/GraphicsEngine/interface/Texture.h
index ff7688d7..b8c84409 100644
--- a/Graphics/GraphicsEngine/interface/Texture.h
+++ b/Graphics/GraphicsEngine/interface/Texture.h
@@ -304,30 +304,6 @@ public:
/// Release() must *NOT* be called.
virtual ITextureView* GetDefaultView( TEXTURE_VIEW_TYPE ViewType ) = 0;
- /// Map the texture
-
- /// \param [in] pContext - Pointer to the device context interface to be used to perform the operation.
- /// \param [in] MipLevel - Mip level to map.
- /// \param [in] ArraySlice - Array slice to map. This parameter must be 0 for non-array textures.
- /// \param [in] MapType - Type of the map operation. See Diligent::MAP_TYPE.
- /// \param [in] MapFlags - Special map flags. See Diligent::MAP_FLAGS.
- /// \param [in] pMapRegion - Texture region to map. If this parameter is null, the entire subresource is mapped.
- /// \param [out] MappedData - Mapped texture region data
- ///
- /// \remarks This method is supported in D3D11, D3D12 and Vulkan backends. In D3D11 backend, only the entire
- /// subresource can be mapped, so pMapRegion must either be null, or cover the entire subresource.
- /// In D3D11 and Vulkan backends, dynamic textures are no different from non-dynamic textures, and mapping
- /// with MAP_FLAG_DISCARD has exactly the same behavior
- virtual void Map( IDeviceContext* pContext,
- Uint32 MipLevel,
- Uint32 ArraySlice,
- MAP_TYPE MapType,
- Uint32 MapFlags,
- const Box* pMapRegion,
- MappedTextureSubresource& MappedData ) = 0;
-
- /// Unmap the textute
- virtual void Unmap(IDeviceContext *pContext, Uint32 MipLevel, Uint32 ArraySlice) = 0;
/// Returns native texture handle specific to the underlying graphics API