From 04330a7e1d0198e721fd8d10379ab751b6826a35 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 3 Mar 2019 13:16:34 -0800 Subject: Cleaned up QueryInterface declarations --- Graphics/GraphicsEngine/include/ResourceMappingImpl.h | 2 +- Graphics/GraphicsEngine/interface/Buffer.h | 2 +- Graphics/GraphicsEngine/interface/BufferView.h | 2 +- Graphics/GraphicsEngine/interface/DeviceContext.h | 2 +- Graphics/GraphicsEngine/interface/Fence.h | 2 +- Graphics/GraphicsEngine/interface/Sampler.h | 2 +- .../GraphicsEngineD3D11/include/BufferD3D11Impl.h | 2 +- .../GraphicsEngineD3D11/include/BufferViewD3D11Impl.h | 2 +- .../include/DeviceContextD3D11Impl.h | 2 +- .../include/PipelineStateD3D11Impl.h | 19 ++++++++++++++++++- .../include/RenderDeviceD3D11Impl.h | 2 +- .../GraphicsEngineD3D11/include/SamplerD3D11Impl.h | 2 +- .../GraphicsEngineD3D11/include/SwapChainD3D11Impl.h | 2 +- .../GraphicsEngineD3D11/include/TextureBaseD3D11.h | 2 +- .../include/TextureViewD3D11Impl.h | 2 +- .../src/DeviceContextD3D11Impl.cpp | 4 ++-- .../GraphicsEngineVulkan/include/CommandQueueVkImpl.h | 2 +- .../GraphicsEngineVulkan/include/SwapChainVkImpl.h | 2 +- .../GraphicsEngineVulkan/include/TextureViewVkImpl.h | 2 +- Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h | 2 +- 20 files changed, 38 insertions(+), 21 deletions(-) (limited to 'Graphics') diff --git a/Graphics/GraphicsEngine/include/ResourceMappingImpl.h b/Graphics/GraphicsEngine/include/ResourceMappingImpl.h index ae0b4734..8630d764 100644 --- a/Graphics/GraphicsEngine/include/ResourceMappingImpl.h +++ b/Graphics/GraphicsEngine/include/ResourceMappingImpl.h @@ -104,7 +104,7 @@ namespace Diligent ~ResourceMappingImpl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface )override final; + virtual void QueryInterface( const INTERFACE_ID& IID, IObject** ppInterface )override final; /// Implementation of IResourceMapping::AddResource() virtual void AddResource( const Char* Name, IDeviceObject* pObject, bool bIsUnique )override final; diff --git a/Graphics/GraphicsEngine/interface/Buffer.h b/Graphics/GraphicsEngine/interface/Buffer.h index 3bf17e94..7729df8d 100644 --- a/Graphics/GraphicsEngine/interface/Buffer.h +++ b/Graphics/GraphicsEngine/interface/Buffer.h @@ -171,7 +171,7 @@ class IBuffer : public IDeviceObject { public: /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface ) = 0; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) = 0; /// Returns the buffer description used to create the object virtual const BufferDesc& GetDesc()const = 0; diff --git a/Graphics/GraphicsEngine/interface/BufferView.h b/Graphics/GraphicsEngine/interface/BufferView.h index 0f396dd4..37162724 100644 --- a/Graphics/GraphicsEngine/interface/BufferView.h +++ b/Graphics/GraphicsEngine/interface/BufferView.h @@ -138,7 +138,7 @@ class IBufferView : public IDeviceObject { public: /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface ) = 0; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) = 0; /// Returns the buffer view description used to create the object virtual const BufferViewDesc& GetDesc()const = 0; diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h index ed9aa996..32b4ac59 100644 --- a/Graphics/GraphicsEngine/interface/DeviceContext.h +++ b/Graphics/GraphicsEngine/interface/DeviceContext.h @@ -450,7 +450,7 @@ class IDeviceContext : public IObject { public: /// Queries the specific interface, see IObject::QueryInterface() for details. - virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) = 0; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) = 0; /// Sets the pipeline state. diff --git a/Graphics/GraphicsEngine/interface/Fence.h b/Graphics/GraphicsEngine/interface/Fence.h index 06708e5d..0d72985f 100644 --- a/Graphics/GraphicsEngine/interface/Fence.h +++ b/Graphics/GraphicsEngine/interface/Fence.h @@ -48,7 +48,7 @@ class IFence : public IDeviceObject { public: /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface ) = 0; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) = 0; /// Returns the fence description used to create the object virtual const FenceDesc& GetDesc()const = 0; diff --git a/Graphics/GraphicsEngine/interface/Sampler.h b/Graphics/GraphicsEngine/interface/Sampler.h index c8b3c540..65579f5e 100644 --- a/Graphics/GraphicsEngine/interface/Sampler.h +++ b/Graphics/GraphicsEngine/interface/Sampler.h @@ -170,7 +170,7 @@ class ISampler : public IDeviceObject { public: /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface ) = 0; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) = 0; /// Returns the sampler description used to create the object virtual const SamplerDesc& GetDesc()const = 0; diff --git a/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h index 8b39f607..71b91345 100644 --- a/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h @@ -58,7 +58,7 @@ public: ~BufferD3D11Impl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; virtual ID3D11Buffer* GetD3D11Buffer()override final{ return m_pd3d11Buffer; } diff --git a/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h index 208dd1ee..d705536e 100644 --- a/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h @@ -48,7 +48,7 @@ public: ID3D11View* pD3D11View, bool bIsDefaultView); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface ) final; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject **ppInterface) final; virtual ID3D11View* GetD3D11View()override final { diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h index df013869..d9a0e44d 100755 --- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h @@ -59,7 +59,7 @@ public: ID3D11DeviceContext* pd3d11DeviceContext, const struct EngineD3D11Attribs& EngineAttribs, bool bIsDeferred); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; virtual void SetPipelineState(IPipelineState* pPipelineState)override final; diff --git a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h index af93c8eb..04e0edc0 100644 --- a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h @@ -48,7 +48,7 @@ public: const PipelineStateDesc& PipelineDesc); ~PipelineStateD3D11Impl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; /// Implementation of the IPipelineStateD3D11::GetD3D11BlendState() method. virtual ID3D11BlendState* GetD3D11BlendState()override final; @@ -77,12 +77,29 @@ public: return m_SRBMemAllocator; } + const ShaderResourceLayoutD3D11& GetStaticResourceLayout(Uint32 s)const + { + VERIFY_EXPR(s < m_NumShaders); + return m_pStaticResourceLayouts[s]; + } + + ShaderResourceCacheD3D11& GetStaticResourceCache(Uint32 s) + { + VERIFY_EXPR(s < m_NumShaders); + return m_pStaticResourceCaches[s]; + } + + private: CComPtr m_pd3d11BlendState; CComPtr m_pd3d11RasterizerState; CComPtr m_pd3d11DepthStencilState; CComPtr m_pd3d11InputLayout; + // The caches are indexed by the shader order in the PSO, not shader index + ShaderResourceCacheD3D11* m_pStaticResourceCaches = nullptr; + ShaderResourceLayoutD3D11* m_pStaticResourceLayouts= nullptr; + // SRB memory allocator must be defined before the default shader res binding SRBMemoryAllocator m_SRBMemAllocator; }; diff --git a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h index 0e7f66ad..87189352 100644 --- a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h @@ -45,7 +45,7 @@ public: const EngineD3D11Attribs& EngineAttribs, ID3D11Device* pd3d11Device, Uint32 NumDeferredContexts ); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; virtual void CreateBuffer(const BufferDesc& BuffDesc, const BufferData* pBuffData, IBuffer** ppBuffer)override final; diff --git a/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h index 5745bf18..4cac7884 100644 --- a/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h @@ -46,7 +46,7 @@ public: const SamplerDesc& SamplerDesc); ~SamplerD3D11Impl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject** ppInterface ) final; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; virtual ID3D11SamplerState* GetD3D11SamplerState()override final{ return m_pd3dSampler; } diff --git a/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h index 7dd8680e..98d92676 100644 --- a/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h @@ -47,7 +47,7 @@ public: void* pNativeWndHandle); ~SwapChainD3D11Impl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; virtual void Present(Uint32 SyncInterval)override final; virtual void Resize( Uint32 NewWidth, Uint32 NewHeight )override final; diff --git a/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h b/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h index 56ef5bc3..1333bd8e 100644 --- a/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h @@ -51,7 +51,7 @@ public: const TextureData* pInitData = nullptr); ~TextureBaseD3D11(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; virtual ID3D11Resource* GetD3D11Texture()override final{ return m_pd3d11Texture; } diff --git a/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h index 3fcea2da..423b6dee 100644 --- a/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h @@ -49,7 +49,7 @@ public: ID3D11View* pD3D11View, bool bIsDefaultView); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; virtual ID3D11View* GetD3D11View()override final { diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index 03327e15..0c205533 100755 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -214,7 +214,7 @@ namespace Diligent #ifdef DEVELOPMENT auto* pShaderD3D11 = ValidatedCast(ppdbgShaders[s]); - VERIFY_EXPR( ShaderTypeInd == static_cast(pShaderD3D11->GetShaderTypeIndex()) ); + VERIFY_EXPR( ShaderTypeInd == static_cast(GetShaderTypeIndex(pShaderD3D11->GetDesc().ShaderType)) ); #endif auto& Cache = pShaderResBindingD3D11->GetResourceCache(s); @@ -360,7 +360,7 @@ namespace Diligent #ifdef DEVELOPMENT auto* pShaderD3D11 = ValidatedCast(ppdbgShaders[s]); - VERIFY_EXPR( ShaderTypeInd == static_cast(pShaderD3D11->GetShaderTypeIndex()) ); + VERIFY_EXPR( ShaderTypeInd == static_cast(GetShaderTypeIndex(pShaderD3D11->GetDesc().ShaderType)) ); #endif auto& Cache = pShaderResBindingD3D11->GetResourceCache(s); diff --git a/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h b/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h index a5669f6c..3c649ab1 100644 --- a/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h @@ -48,7 +48,7 @@ public: uint32_t QueueFamilyIndex); ~CommandQueueVkImpl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface )override; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; // Returns the fence value that will be signaled next time virtual Uint64 GetNextFenceValue()override final { return m_NextFenceValue; } diff --git a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h index aada3ab5..d309c638 100644 --- a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h @@ -49,7 +49,7 @@ public: void* pNativeWndHandle); ~SwapChainVkImpl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface )override final; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; virtual void Present(Uint32 SyncInterval)override final; virtual void Resize( Uint32 NewWidth, Uint32 NewHeight )override final; diff --git a/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h b/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h index 650829e1..8989c245 100644 --- a/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h @@ -50,7 +50,7 @@ public: bool bIsDefaultView); ~TextureViewVkImpl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface )override; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; VkImageView GetVulkanImageView()const override final{return m_ImageView;} diff --git a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h index 4d040a0e..4d19fe91 100644 --- a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h @@ -62,7 +62,7 @@ public: ~TextureVkImpl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID& IID, IObject** ppInterface )override; + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; virtual VkImage GetVkImage()const override final{ return m_VulkanImage; } virtual void* GetNativeHandle()override final -- cgit v1.2.3