From 774506fc59bad5c93d450cdf6c21861cd70d34d2 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 24 Nov 2018 21:07:34 -0800 Subject: Moved ITextureView::GenerateMips() to IDeviceContext::GenerateMips() --- .../GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h | 2 ++ Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h | 2 -- Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp | 7 +++++++ Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp | 13 ------------- 4 files changed, 9 insertions(+), 15 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h index 2daacb70..206af852 100755 --- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h @@ -114,6 +114,8 @@ public: virtual void UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice)override final; + virtual void GenerateMips(ITextureView* pTextureView)override final; + virtual void FinishFrame()override final; virtual void TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers)override final; diff --git a/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h index 4c801b07..f2e57337 100644 --- a/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h @@ -56,8 +56,6 @@ public: return m_pD3D11View; } - void GenerateMips( IDeviceContext *pContext )override final; - protected: /// D3D11 view CComPtr m_pD3D11View; diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index 0a933d58..03bf0795 100755 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -1092,6 +1092,13 @@ namespace Diligent m_pd3d11DeviceContext->Unmap(pTexD3D11->GetD3D11Texture(), Subresource); } + void DeviceContextD3D11Impl::GenerateMips(ITextureView* pTextureView) + { + TDeviceContextBase::GenerateMips(pTextureView); + auto& TexViewD3D11 = *ValidatedCast(pTextureView); + auto* pd3d11SRV = static_cast( TexViewD3D11.GetD3D11View() ); + m_pd3d11DeviceContext->GenerateMips(pd3d11SRV); + } void DeviceContextD3D11Impl::FinishFrame() { diff --git a/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp index d1bece27..dd1638ae 100644 --- a/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp @@ -46,17 +46,4 @@ TextureViewD3D11Impl::TextureViewD3D11Impl( IReferenceCounters* pRefCounters, IMPLEMENT_QUERY_INTERFACE( TextureViewD3D11Impl, IID_TextureViewD3D11, TTextureViewBase ) -void TextureViewD3D11Impl::GenerateMips( IDeviceContext *pContext ) -{ - VERIFY( m_Desc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE, "GenerateMips() is allowed for shader resource views only, ", GetTexViewTypeLiteralName(m_Desc.ViewType), " is not allowed." ); - if( m_Desc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE ) - { - LOG_ERROR("GenerateMips() is allowed for shader resource views only, ", GetTexViewTypeLiteralName(m_Desc.ViewType), " is not allowed."); - return; - } - auto *pd3d11Ctx = ValidatedCast( pContext )->GetD3D11DeviceContext(); - auto *pd3d11SRV = static_cast( GetD3D11View() ); - pd3d11Ctx->GenerateMips(pd3d11SRV); -} - } -- cgit v1.2.3