diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-01-25 22:33:42 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-01-25 22:33:42 +0000 |
| commit | 75d892e4358f877a5db23b20930b680aee6415d9 (patch) | |
| tree | a01881662936340d1e2bb4fa0a970e10a26c8140 /Graphics/GraphicsEngine | |
| parent | Fixed issue with SHADER_SOURCE_LANGUAGE SourceLanguage member (diff) | |
| download | DiligentCore-75d892e4358f877a5db23b20930b680aee6415d9.tar.gz DiligentCore-75d892e4358f877a5db23b20930b680aee6415d9.zip | |
c inteface: implemented core object VTBLs
Diffstat (limited to 'Graphics/GraphicsEngine')
19 files changed, 535 insertions, 70 deletions
diff --git a/Graphics/GraphicsEngine/include/EngineFactoryBase.h b/Graphics/GraphicsEngine/include/EngineFactoryBase.h index 5e2ee2ba..2e0b954c 100644 --- a/Graphics/GraphicsEngine/include/EngineFactoryBase.h +++ b/Graphics/GraphicsEngine/include/EngineFactoryBase.h @@ -48,8 +48,6 @@ template <class BaseInterface> class EngineFactoryBase : public BaseInterface { public: - using CounterValueType = IReferenceCounters::CounterValueType; - EngineFactoryBase(const INTERFACE_ID& FactoryIID) noexcept : // clang-format off m_FactoryIID {FactoryIID}, @@ -71,12 +69,12 @@ public: } } - virtual CounterValueType AddRef() override final + virtual ReferenceCounterValueType AddRef() override final { return m_RefCounters.AddStrongRef(); } - virtual CounterValueType Release() override final + virtual ReferenceCounterValueType Release() override final { return m_RefCounters.ReleaseStrongRef(); } @@ -108,23 +106,22 @@ private: m_lNumWeakReferences = 0; } - using IReferenceCounters::CounterValueType; - virtual CounterValueType AddStrongRef() override final + virtual ReferenceCounterValueType AddStrongRef() override final { return Atomics::AtomicIncrement(m_lNumStrongReferences); } - virtual CounterValueType ReleaseStrongRef() override final + virtual ReferenceCounterValueType ReleaseStrongRef() override final { return Atomics::AtomicDecrement(m_lNumStrongReferences); } - virtual CounterValueType AddWeakRef() override final + virtual ReferenceCounterValueType AddWeakRef() override final { return Atomics::AtomicIncrement(m_lNumWeakReferences); } - virtual CounterValueType ReleaseWeakRef() override final + virtual ReferenceCounterValueType ReleaseWeakRef() override final { return Atomics::AtomicDecrement(m_lNumWeakReferences); } @@ -135,12 +132,12 @@ private: m_Factory.QueryInterface(IID_Unknown, ppObject); } - virtual CounterValueType GetNumStrongRefs() const override final + virtual ReferenceCounterValueType GetNumStrongRefs() const override final { return m_lNumStrongReferences; } - virtual CounterValueType GetNumWeakRefs() const override final + virtual ReferenceCounterValueType GetNumWeakRefs() const override final { return m_lNumWeakReferences; } diff --git a/Graphics/GraphicsEngine/include/RenderDeviceBase.h b/Graphics/GraphicsEngine/include/RenderDeviceBase.h index 33a021db..77596cd8 100644 --- a/Graphics/GraphicsEngine/include/RenderDeviceBase.h +++ b/Graphics/GraphicsEngine/include/RenderDeviceBase.h @@ -313,7 +313,7 @@ public: // It is important to have final implementation of Release() method to avoid // virtual calls - inline virtual IReferenceCounters::CounterValueType Release() override final + inline virtual ReferenceCounterValueType Release() override final { return TObjectBase::Release(); } diff --git a/Graphics/GraphicsEngine/interface/Buffer.h b/Graphics/GraphicsEngine/interface/Buffer.h index 7ccb543a..5e3a01d2 100644 --- a/Graphics/GraphicsEngine/interface/Buffer.h +++ b/Graphics/GraphicsEngine/interface/Buffer.h @@ -33,6 +33,7 @@ /// Defines Diligent::IBuffer interface and related data structures #include "DeviceObject.h" +#include "BufferView.h" DILIGENT_BEGIN_NAMESPACE(Diligent) @@ -179,9 +180,6 @@ struct BufferData class IBuffer : public IDeviceObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - /// Returns the buffer description used to create the object virtual const BufferDesc& GetDesc() const override = 0; @@ -232,6 +230,32 @@ public: #else +struct IBuffer; + +struct IBufferVtbl +{ + void (*CreateView)(const struct BufferViewDesc* ViewDesc, class IBufferView** ppView); + class IBufferView* (*GetDefaultView)(BUFFER_VIEW_TYPE ViewType); + void* (*GetNativeHandle)(); + void (*SetState)(RESOURCE_STATE State); + RESOURCE_STATE (*GetState)(); +}; + +struct IBuffer +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + struct IBufferVtbl* pBufferVtbl; +}; + +# define IBuffer_GetDesc(This) (const struct BufferDesc*)(This)->pDeviceObjectVtbl->GetDesc(This) + +# define IBuffer_CreateView(This, ...) (This)->pBufferVtbl->CreateView(This, __VA_ARGS__) +# define IBuffer_GetDefaultView(This, ...) (This)->pBufferVtbl->GetDefaultView(This, __VA_ARGS__) +# define IBuffer_GetNativeHandle(This) (This)->pBufferVtbl->(This) +# define IBuffer_SetState(This) (This)->pBufferVtbl->SetState(This, __VA_ARGS__) +# define IBuffer_GetState(This) (This)->pBufferVtbl->GetState(This, __VA_ARGS__) + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/BufferView.h b/Graphics/GraphicsEngine/interface/BufferView.h index 992ef5f0..a0bb3585 100644 --- a/Graphics/GraphicsEngine/interface/BufferView.h +++ b/Graphics/GraphicsEngine/interface/BufferView.h @@ -32,7 +32,7 @@ /// \file /// Definition of the Diligent::IBufferView interface and related data structures -#include "Buffer.h" +#include "DeviceObject.h" DILIGENT_BEGIN_NAMESPACE(Diligent) @@ -149,9 +149,6 @@ struct BufferViewDesc DILIGENT_DERIVE(DeviceObjectAttribs) class IBufferView : public IDeviceObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - /// Returns the buffer view description used to create the object virtual const BufferViewDesc& GetDesc() const override = 0; @@ -159,11 +156,30 @@ public: /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual IBuffer* GetBuffer() = 0; + virtual class IBuffer* GetBuffer() = 0; }; #else +class IBufferView; +class IBuffer; + +struct IBufferViewVtbl +{ + class IBuffer* (*GetBuffer)(); +}; + +struct IBufferView +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + struct IBufferViewVtbl* pBufferVtbl; +}; + +# define IBufferView_GetDesc(This) (const struct BufferViewDesc*)(This)->pDeviceObjectVtbl->GetDesc(This) + +# define IBufferView_GetBuffer(This) (This)->pBufferVtbl->GetBuffer(This) + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/CommandList.h b/Graphics/GraphicsEngine/interface/CommandList.h index 49586d8c..7837a07d 100644 --- a/Graphics/GraphicsEngine/interface/CommandList.h +++ b/Graphics/GraphicsEngine/interface/CommandList.h @@ -51,6 +51,20 @@ class ICommandList : public IDeviceObject #else +struct ICommandList; + +// C requires that a struct or union has at least one member +//struct ICommandListVtbl +//{ +//}; + +struct ICommandList +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + //struct ICommandListVtbl* pCommandListVtbl; +}; + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h index b5387fd4..ebe8d401 100644 --- a/Graphics/GraphicsEngine/interface/DeviceContext.h +++ b/Graphics/GraphicsEngine/interface/DeviceContext.h @@ -560,7 +560,7 @@ struct CopyTextureAttribs const struct Box* pSrcBox DEFAULT_INITIALIZER(nullptr); /// Source texture state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE). - enum RESOURCE_STATE_TRANSITION_MODE SrcTextureTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE); + RESOURCE_STATE_TRANSITION_MODE SrcTextureTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE); /// Destination texture. class ITexture* pDstTexture DEFAULT_INITIALIZER(nullptr); @@ -612,9 +612,6 @@ struct CopyTextureAttribs class IDeviceContext : public IObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details. - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override = 0; - /// Sets the pipeline state. /// \param [in] pPipelineState - Pointer to IPipelineState interface to bind to the context. @@ -1251,7 +1248,134 @@ public: #else +// clang-format on + +struct IDeviceContext; + +struct IDeviceContextVtbl +{ + void (*SetPipelineState)(class IPipelineState* pPipelineState); + void (*TransitionShaderResources)(class IPipelineState* pPipelineState, class IShaderResourceBinding* pShaderResourceBinding); + void (*CommitShaderResources)(class IShaderResourceBinding* pShaderResourceBinding, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); + void (*SetStencilRef)(Uint32 StencilRef); + void (*SetBlendFactors)(const float* pBlendFactors); + void (*SetVertexBuffers)(Uint32 StartSlot, + Uint32 NumBuffersSet, + class IBuffer** ppBuffers, + Uint32* pOffsets, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode, + SET_VERTEX_BUFFERS_FLAGS Flags); + void (*InvalidateState)(); + void (*SetIndexBuffer)(class IBuffer* pIndexBuffer, Uint32 ByteOffset, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); + void (*SetViewports)(Uint32 NumViewports, const struct Viewport* pViewports, Uint32 RTWidth, Uint32 RTHeight); + void (*SetScissorRects)(Uint32 NumRects, const struct Rect* pRects, Uint32 RTWidth, Uint32 RTHeight); + void (*SetRenderTargets)(Uint32 NumRenderTargets, + class ITextureView* ppRenderTargets[], + class ITextureView* pDepthStencil, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); + void (*Draw)(const struct DrawAttribs* Attribs); + void (*DrawIndexed)(const struct DrawIndexedAttribs* Attribs); + void (*DrawIndirect)(const struct DrawIndirectAttribs* Attribs, class IBuffer* pAttribsBuffer); + void (*DrawIndexedIndirect)(const struct DrawIndexedIndirectAttribs* Attribs, class IBuffer* pAttribsBuffer); + void (*DispatchCompute)(const struct DispatchComputeAttribs* Attribs); + void (*DispatchComputeIndirect)(const struct DispatchComputeIndirectAttribs* Attribs, class IBuffer* pAttribsBuffer); + void (*ClearDepthStencil)(class ITextureView* pView, + CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, + float fDepth, + Uint8 Stencil, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); + void (*ClearRenderTarget)(class ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); + void (*FinishCommandList)(class ICommandList** ppCommandList); + void (*ExecuteCommandList)(class ICommandList* pCommandList); + void (*SignalFence)(class IFence* pFence, Uint64 Value); + void (*WaitForFence)(class IFence* pFence, Uint64 Value, bool FlushContext); + void (*WaitForIdle)(); + void (*BeginQuery)(class IQuery* pQuery); + void (*EndQuery)(class IQuery* pQuery); + void (*Flush)(); + void (*UpdateBuffer)(class IBuffer* pBuffer, + Uint32 Offset, + Uint32 Size, + const void* pData, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); + void (*CopyBuffer)(class IBuffer* pSrcBuffer, + Uint32 SrcOffset, + RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, + class IBuffer* pDstBuffer, + Uint32 DstOffset, + Uint32 Size, + RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode); + void (*MapBuffer)(class IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid* pMappedData); + void (*UnmapBuffer)(class IBuffer* pBuffer, MAP_TYPE MapType); + void (*UpdateTexture)(class ITexture* pTexture, + Uint32 MipLevel, + Uint32 Slice, + const struct Box* DstBox, + const struct TextureSubResData* SubresData, + RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, + RESOURCE_STATE_TRANSITION_MODE TextureTransitionMode); + void (*CopyTexture)(const struct CopyTextureAttribs* CopyAttribs); + void (*MapTextureSubresource)(class ITexture* pTexture, + Uint32 MipLevel, + Uint32 ArraySlice, + MAP_TYPE MapType, + MAP_FLAGS MapFlags, + const struct Box* pMapRegion, + struct MappedTextureSubresource* MappedData); + void (*UnmapTextureSubresource)(class ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice); + void (*GenerateMips)(class ITextureView* pTextureView); + void (*FinishFrame)(); + void (*TransitionResourceStates)(Uint32 BarrierCount, struct StateTransitionDesc* pResourceBarriers); + void (*ResolveTextureSubresource)(class ITexture* pSrcTexture, + class ITexture* pDstTexture, + const struct ResolveTextureSubresourceAttribs* ResolveAttribs); +}; + +struct IDeviceContext +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceContextVtbl* pDeviceContextVtbl; +}; +# define IDeviceContext_SetPipelineState(This, ...) (This)->pDeviceContextVtbl->SetPipelineState(This, __VA_ARGS__) +# define IDeviceContext_TransitionShaderResources(This, ...) (This)->pDeviceContextVtbl->TransitionShaderResources(This, __VA_ARGS__) +# define IDeviceContext_CommitShaderResources(This, ...) (This)->pDeviceContextVtbl - CommitShaderResources(This, __VA_ARGS__) +# define IDeviceContext_SetStencilRef(This, ...) (This)->pDeviceContextVtbl->SetStencilRef(This, __VA_ARGS__) +# define IDeviceContext_SetBlendFactors(This, ...) (This)->pDeviceContextVtbl->SetBlendFactors(This, __VA_ARGS__) +# define IDeviceContext_SetVertexBuffers(This, ...) (This)->pDeviceContextVtbl->SetVertexBuffers(This, __VA_ARGS__) +# define IDeviceContext_InvalidateState(This) (This)->pDeviceContextVtbl->InvalidateState(This) +# define IDeviceContext_SetIndexBuffer(This, ...) (This)->pDeviceContextVtbl->SetIndexBuffer(This, __VA_ARGS__) +# define IDeviceContext_SetViewports(This, ...) (This)->pDeviceContextVtbl->SetViewports(This, __VA_ARGS__) +# define IDeviceContext_SetScissorRects(This, ...) (This)->pDeviceContextVtbl->SetScissorRects(This, __VA_ARGS__) +# define IDeviceContext_SetRenderTargets(This, ...) (This)->pDeviceContextVtbl->SetRenderTargets(This, __VA_ARGS__) +# define IDeviceContext_Draw(This, ...) (This)->pDeviceContextVtbl->Draw(This, __VA_ARGS__) +# define IDeviceContext_DrawIndexed(This, ...) (This)->pDeviceContextVtbl->DrawIndexed(This, __VA_ARGS__) +# define IDeviceContext_DrawIndirect(This, ...) (This)->pDeviceContextVtbl->DrawIndirect(This, __VA_ARGS__) +# define IDeviceContext_DrawIndexedIndirect(This, ...) (This)->pDeviceContextVtbl->DrawIndexedIndirect(This, __VA_ARGS__) +# define IDeviceContext_DispatchCompute(This, ...) (This)->pDeviceContextVtbl->DispatchCompute(This, __VA_ARGS__) +# define IDeviceContext_DispatchComputeIndirect(This, ...) (This)->pDeviceContextVtbl->DispatchComputeIndirect(This, __VA_ARGS__) +# define IDeviceContext_ClearDepthStencil(This, ...) (This)->pDeviceContextVtbl->ClearDepthStencil(This, __VA_ARGS__) +# define IDeviceContext_ClearRenderTarget(This, ...) (This)->pDeviceContextVtbl->ClearRenderTarget(This, __VA_ARGS__) +# define IDeviceContext_FinishCommandList(This, ...) (This)->pDeviceContextVtbl->FinishCommandList(This, __VA_ARGS__) +# define IDeviceContext_ExecuteCommandList(This, ...) (This)->pDeviceContextVtbl->ExecuteCommandList(This, __VA_ARGS__) +# define IDeviceContext_SignalFence(This, ...) (This)->pDeviceContextVtbl->SignalFence(This, __VA_ARGS__) +# define IDeviceContext_WaitForFence(This, ...) (This)->pDeviceContextVtbl->WaitForFence(This, __VA_ARGS__) +# define IDeviceContext_WaitForIdle(This, ...) (This)->pDeviceContextVtbl->WaitForIdle(This, __VA_ARGS__) +# define IDeviceContext_BeginQuery(This, ...) (This)->pDeviceContextVtbl->BeginQuery(This, __VA_ARGS__) +# define IDeviceContext_EndQuery(This, ...) (This)->pDeviceContextVtbl->EndQuery(This, __VA_ARGS__) +# define IDeviceContext_Flush(This, ...) (This)->pDeviceContextVtbl->Flush(This, __VA_ARGS__) +# define IDeviceContext_UpdateBuffer(This, ...) (This)->pDeviceContextVtbl->UpdateBuffer(This, __VA_ARGS__) +# define IDeviceContext_CopyBuffer(This, ...) (This)->pDeviceContextVtbl->CopyBuffer(This, __VA_ARGS__) +# define IDeviceContext_MapBuffer(This, ...) (This)->pDeviceContextVtbl->MapBuffer(This, __VA_ARGS__) +# define IDeviceContext_UnmapBuffer(This, ...) (This)->pDeviceContextVtbl->UnmapBuffer(This, __VA_ARGS__) +# define IDeviceContext_UpdateTexture(This, ...) (This)->pDeviceContextVtbl->UpdateTexture(This, __VA_ARGS__) +# define IDeviceContext_CopyTexture(This, ...) (This)->pDeviceContextVtbl->CopyTexture(This, __VA_ARGS__) +# define IDeviceContext_MapTextureSubresource(This, ...) (This)->pDeviceContextVtbl->MapTextureSubresource(This, __VA_ARGS__) +# define IDeviceContext_UnmapTextureSubresource(This, ...) (This)->pDeviceContextVtbl->UnmapTextureSubresource(This, __VA_ARGS__) +# define IDeviceContext_GenerateMips(This, ...) (This)->pDeviceContextVtbl->GenerateMips(This, __VA_ARGS__) +# define IDeviceContext_FinishFrame(This) (This)->pDeviceContextVtbl->FinishFrame(This) +# define IDeviceContext_TransitionResourceStates(This, ...) (This)->pDeviceContextVtbl->TransitionResourceStates(This, __VA_ARGS__) +# define IDeviceContext_ResolveTextureSubresource(This, ...) (This)->pDeviceContextVtbl->ResolveTextureSubresource(This, __VA_ARGS__) #endif diff --git a/Graphics/GraphicsEngine/interface/DeviceObject.h b/Graphics/GraphicsEngine/interface/DeviceObject.h index a62f7490..3c74988e 100644 --- a/Graphics/GraphicsEngine/interface/DeviceObject.h +++ b/Graphics/GraphicsEngine/interface/DeviceObject.h @@ -46,10 +46,6 @@ static const struct INTERFACE_ID IID_DeviceObject = class IDeviceObject : public IObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - - /// Returns the object description virtual const DeviceObjectAttribs& GetDesc() const = 0; @@ -75,6 +71,23 @@ public: #else +struct IDeviceObject; + +struct IDeviceObjectVtbl +{ + const struct DeviceObjectAttribs* (*GetDesc)(); + Int32 (*GetUniqueID)(); +}; + +struct IDeviceObject +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; +}; + +# define IDeviceObject_GetDesc(This) (This)->pDeviceObjectVtbl->GetDesc(This) +# define IDeviceObject_GetUniqueID(This) (This)->pDeviceObjectVtbl->GetUniqueID(This) + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/Fence.h b/Graphics/GraphicsEngine/interface/Fence.h index 4d2060e1..bb08045e 100644 --- a/Graphics/GraphicsEngine/interface/Fence.h +++ b/Graphics/GraphicsEngine/interface/Fence.h @@ -56,9 +56,6 @@ struct FenceDesc DILIGENT_DERIVE(DeviceObjectAttribs) class IFence : public IDeviceObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - /// Returns the fence description used to create the object virtual const FenceDesc& GetDesc() const override = 0; @@ -75,6 +72,26 @@ public: #else +struct IFence; + +struct IFenceVtbl +{ + Uint64 (*GetCompletedValue)(); + void (*Reset)(Uint64 Value); +}; + +struct IFence +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + struct IFenceVtbl* pFenceVtbl; +}; + +# define IFence_GetDesc(This) (const struct FenceDesc*)(This)->pDeviceObjectVtbl->GetDesc(This) + +# define IFence_GetCompletedValue(This) (This)->pFenceVtbl->GetCompletedValue(This) +# define IFence_Reset(This, ...) (This)->pFenceVtbl->Reset(This, __VA_ARGS__) + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h index f36d370e..a9a0ef56 100644 --- a/Graphics/GraphicsEngine/interface/PipelineState.h +++ b/Graphics/GraphicsEngine/interface/PipelineState.h @@ -253,10 +253,6 @@ static const struct INTERFACE_ID IID_PipelineState = class IPipelineState : public IDeviceObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface( const INTERFACE_ID& IID, IObject** ppInterface )override = 0; - - /// Returns the blend state description used to create the object virtual const PipelineStateDesc& GetDesc()const override = 0; @@ -331,6 +327,37 @@ public: #else +struct IPipelineState; + +struct IPipelineStateVtbl +{ + void (*BindStaticResources)(Uint32 ShaderFlags, class IResourceMapping* pResourceMapping, Uint32 Flags); + Uint32 (*GetStaticVariableCount)(SHADER_TYPE ShaderType); + class IShaderResourceVariable* (*GetStaticVariableByName)(SHADER_TYPE ShaderType, const Char* Name); + class IShaderResourceVariable* (*GetStaticVariableByIndex)(SHADER_TYPE ShaderType, Uint32 Index); + void (*CreateShaderResourceBinding)(class IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources); + bool (*IsCompatibleWith)(const class IPipelineState* pPSO); +}; + +// clang-format on + +struct IPipelineState +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + struct IPipelineState* pPipelineStateVtbl; +}; + +# define IPipelineState_GetDesc(This) (const struct PipelineStateDesc*)(This)->pDeviceObjectVtbl->GetDesc(This) + +# define IPipelineState_BindStaticResources(This, ...) (This)->pPipelineStateVtbl->BindStaticResources(This, __VA_ARGS__) +# define IPipelineState_GetStaticVariableCount(This, ...) (This)->pPipelineStateVtbl->GetStaticVariableCount(This, __VA_ARGS__) +# define IPipelineState_GetStaticVariableByName(This, ...) (This)->pPipelineStateVtbl->GetStaticVariableByName(This, __VA_ARGS__) +# define IPipelineState_GetStaticVariableByIndex(This, ...) (This)->pPipelineStateVtbl->GetStaticVariableByIndex(This, __VA_ARGS__) +# define IPipelineState_CreateShaderResourceBinding(This, ...) (This)->pPipelineStateVtbl->CreateShaderResourceBinding(This, __VA_ARGS__) +# define IPipelineState_IsCompatibleWith(This, ...) (This)->pPipelineStateVtbl->IsCompatibleWith(This, __VA_ARGS__) + + #endif DILIGENT_END_NAMESPACE diff --git a/Graphics/GraphicsEngine/interface/Query.h b/Graphics/GraphicsEngine/interface/Query.h index 7048bd3b..b44b6142 100644 --- a/Graphics/GraphicsEngine/interface/Query.h +++ b/Graphics/GraphicsEngine/interface/Query.h @@ -178,9 +178,6 @@ struct QueryDesc DILIGENT_DERIVE(DeviceObjectAttribs) class IQuery : public IDeviceObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details. - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - /// Returns the Query description used to create the object. virtual const QueryDesc& GetDesc() const override = 0; @@ -212,6 +209,26 @@ public: #else +struct IQuery; + +struct IQueryVtbl +{ + bool (*GetData)(void* pData, Uint32 DataSize, bool AutoInvalidate); + void (*Invalidate)(); +}; + +struct IQuery +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + struct IQuery* pQueryVtbl; +}; + +# define IQuery_GetDesc(This) (const struct QueryDesc*)(This)->pDeviceObjectVtbl->GetDesc(This) + +# define IQuery_GetData(This, ...) (This)->pQueryVtbl->GetData(This, __VA_ARGS__) +# define IQuery_Invalidate(This) (This)->pQueryVtbl->Invalidate(This) + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/RenderDevice.h b/Graphics/GraphicsEngine/interface/RenderDevice.h index fa776543..97256d08 100644 --- a/Graphics/GraphicsEngine/interface/RenderDevice.h +++ b/Graphics/GraphicsEngine/interface/RenderDevice.h @@ -63,9 +63,6 @@ static const struct INTERFACE_ID IID_RenderDevice = class IRenderDevice : public IObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - /// Creates a new buffer object /// \param [in] BuffDesc - Buffer description, see Diligent::BufferDesc for details. @@ -228,7 +225,57 @@ public: #else +struct IRenderDevice; + +struct IRenderDeviceVtbl +{ + void (*CreateBuffer)(const struct BufferDesc* BuffDesc, + const struct BufferData* pBuffData, + class IBuffer** ppBuffer); + void (*CreateShader)(const struct ShaderCreateInfo* ShaderCI, + class IShader** ppShader); + void (*CreateTexture)(const struct TextureDesc* TexDesc, + const struct TextureData* pData, + class ITexture** ppTexture); + void (*CreateSampler)(const struct SamplerDesc* SamDesc, + class ISampler** ppSampler); + void (*CreateResourceMapping)(const struct ResourceMappingDesc* MappingDesc, + class IResourceMapping** ppMapping); + void (*CreatePipelineState)(const struct PipelineStateDesc* PipelineDesc, + class IPipelineState** ppPipelineState); + void (*CreateFence)(const struct FenceDesc* Desc, + class IFence** ppFence); + void (*CreateQuery)(const struct QueryDesc* Desc, + class IQuery** ppQuery); + const struct DeviceCaps* (*GetDeviceCaps)(); + const struct TextureFormatInfo* (*GetTextureFormatInfo)(TEXTURE_FORMAT TexFormat); + const struct TextureFormatInfoExt* (*GetTextureFormatInfoExt)(TEXTURE_FORMAT TexFormat); + void (*ReleaseStaleResources)(bool ForceRelease); + void (*IdleGPU)(); + class IEngineFactory* (*GetEngineFactory)(); +}; + +struct IRenderDevice +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + struct IRenderDevice* pRenderDeviceVtbl; +}; +# define IRenderDevice_CreateBuffer(This, ...) (This)->pRenderDeviceVtbl->CreateBuffer(This, __VA_ARGS__) +# define IRenderDevice_CreateShader(This, ...) (This)->pRenderDeviceVtbl->CreateShader(This, __VA_ARGS__) +# define IRenderDevice_CreateTexture(This, ...) (This)->pRenderDeviceVtbl->CreateTexture(This, __VA_ARGS__) +# define IRenderDevice_CreateSampler(This, ...) (This)->pRenderDeviceVtbl->CreateSampler(This, __VA_ARGS__) +# define IRenderDevice_CreateResourceMapping(This, ...) (This)->pRenderDeviceVtbl->CreateResourceMapping(This, __VA_ARGS__) +# define IRenderDevice_CreatePipelineState(This, ...) (This)->pRenderDeviceVtbl->CreatePipelineState(This, __VA_ARGS__) +# define IRenderDevice_CreateFence(This, ...) (This)->pRenderDeviceVtbl->CreateFence(This, __VA_ARGS__) +# define IRenderDevice_CreateQuery(This, ...) (This)->pRenderDeviceVtbl->CreateQuery(This, __VA_ARGS__) +# define IRenderDevice_GetDeviceCaps(This) (This)->pRenderDeviceVtbl->GetDeviceCaps(This) +# define IRenderDevice_GetTextureFormatInfo(This, ...) (This)->pRenderDeviceVtbl->GetTextureFormatInfo(This, __VA_ARGS__) +# define IRenderDevice_GetTextureFormatInfoExt(This, ...) (This)->pRenderDeviceVtbl->GetTextureFormatInfoExt(This, __VA_ARGS__) +# define IRenderDevice_ReleaseStaleResources(This, ...) (This)->pRenderDeviceVtbl->ReleaseStaleResources(This, __VA_ARGS__) +# define IRenderDevice_IdleGPU(This) (This)->pRenderDeviceVtbl->IdleGPU(This) +# define IRenderDevice_GetEngineFactory(This) (This)->pRenderDeviceVtbl->GetEngineFactory(This) #endif diff --git a/Graphics/GraphicsEngine/interface/ResourceMapping.h b/Graphics/GraphicsEngine/interface/ResourceMapping.h index 27f7d7a5..723bc275 100644 --- a/Graphics/GraphicsEngine/interface/ResourceMapping.h +++ b/Graphics/GraphicsEngine/interface/ResourceMapping.h @@ -98,9 +98,6 @@ struct ResourceMappingDesc class IResourceMapping : public IObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - /// Adds a resource to the mapping. /// \param [in] Name - Resource name. @@ -152,6 +149,29 @@ public: #else +struct IResourceMapping; + +struct IResourceMappingVtbl +{ + void (*AddResource)(const Char* Name, class IDeviceObject* pObject, bool bIsUnique); + void (*AddResourceArray)(const Char* Name, Uint32 StartIndex, class IDeviceObject* const* ppObjects, Uint32 NumElements, bool bIsUnique); + void (*RemoveResourceByName)(const Char* Name, Uint32 ArrayIndex); + void (*GetResource)(const Char* Name, class IDeviceObject** ppResource, Uint32 ArrayIndex); + size_t (*GetSize)(); +}; + +struct IResourceMapping +{ + struct IObjectVtbl* pObjectVtbl; + struct IResourceMapping* pResourceMappingVtbl; +}; + +# define IResourceMapping_AddResource(This, ...) (This)->pResourceMappingVtbl->AddResource(This, __VA_ARGS__) +# define IResourceMapping_AddResourceArray(This, ...) (This)->pResourceMappingVtbl->AddResourceArray(This, __VA_ARGS__) +# define IResourceMapping_RemoveResourceByName(This, ...) (This)->pResourceMappingVtbl->RemoveResourceByName(This, __VA_ARGS__) +# define IResourceMapping_GetResource(This, ...) (This)->pResourceMappingVtbl->GetResource(This, __VA_ARGS__) +# define IResourceMapping_GetSize(This) (This)->pResourceMappingVtbl->GetSize(This) + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/Sampler.h b/Graphics/GraphicsEngine/interface/Sampler.h index dfd740b0..ecab7551 100644 --- a/Graphics/GraphicsEngine/interface/Sampler.h +++ b/Graphics/GraphicsEngine/interface/Sampler.h @@ -30,7 +30,6 @@ /// \file /// Definition of the Diligent::ISampler interface and related data structures -#include <cfloat> #include "DeviceObject.h" DILIGENT_BEGIN_NAMESPACE(Diligent) @@ -184,16 +183,26 @@ struct SamplerDesc DILIGENT_DERIVE(DeviceObjectAttribs) class ISampler : public IDeviceObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - /// Returns the sampler description used to create the object virtual const SamplerDesc& GetDesc() const override = 0; }; #else +struct ISampler; + +//struct ISamplerVtbl +//{ +//}; + +struct ISampler +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + //struct ISampler* pSamplerVtbl; +}; +# define ISampler_GetDesc(This) (const struct SamplerDesc*)(This)->pDeviceObjectVtbl->GetDesc(This) #endif diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h index 922143d7..d3e29e57 100644 --- a/Graphics/GraphicsEngine/interface/Shader.h +++ b/Graphics/GraphicsEngine/interface/Shader.h @@ -295,9 +295,6 @@ struct ShaderResourceDesc class IShader : public IDeviceObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - /// Returns the shader description virtual const ShaderDesc& GetDesc() const override = 0; @@ -310,6 +307,26 @@ public: #else +struct IShader; + +struct IShaderVtbl +{ + Uint32 (*GetResourceCount)(); + struct ShaderResourceDesc (*GetResource)(Uint32 Index); +}; + +struct IShader +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + struct IShader* pShaderVtbl; +}; + +# define IShader_GetDesc(This) (const struct ShaderDesc*)(This)->pDeviceObjectVtbl->GetDesc(This) + +# define ITexture_GetResourceCount(This) (This)->pShaderVtbl->GetResourceCount(This) +# define ITexture_GetResource(This, ...) (This)->pShaderVtbl->GetResource(This, __VA_ARGS__) + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h index 7bdac2cb..212680b0 100644 --- a/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h +++ b/Graphics/GraphicsEngine/interface/ShaderResourceBinding.h @@ -50,9 +50,6 @@ static const struct INTERFACE_ID IID_ShaderResourceBinding = class IShaderResourceBinding : public IObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - /// Returns pointer to the referenced buffer object. /// The method calls AddRef() on the returned interface, @@ -120,6 +117,34 @@ public: #else +class IPipelineState; +struct IShaderResourceBinding; + +// clang-format off +struct IShaderResourceBindingVtbl +{ + class IPipelineState* (*GetPipelineState)(); + void (*BindResources)(Uint32 ShaderFlags, class IResourceMapping* pResMapping, Uint32 Flags); + class IShaderResourceVariable* (*GetVariableByName)(SHADER_TYPE ShaderType, const char* Name); + Uint32 (*GetVariableCount)(SHADER_TYPE ShaderType); + class IShaderResourceVariable* (*GetVariableByIndex)(SHADER_TYPE ShaderType, Uint32 Index); + void (*InitializeStaticResources)(const class IPipelineState* pPipelineState); +}; +// clang-format on + +struct IShaderResourceBinding +{ + struct IObjectVtbl* pObjectVtbl; + struct IShaderResourceBinding* pShaderResourceBindingVtbl; +}; + +# define IShaderResourceBinding_GetPipelineState(This) (This)->pShaderResourceBindingVtbl->GetPipelineState(This) +# define IShaderResourceBinding_BindResources(This, ...) (This)->pShaderResourceBindingVtbl->BindResources(This, __VA_ARGS__) +# define IShaderResourceBinding_GetVariableByName(This, ...) (This)->pShaderResourceBindingVtbl->GetVariableByName(This, __VA_ARGS__) +# define IShaderResourceBinding_GetVariableCount(This, ...) (This)->pShaderResourceBindingVtbl->GetVariableCount(This, __VA_ARGS__) +# define IShaderResourceBinding_GetVariableByIndex(This, ...) (This)->pShaderResourceBindingVtbl->GetVariableByIndex(This, __VA_ARGS__) +# define IShaderResourceBinding_InitializeStaticResources(This, ...) (This)->pShaderResourceBindingVtbl->InitializeStaticResources(This, __VA_ARGS__) + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h b/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h index e42aa8f8..e7daa80d 100644 --- a/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h +++ b/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h @@ -146,6 +146,34 @@ public: #else +struct IShaderResourceVariable; + +// clang-format off +struct IShaderResourceVariableVtbl +{ + void (*Set)(class IDeviceObject* pObject); + void (*SetArray)(class IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements); + SHADER_RESOURCE_VARIABLE_TYPE(*GetType)(); + struct ShaderResourceDesc (*GetResourceDesc)(); + Uint32 (*GetIndex)(); + bool (*IsBound)(Uint32 ArrayIndex); +}; +// clang-format on + + +struct IShaderResourceVariable +{ + struct IObjectVtbl* pObjectVtbl; + struct IShaderResourceVariable* pShaderResourceVariableVtbl; +}; + +# define IShaderResourceVariable_Set(This, ...) (This)->pShaderResourceVariableVtbl->Set(This, __VA_ARGS__) +# define IShaderResourceVariable_SetArray(This, ...) (This)->pShaderResourceVariableVtbl->SetArray(This, __VA_ARGS__) +# define IShaderResourceVariable_GetType(This) (This)->pShaderResourceVariableVtbl->GetType(This) +# define IShaderResourceVariable_GetResourceDesc(This) (This)->pShaderResourceVariableVtbl->GetResourceDesc(This) +# define IShaderResourceVariable_GetIndex(This) (This)->pShaderResourceVariableVtbl->GetIndex(This) +# define IShaderResourceVariable_IsBound(This, ...) (This)->pShaderResourceVariableVtbl->IsBound(This, __VA_ARGS__) + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/SwapChain.h b/Graphics/GraphicsEngine/interface/SwapChain.h index eb065cfe..2cfcc5de 100644 --- a/Graphics/GraphicsEngine/interface/SwapChain.h +++ b/Graphics/GraphicsEngine/interface/SwapChain.h @@ -92,6 +92,27 @@ public: #else +struct ISwapChain; + +struct ISwapChainVtbl +{ + void (*Present)(Uint32 SyncInterval); + const struct SwapChainDesc* (*GetDesc)(); + void (*Resize)(Uint32 NewWidth, Uint32 NewHeight); + void (*SetFullscreenMode)(const struct DisplayModeAttribs* DisplayMode); + void (*SetWindowedMode)(); + struct ITextureView* (*GetCurrentBackBufferRTV)(); + struct ITextureView* (*GetDepthBufferDSV)(); +}; + +// clang-format on + +struct ISwapChain +{ + struct IObjectVtbl* pObjectVtbl; + struct ISwapChain* pSwapChainVtbl; +}; + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/Texture.h b/Graphics/GraphicsEngine/interface/Texture.h index 431e5d9f..195b487d 100644 --- a/Graphics/GraphicsEngine/interface/Texture.h +++ b/Graphics/GraphicsEngine/interface/Texture.h @@ -33,6 +33,7 @@ /// Definition of the Diligent::ITexture interface and related data structures #include "DeviceObject.h" +#include "TextureView.h" DILIGENT_BEGIN_NAMESPACE(Diligent) @@ -64,10 +65,10 @@ struct DepthStencilClearValue struct OptimizedClearValue { /// Format - enum TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN); + TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN); /// Render target clear value - Float32 Color[4] DEFAULT_INITIALIZER({}); + Float32 Color[4] DEFAULT_INITIALIZER({}); /// Depth stencil clear value struct DepthStencilClearValue DepthStencil; @@ -90,7 +91,7 @@ struct OptimizedClearValue struct TextureDesc DILIGENT_DERIVE(DeviceObjectAttribs) /// Texture type. See Diligent::RESOURCE_DIMENSION for details. - enum RESOURCE_DIMENSION Type DEFAULT_INITIALIZER(RESOURCE_DIM_UNDEFINED); + RESOURCE_DIMENSION Type DEFAULT_INITIALIZER(RESOURCE_DIM_UNDEFINED); /// Texture width, in pixels. Uint32 Width DEFAULT_INITIALIZER(0); @@ -108,32 +109,32 @@ struct TextureDesc DILIGENT_DERIVE(DeviceObjectAttribs) }; /// Texture format, see Diligent::TEXTURE_FORMAT. - enum TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN); + TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN); /// Number of Mip levels in the texture. Multisampled textures can only have 1 Mip level. /// Specify 0 to create full mipmap chain. - Uint32 MipLevels DEFAULT_INITIALIZER(1); + Uint32 MipLevels DEFAULT_INITIALIZER(1); /// Number of samples.\n /// Only 2D textures or 2D texture arrays can be multisampled. - Uint32 SampleCount DEFAULT_INITIALIZER(1); + Uint32 SampleCount DEFAULT_INITIALIZER(1); /// Texture usage. See Diligent::USAGE for details. - enum USAGE Usage DEFAULT_INITIALIZER(USAGE_DEFAULT); + USAGE Usage DEFAULT_INITIALIZER(USAGE_DEFAULT); /// Bind flags, see Diligent::BIND_FLAGS for details. \n /// The following bind flags are allowed: /// Diligent::BIND_SHADER_RESOURCE, Diligent::BIND_RENDER_TARGET, Diligent::BIND_DEPTH_STENCIL, /// Diligent::and BIND_UNORDERED_ACCESS. \n /// Multisampled textures cannot have Diligent::BIND_UNORDERED_ACCESS flag set - enum BIND_FLAGS BindFlags DEFAULT_INITIALIZER(BIND_NONE); + BIND_FLAGS BindFlags DEFAULT_INITIALIZER(BIND_NONE); /// CPU access flags or 0 if no CPU access is allowed, /// see Diligent::CPU_ACCESS_FLAGS for details. - enum CPU_ACCESS_FLAGS CPUAccessFlags DEFAULT_INITIALIZER(CPU_ACCESS_NONE); + CPU_ACCESS_FLAGS CPUAccessFlags DEFAULT_INITIALIZER(CPU_ACCESS_NONE); /// Miscellaneous flags, see Diligent::MISC_TEXTURE_FLAGS for details. - enum MISC_TEXTURE_FLAGS MiscFlags DEFAULT_INITIALIZER(MISC_TEXTURE_FLAG_NONE); + MISC_TEXTURE_FLAGS MiscFlags DEFAULT_INITIALIZER(MISC_TEXTURE_FLAG_NONE); /// Optimized clear value struct OptimizedClearValue ClearValue; @@ -308,9 +309,6 @@ struct MappedTextureSubresource class ITexture : public IDeviceObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override = 0; - /// Returns the texture description used to create the object virtual const TextureDesc& GetDesc()const override = 0; @@ -367,6 +365,35 @@ public: #else +struct ITexture; +struct ITextureView; + +struct ITextureVtbl +{ + void (*CreateView)(const struct TextureViewDesc* ViewDesc, class ITextureView** ppView); + class ITextureView* (*GetDefaultView)(enum TEXTURE_VIEW_TYPE ViewType); + void* (*GetNativeHandle)(); + void (*SetState)(RESOURCE_STATE State); + RESOURCE_STATE (*GetState)(); +}; + +// clang-format on + +struct ITexture +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + struct ITexture* pTextureVtbl; +}; + +# define ITexture_GetDesc(This) (const struct TextureDesc*)(This)->pDeviceObjectVtbl->GetDesc(This) + +# define ITexture_CreateView(This, ...) (This)->pTextureVtbl->SetSampler(This, __VA_ARGS__) +# define ITexture_GetDefaultView(This, ...) (This)->pTextureVtbl->GetDefaultView(This, __VA_ARGS__) +# define ITexture_GetNativeHandle(This) (This)->pTextureVtbl->GetNativeHandle(This) +# define ITexture_SetState(This, ...) (This)->pTextureVtbl->SetState(This, __VA_ARGS__) +# define ITexture_GetState(This) (This)->pTextureVtbl->GetState(This, __VA_ARGS__) + #endif DILIGENT_END_NAMESPACE // namespace Diligent diff --git a/Graphics/GraphicsEngine/interface/TextureView.h b/Graphics/GraphicsEngine/interface/TextureView.h index d54d4174..8cf56a3d 100644 --- a/Graphics/GraphicsEngine/interface/TextureView.h +++ b/Graphics/GraphicsEngine/interface/TextureView.h @@ -196,9 +196,6 @@ struct TextureViewDesc DILIGENT_DERIVE(DeviceObjectAttribs) class ITextureView : public IDeviceObject { public: - /// Queries the specific interface, see IObject::QueryInterface() for details - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override = 0; - /// Returns the texture view description used to create the object virtual const TextureViewDesc& GetDesc() const override = 0; @@ -224,6 +221,31 @@ public: #else +struct ITextureView; +struct ISampler; + +struct ITextureViewVtbl +{ + void (*SetSampler)(class ISampler* pSampler); + class ISampler* (*GetSampler)(); + class ITexture* (*GetTexture)(); +}; + +// clang-format on + +struct ITextureView +{ + struct IObjectVtbl* pObjectVtbl; + struct IDeviceObjectVtbl* pDeviceObjectVtbl; + struct ITextureView* pTextureViewVtbl; +}; + +# define ITextureView_GetDesc(This) (const struct TextureViewDesc*)(This)->pDeviceObjectVtbl->GetDesc(This) + +# define ITextureView_SetSampler(This) (This)->pTextureViewVtbl->SetSampler(This) +# define ITextureView_GetSampler(This) (This)->pTextureViewVtbl->GetSampler(This) +# define ITextureView_GetTexture(This) (This)->pTextureViewVtbl->GetTexture(This) + #endif DILIGENT_END_NAMESPACE |
