diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-11-25 05:07:34 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-11-25 05:07:34 +0000 |
| commit | 774506fc59bad5c93d450cdf6c21861cd70d34d2 (patch) | |
| tree | 834dd0f4b89e31a99744db37755f9fe47b52c55e /Graphics/GraphicsEngine | |
| parent | Renamed/moved ITexture::Map() to IDeviceContext::MapTextureSubresource() (diff) | |
| download | DiligentCore-774506fc59bad5c93d450cdf6c21861cd70d34d2.tar.gz DiligentCore-774506fc59bad5c93d450cdf6c21861cd70d34d2.zip | |
Moved ITextureView::GenerateMips() to IDeviceContext::GenerateMips()
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/DeviceContextBase.h | 11 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/DeviceContext.h | 9 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/TextureView.h | 6 |
3 files changed, 20 insertions, 6 deletions
diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.h b/Graphics/GraphicsEngine/include/DeviceContextBase.h index d80eca83..b176359c 100644 --- a/Graphics/GraphicsEngine/include/DeviceContextBase.h +++ b/Graphics/GraphicsEngine/include/DeviceContextBase.h @@ -142,6 +142,7 @@ public: /// Base implementaiton of IDeviceContext::UnmapTextureSubresource() virtual void UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice)override = 0; + virtual void GenerateMips(ITextureView* pTexView)override = 0; /// Sets the strong pointer to the swap chain virtual void SetSwapChain( ISwapChain* pSwapChain )override final { m_pSwapChain = pSwapChain; } @@ -737,6 +738,16 @@ inline void DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType DEV_CHECK_ERR(ArraySlice < pTexture->GetDesc().ArraySize, "Array slice is out of range"); } +template<typename BaseInterface, typename BufferImplType, typename TextureViewImplType, typename PipelineStateImplType> +inline void DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType, PipelineStateImplType> :: + GenerateMips(ITextureView* pTexView) +{ + VERIFY(pTexView != nullptr, "pTexView must not be null"); +#ifdef DEVELOPMENT + const auto& ViewDesc = pTexView->GetDesc(); + DEV_CHECK_ERR( ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE, "GenerateMips() is allowed for shader resource views only, ", GetTexViewTypeLiteralName(ViewDesc.ViewType), " is not allowed." ); +#endif +} #ifdef DEVELOPMENT template<typename BaseInterface, typename BufferImplType, typename TextureViewImplType, typename PipelineStateImplType> diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h index f8f9adb1..d1280fde 100644 --- a/Graphics/GraphicsEngine/interface/DeviceContext.h +++ b/Graphics/GraphicsEngine/interface/DeviceContext.h @@ -607,6 +607,15 @@ public: /// Unmaps the texture subresource virtual void UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice) = 0; + + /// Generates a mipmap chain. + + /// \param [in] pTextureView - Texture view to generate mip maps for. + /// \remarks This function can only be called for a shader resource view. + /// The texture must be created with MISC_TEXTURE_FLAG_GENERATE_MIPS flag. + virtual void GenerateMips(ITextureView* pTextureView) = 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/TextureView.h b/Graphics/GraphicsEngine/interface/TextureView.h index 71e4da52..3141e9be 100644 --- a/Graphics/GraphicsEngine/interface/TextureView.h +++ b/Graphics/GraphicsEngine/interface/TextureView.h @@ -189,12 +189,6 @@ public: /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. virtual class ITexture* GetTexture() = 0; - - /// Generates a mipmap chain - - /// \remarks This function can only be called for a shader resource view - /// The texture must be created with MISC_TEXTURE_FLAG_GENERATE_MIPS flag - virtual void GenerateMips(IDeviceContext *pContext ) = 0; }; } |
