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/GraphicsEngineD3D12/CMakeLists.txt | 2 +- Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h | 7 ++++++- Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h | 4 ++-- Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp | 15 ++++++++++++++- 4 files changed, 23 insertions(+), 5 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/CMakeLists.txt b/Graphics/GraphicsEngineD3D12/CMakeLists.txt index a5fac952..0f5aea78 100644 --- a/Graphics/GraphicsEngineD3D12/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D12/CMakeLists.txt @@ -109,7 +109,7 @@ INTERFACE ) target_link_libraries(GraphicsEngineD3D12Interface INTERFACE - GraphicsEngineInterface + GraphicsEngineD3DBaseInterface ) add_library(GraphicsEngineD3D12-static STATIC diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h index 9227287e..f9dd4037 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h @@ -59,7 +59,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); } ID3DBlob* GetShaderByteCode(){return m_pShaderByteCode;} diff --git a/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h b/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h index 31dec253..9a28a404 100644 --- a/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h @@ -26,7 +26,7 @@ /// \file /// Definition of the Diligent::IShaderD3D12 interface -#include "../../GraphicsEngine/interface/Shader.h" +#include "../../GraphicsEngineD3DBase/interface/ShaderD3D.h" namespace Diligent { @@ -36,7 +36,7 @@ static constexpr INTERFACE_ID IID_ShaderD3D12 = { 0xc059b160, 0x7f31, 0x4029, { 0x94, 0x3d, 0x9, 0x96, 0xb9, 0x8e, 0xe7, 0x9a } }; /// Interface to the shader object implemented in D3D12 -class IShaderD3D12 : public IShader +class IShaderD3D12 : public IShaderD3D { public: diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp index ba069332..f4128b88 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderD3D12Impl.cpp @@ -49,6 +49,19 @@ ShaderD3D12Impl::~ShaderD3D12Impl() { } -IMPLEMENT_QUERY_INTERFACE( ShaderD3D12Impl, IID_ShaderD3D12, TShaderBase ) +void ShaderD3D12Impl::QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) +{ + if (ppInterface == nullptr) + return; + if (IID == IID_ShaderD3D || IID == IID_ShaderD3D12) + { + *ppInterface = this; + (*ppInterface)->AddRef(); + } + else + { + TShaderBase::QueryInterface( IID, ppInterface ); + } +} } -- cgit v1.2.3