From 07a7f4bd9e05a8c170d308af83063024bcdfaad4 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 7 Mar 2019 19:00:46 -0800 Subject: Added IShaderD3D interface and HLSLShaderResourceDesc structure --- Graphics/GraphicsEngineD3D11/CMakeLists.txt | 2 +- Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h | 9 +++++++-- Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h | 4 ++-- Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/CMakeLists.txt b/Graphics/GraphicsEngineD3D11/CMakeLists.txt index f54fa680..630de8cb 100644 --- a/Graphics/GraphicsEngineD3D11/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D11/CMakeLists.txt @@ -79,7 +79,7 @@ INTERFACE ) target_link_libraries(GraphicsEngineD3D11Interface INTERFACE - GraphicsEngineInterface + GraphicsEngineD3DBaseInterface ) diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h index 35a50a08..f297bc47 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h @@ -53,7 +53,7 @@ public: const ShaderCreateInfo& ShaderCI); ~ShaderD3D11Impl(); - IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_ShaderD3D11, TShaderBase); + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; virtual Uint32 GetResourceCount()const override final { @@ -62,7 +62,12 @@ public: virtual ShaderResourceDesc GetResource(Uint32 Index)const override final { - return m_pShaderResources->GetShaderResourceDesc(Index); + return GetHLSLResource(Index); + } + + virtual HLSLShaderResourceDesc GetHLSLResource(Uint32 Index)const override final + { + return m_pShaderResources->GetHLSLShaderResourceDesc(Index); } virtual ID3D11DeviceChild* GetD3D11Shader()override final diff --git a/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h b/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h index 15d7aed6..b2e5d6f5 100644 --- a/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/ShaderD3D11.h @@ -26,7 +26,7 @@ /// \file /// Definition of the Diligent::IShaderD3D11 interface -#include "../../GraphicsEngine/interface/Shader.h" +#include "../../GraphicsEngineD3DBase/interface/ShaderD3D.h" namespace Diligent { @@ -36,7 +36,7 @@ static constexpr INTERFACE_ID IID_ShaderD3D11 = { 0xc513e83e, 0xb037, 0x405b, { 0x8b, 0x49, 0xbf, 0x8f, 0x5c, 0x22, 0xd, 0xee } }; /// Interface to the shader object implemented in D3D11 -class IShaderD3D11 : public IShader +class IShaderD3D11 : public IShaderD3D { public: diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp index 677cd40c..7a6d1d91 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp @@ -88,4 +88,19 @@ ShaderD3D11Impl::~ShaderD3D11Impl() { } +void ShaderD3D11Impl::QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) +{ + if (ppInterface == nullptr) + return; + if (IID == IID_ShaderD3D || IID == IID_ShaderD3D11) + { + *ppInterface = this; + (*ppInterface)->AddRef(); + } + else + { + TShaderBase::QueryInterface( IID, ppInterface ); + } +} + } -- cgit v1.2.3