diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-06-20 04:11:49 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-06-20 04:11:49 +0000 |
| commit | e5730e1b8d6916db97e9e27a13f5a71fae28554c (patch) | |
| tree | 79c8f969192ced1ff8caf5a3c68c53fb9f2f6828 /Graphics/GraphicsEngineD3D11 | |
| parent | Improved formatting of D3D12 backend source (diff) | |
| download | DiligentCore-e5730e1b8d6916db97e9e27a13f5a71fae28554c.tar.gz DiligentCore-e5730e1b8d6916db97e9e27a13f5a71fae28554c.zip | |
Updaed code formatting of D3D11 backend source
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
42 files changed, 558 insertions, 492 deletions
diff --git a/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h index fec8f032..69ae864d 100644 --- a/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h @@ -52,39 +52,41 @@ class BufferD3D11Impl : public BufferBase<IBufferD3D11, BufferViewD3D11Impl, Fix { public: typedef BufferBase<IBufferD3D11, BufferViewD3D11Impl, FixedBlockMemoryAllocator> TBufferBase; - BufferD3D11Impl(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &BuffViewObjMemAllocator, - class RenderDeviceD3D11Impl *pDeviceD3D11, - const BufferDesc& BuffDesc, - const BufferData &BuffData = BufferData()); - BufferD3D11Impl(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &BuffViewObjMemAllocator, - class RenderDeviceD3D11Impl *pDeviceD3D11, - const BufferDesc& BuffDesc, - ID3D11Buffer *pd3d11Buffer); + + BufferD3D11Impl(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& BuffViewObjMemAllocator, + class RenderDeviceD3D11Impl* pDeviceD3D11, + const BufferDesc& BuffDesc, + const BufferData& BuffData = BufferData()); + + BufferD3D11Impl(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& BuffViewObjMemAllocator, + class RenderDeviceD3D11Impl* pDeviceD3D11, + const BufferDesc& BuffDesc, + ID3D11Buffer* pd3d11Buffer); ~BufferD3D11Impl(); virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; - virtual void UpdateData( IDeviceContext *pContext, Uint32 Offset, Uint32 Size, const PVoid pData )override final; - virtual void CopyData( IDeviceContext *pContext, IBuffer *pSrcBuffer, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size )override final; - virtual void Map( IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData )override final; - virtual void Unmap( IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags )override final; - virtual ID3D11Buffer *GetD3D11Buffer()override final{ return m_pd3d11Buffer; } + virtual void UpdateData( IDeviceContext* pContext, Uint32 Offset, Uint32 Size, const PVoid pData )override final; + virtual void CopyData( IDeviceContext* pContext, IBuffer* pSrcBuffer, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size )override final; + virtual void Map( IDeviceContext* pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData )override final; + virtual void Unmap( IDeviceContext* pContext, MAP_TYPE MapType, Uint32 MapFlags )override final; + virtual ID3D11Buffer* GetD3D11Buffer()override final{ return m_pd3d11Buffer; } virtual void* GetNativeHandle()override final { return GetD3D11Buffer(); } void ResetState(D3D11BufferState State){m_State = static_cast<Uint32>(State);} - void AddState(D3D11BufferState State){m_State |= static_cast<Uint32>(State);} + void AddState(D3D11BufferState State) {m_State |= static_cast<Uint32>(State);} void ClearState(D3D11BufferState State){m_State &= ~static_cast<Uint32>(State);} bool CheckState(D3D11BufferState State){return (m_State & static_cast<Uint32>(State)) ? true : false;} private: virtual void CreateViewInternal( const struct BufferViewDesc &ViewDesc, IBufferView **ppView, bool bIsDefaultView )override; - void CreateUAV( struct BufferViewDesc &UAVDesc, ID3D11UnorderedAccessView **ppD3D11UAV ); - void CreateSRV( struct BufferViewDesc &SRVDesc, ID3D11ShaderResourceView **ppD3D11SRV ); + void CreateUAV( struct BufferViewDesc& UAVDesc, ID3D11UnorderedAccessView** ppD3D11UAV ); + void CreateSRV( struct BufferViewDesc& SRVDesc, ID3D11ShaderResourceView** ppD3D11SRV ); friend class DeviceContextD3D11Impl; CComPtr<ID3D11Buffer> m_pd3d11Buffer; ///< D3D11 buffer object diff --git a/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h index b8949f39..da91f747 100644 --- a/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h @@ -40,12 +40,12 @@ class BufferViewD3D11Impl : public BufferViewBase<IBufferViewD3D11> public: typedef BufferViewBase<IBufferViewD3D11> TBufferViewBase; - BufferViewD3D11Impl( IReferenceCounters *pRefCounters, - IRenderDevice *pDevice, - const BufferViewDesc& ViewDesc, - class IBuffer *pBuffer, - ID3D11View* pD3D11View, - bool bIsDefaultView); + BufferViewD3D11Impl( IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, + const BufferViewDesc& ViewDesc, + class IBuffer* pBuffer, + ID3D11View* pD3D11View, + bool bIsDefaultView); virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface ) final; diff --git a/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h index 79bac353..d2a596d2 100644 --- a/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h @@ -39,9 +39,9 @@ class CommandListD3D11Impl : public CommandListBase<ICommandList> { public: typedef CommandListBase<ICommandList> TCommandListBase; - CommandListD3D11Impl(IReferenceCounters *pRefCounters, - IRenderDevice *pDevice, - ID3D11CommandList *pd3d11CommandList); + CommandListD3D11Impl(IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, + ID3D11CommandList* pd3d11CommandList); ~CommandListD3D11Impl(); ID3D11CommandList *GetD3D11CommandList(){ return m_pd3d11CommandList; } diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h index fb876a49..8d752fb8 100644 --- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h @@ -43,44 +43,49 @@ class DeviceContextD3D11Impl : public DeviceContextBase<IDeviceContextD3D11> public: typedef DeviceContextBase<IDeviceContextD3D11> TDeviceContextBase; - DeviceContextD3D11Impl(IReferenceCounters *pRefCounters, IMemoryAllocator &Allocator, IRenderDevice *pDevice, ID3D11DeviceContext *pd3d11DeviceContext, const struct EngineD3D11Attribs &EngineAttribs, bool bIsDeferred); + DeviceContextD3D11Impl(IReferenceCounters* pRefCounters, + IMemoryAllocator& Allocator, + IRenderDevice* pDevice, + ID3D11DeviceContext* pd3d11DeviceContext, + const struct EngineD3D11Attribs& EngineAttribs, + bool bIsDeferred); virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; - virtual void SetPipelineState(IPipelineState *pPipelineState)override final; + virtual void SetPipelineState(IPipelineState* pPipelineState)override final; - virtual void TransitionShaderResources(IPipelineState *pPipelineState, IShaderResourceBinding *pShaderResourceBinding)override final; + virtual void TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding)override final; - virtual void CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, Uint32 Flags)override final; + virtual void CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, Uint32 Flags)override final; virtual void SetStencilRef(Uint32 StencilRef)override final; virtual void SetBlendFactors(const float* pBlendFactors = nullptr)override final; - virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, Uint32 Flags )override final; + virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32* pOffsets, Uint32 Flags )override final; virtual void InvalidateState()override final; - virtual void SetIndexBuffer( IBuffer *pIndexBuffer, Uint32 ByteOffset )override final; + virtual void SetIndexBuffer( IBuffer* pIndexBuffer, Uint32 ByteOffset )override final; - virtual void SetViewports( Uint32 NumViewports, const Viewport *pViewports, Uint32 RTWidth, Uint32 RTHeight )override final; + virtual void SetViewports( Uint32 NumViewports, const Viewport* pViewports, Uint32 RTWidth, Uint32 RTHeight )override final; - virtual void SetScissorRects( Uint32 NumRects, const Rect *pRects, Uint32 RTWidth, Uint32 RTHeight )override final; + virtual void SetScissorRects( Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight )override final; - virtual void SetRenderTargets( Uint32 NumRenderTargets, ITextureView *ppRenderTargets[], ITextureView *pDepthStencil )override final; + virtual void SetRenderTargets( Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil )override final; virtual void Draw( DrawAttribs &DrawAttribs )override final; virtual void DispatchCompute( const DispatchComputeAttribs &DispatchAttrs )override final; - virtual void ClearDepthStencil( ITextureView *pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil)override final; + virtual void ClearDepthStencil( ITextureView* pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil)override final; - virtual void ClearRenderTarget( ITextureView *pView, const float *RGBA )override final; + virtual void ClearRenderTarget( ITextureView* pView, const float *RGBA )override final; virtual void Flush()override final; void FinishCommandList(class ICommandList **ppCommandList)override final; - virtual void ExecuteCommandList(class ICommandList *pCommandList)override final; + virtual void ExecuteCommandList(class ICommandList* pCommandList)override final; ID3D11DeviceContext* GetD3D11DeviceContext(){ return m_pd3d11DeviceContext; } @@ -103,44 +108,44 @@ private: void CommitD3D11IndexBuffer(VALUE_TYPE IndexType); /// Commits d3d11 vertex buffers to the d3d11 device context. - void CommitD3D11VertexBuffers(class PipelineStateD3D11Impl *pPipelineStateD3D11); + void CommitD3D11VertexBuffers(class PipelineStateD3D11Impl* pPipelineStateD3D11); /// Helper template function used to facilitate resource unbinding template<typename TD3D11ResourceViewType, typename TSetD3D11View, size_t NumSlots> void UnbindResourceView(TD3D11ResourceViewType CommittedD3D11ViewsArr[][NumSlots], - ID3D11Resource* CommittedD3D11ResourcesArr[][NumSlots], - Uint8 NumCommittedResourcesArr[], - IDeviceObject *pResToUnbind, - ID3D11Resource *pd3d11ResToUndind, - TSetD3D11View SetD3D11ViewMethods[]); + ID3D11Resource* CommittedD3D11ResourcesArr[][NumSlots], + Uint8 NumCommittedResourcesArr[], + IDeviceObject* pResToUnbind, + ID3D11Resource* pd3d11ResToUndind, + TSetD3D11View SetD3D11ViewMethods[]); /// Unbinds a texture from the shader resource view slots. /// \note The function only unbinds the texture from d3d11 device /// context. All shader bindings are retained. - void UnbindTextureFromInput(TextureBaseD3D11 *pTexture, ID3D11Resource *pd3d11Resource); + void UnbindTextureFromInput(TextureBaseD3D11* pTexture, ID3D11Resource* pd3d11Resource); /// Unbinds a buffer from the input (shader resource views slots, index /// and vertex buffer slots). /// \note The function only unbinds the buffer from d3d11 device /// context. All shader bindings are retained. - void UnbindBufferFromInput(BufferD3D11Impl *pBuffer, ID3D11Resource *pd3d11Buffer); + void UnbindBufferFromInput(BufferD3D11Impl* pBuffer, ID3D11Resource* pd3d11Buffer); /// Unbinds a resource from the UAV slots. /// \note The function only unbinds the texture from the device /// context. All shader bindings are retained. - void UnbindResourceFromUAV(IDeviceObject *pResource, ID3D11Resource *pd3d11Resource); + void UnbindResourceFromUAV(IDeviceObject* pResource, ID3D11Resource* pd3d11Resource); /// Unbinds a texture from render target slots. - void UnbindTextureFromRenderTarget(TextureBaseD3D11 *pResource); + void UnbindTextureFromRenderTarget(TextureBaseD3D11* pResource); /// Unbinds a texture from depth-stencil. - void UnbindTextureFromDepthStencil(TextureBaseD3D11 *pTexD3D11); + void UnbindTextureFromDepthStencil(TextureBaseD3D11* pTexD3D11); template<bool TransitionResources, bool CommitResources> - void TransitionAndCommitShaderResources(IPipelineState *pPSO, IShaderResourceBinding *pShaderResourceBinding); + void TransitionAndCommitShaderResources(IPipelineState* pPSO, IShaderResourceBinding* pShaderResourceBinding); void ClearStateCache(); @@ -226,19 +231,19 @@ private: /// Helper template function used to facilitate context verification template<UINT MaxResources, typename TD3D11ResourceType, typename TGetD3D11ResourcesType> - void dbgVerifyCommittedResources(TD3D11ResourceType CommittedD3D11ResourcesArr[][MaxResources], - Uint8 NumCommittedResourcesArr[], + void dbgVerifyCommittedResources(TD3D11ResourceType CommittedD3D11ResourcesArr[][MaxResources], + Uint8 NumCommittedResourcesArr[], TGetD3D11ResourcesType GetD3D11ResMethods[], - const Char *ResourceName, - SHADER_TYPE ShaderType); + const Char* ResourceName, + SHADER_TYPE ShaderType); /// Helper template function used to facilitate validation of SRV and UAV consistency with D3D11 resources template<UINT MaxResources, typename TD3D11ViewType> - void dbgVerifyViewConsistency(TD3D11ViewType CommittedD3D11ViewArr[][MaxResources], + void dbgVerifyViewConsistency(TD3D11ViewType CommittedD3D11ViewArr[][MaxResources], ID3D11Resource* CommittedD3D11ResourcesArr[][MaxResources], - Uint8 NumCommittedResourcesArr[], - const Char *ResourceName, - SHADER_TYPE ShaderType); + Uint8 NumCommittedResourcesArr[], + const Char* ResourceName, + SHADER_TYPE ShaderType); /// Debug function that verifies that SRVs cached in m_CommittedD3D11SRVs /// array comply with resources actually committed to the D3D11 device context diff --git a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h index 0a5897f2..cb44157e 100644 --- a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h @@ -42,7 +42,9 @@ class PipelineStateD3D11Impl : public PipelineStateBase<IPipelineStateD3D11, IRe public: typedef PipelineStateBase<IPipelineStateD3D11, IRenderDeviceD3D11> TPipelineStateBase; - PipelineStateD3D11Impl(IReferenceCounters *pRefCounters, class RenderDeviceD3D11Impl *pDeviceD3D11, const PipelineStateDesc& PipelineDesc); + PipelineStateD3D11Impl(IReferenceCounters* pRefCounters, + class RenderDeviceD3D11Impl* pDeviceD3D11, + const PipelineStateDesc& PipelineDesc); ~PipelineStateD3D11Impl(); virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; @@ -87,10 +89,10 @@ public: IShaderVariable* GetDummyShaderVariable(){return &m_DummyShaderVar;} private: - CComPtr<ID3D11BlendState> m_pd3d11BlendState; - CComPtr<ID3D11RasterizerState> m_pd3d11RasterizerState; + CComPtr<ID3D11BlendState> m_pd3d11BlendState; + CComPtr<ID3D11RasterizerState> m_pd3d11RasterizerState; CComPtr<ID3D11DepthStencilState> m_pd3d11DepthStencilState; - CComPtr<ID3D11InputLayout> m_pd3d11InputLayout; + CComPtr<ID3D11InputLayout> m_pd3d11InputLayout; class DataAllocators { diff --git a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h index bc8dc6cf..d92a5b8c 100644 --- a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h @@ -40,25 +40,29 @@ class RenderDeviceD3D11Impl : public RenderDeviceD3DBase<IRenderDeviceD3D11> public: typedef RenderDeviceD3DBase<IRenderDeviceD3D11> TRenderDeviceBase; - RenderDeviceD3D11Impl( IReferenceCounters *pRefCounters, IMemoryAllocator &RawMemAllocator, const EngineD3D11Attribs& EngineAttribs, ID3D11Device *pd3d11Device, Uint32 NumDeferredContexts ); + RenderDeviceD3D11Impl( IReferenceCounters* pRefCounters, + IMemoryAllocator& RawMemAllocator, + const EngineD3D11Attribs& EngineAttribs, + ID3D11Device* pd3d11Device, + Uint32 NumDeferredContexts ); virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; - virtual void CreateBuffer(const BufferDesc& BuffDesc, const BufferData &BuffData, IBuffer **ppBuffer)override final; + virtual void CreateBuffer(const BufferDesc& BuffDesc, const BufferData& BuffData, IBuffer** ppBuffer)override final; - virtual void CreateShader(const ShaderCreationAttribs &ShaderCreationAttribs, IShader **ppShader)override final; + virtual void CreateShader(const ShaderCreationAttribs& ShaderCreationAttribs, IShader** ppShader)override final; - virtual void CreateTexture(const TextureDesc& TexDesc, const TextureData &Data, ITexture **ppTexture)override final; + virtual void CreateTexture(const TextureDesc& TexDesc, const TextureData& Data, ITexture** ppTexture)override final; - virtual void CreateSampler(const SamplerDesc& SamplerDesc, ISampler **ppSampler)override final; + virtual void CreateSampler(const SamplerDesc& SamplerDesc, ISampler** ppSampler)override final; virtual void CreatePipelineState( const PipelineStateDesc &PipelineDesc, IPipelineState **ppPipelineState )override final; ID3D11Device* GetD3D11Device()override final{return m_pd3d11Device;} - virtual void CreateBufferFromD3DResource(ID3D11Buffer *pd3d11Buffer, const BufferDesc& BuffDesc, IBuffer **ppBuffer)override final; - virtual void CreateTextureFromD3DResource(ID3D11Texture1D *pd3d11Texture, ITexture **ppTexture)override final; - virtual void CreateTextureFromD3DResource(ID3D11Texture2D *pd3d11Texture, ITexture **ppTexture)override final; - virtual void CreateTextureFromD3DResource(ID3D11Texture3D *pd3d11Texture, ITexture **ppTexture)override final; + virtual void CreateBufferFromD3DResource(ID3D11Buffer* pd3d11Buffer, const BufferDesc& BuffDesc, IBuffer** ppBuffer)override final; + virtual void CreateTextureFromD3DResource(ID3D11Texture1D* pd3d11Texture, ITexture** ppTexture)override final; + virtual void CreateTextureFromD3DResource(ID3D11Texture2D* pd3d11Texture, ITexture** ppTexture)override final; + virtual void CreateTextureFromD3DResource(ID3D11Texture3D* pd3d11Texture, ITexture** ppTexture)override final; private: virtual void TestTextureFormat( TEXTURE_FORMAT TexFormat )override final; diff --git a/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h index 196d4160..6aa5ed43 100644 --- a/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h @@ -40,10 +40,12 @@ class SamplerD3D11Impl : public SamplerBase<ISamplerD3D11, IRenderDeviceD3D11> public: typedef SamplerBase<ISamplerD3D11, IRenderDeviceD3D11> TSamplerBase; - SamplerD3D11Impl(IReferenceCounters *pRefCounters, class RenderDeviceD3D11Impl *pRenderDeviceD3D11, const SamplerDesc& SamplerDesc); + SamplerD3D11Impl(IReferenceCounters* pRefCounters, + class RenderDeviceD3D11Impl* pRenderDeviceD3D11, + const SamplerDesc& SamplerDesc); ~SamplerD3D11Impl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface ) final; + virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject** ppInterface ) final; virtual ID3D11SamplerState* GetD3D11SamplerState()override final{ return m_pd3dSampler; } diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h index 39fc85bc..97ab9ba7 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h @@ -47,10 +47,12 @@ class ShaderD3D11Impl : public ShaderBase<IShaderD3D11, IRenderDeviceD3D11>, pub public: typedef ShaderBase<IShaderD3D11, IRenderDeviceD3D11> TShaderBase; - ShaderD3D11Impl(IReferenceCounters *pRefCounters, class RenderDeviceD3D11Impl *pRenderDeviceD3D11, const ShaderCreationAttribs &CreationAttribs); + ShaderD3D11Impl(IReferenceCounters* pRefCounters, + class RenderDeviceD3D11Impl* pRenderDeviceD3D11, + const ShaderCreationAttribs& CreationAttribs); ~ShaderD3D11Impl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; + virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject** ppInterface )override final; virtual void BindResources( IResourceMapping* pResourceMapping, Uint32 Flags )override final; diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.h index 53e57e27..bb29591c 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.h @@ -42,12 +42,14 @@ class ShaderResourceBindingD3D11Impl : public ShaderResourceBindingBase<IShaderR { public: typedef ShaderResourceBindingBase<IShaderResourceBindingD3D11> TBase; - ShaderResourceBindingD3D11Impl(IReferenceCounters *pRefCounters, class PipelineStateD3D11Impl *pPSO, bool IsInternal); + ShaderResourceBindingD3D11Impl(IReferenceCounters* pRefCounters, + class PipelineStateD3D11Impl* pPSO, + bool IsInternal); ~ShaderResourceBindingD3D11Impl(); - virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; + virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject** ppInterface )override final; - virtual void BindResources(Uint32 ShaderFlags, IResourceMapping *pResMapping, Uint32 Flags)override final; + virtual void BindResources(Uint32 ShaderFlags, IResourceMapping* pResMapping, Uint32 Flags)override final; virtual IShaderVariable *GetVariable(SHADER_TYPE ShaderType, const char *Name)override final; @@ -67,7 +69,7 @@ public: private: // The caches are indexed by the shader order in the PSO, not shader index ShaderResourceCacheD3D11* m_pBoundResourceCaches = nullptr; - ShaderResourceLayoutD3D11* m_pResourceLayouts = nullptr; + ShaderResourceLayoutD3D11* m_pResourceLayouts = nullptr; Int8 m_ShaderTypeIndex[6] = {}; diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.h index 34363c13..38a3b50b 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.h @@ -52,10 +52,10 @@ public: ~ShaderResourceCacheD3D11(); - ShaderResourceCacheD3D11(const ShaderResourceCacheD3D11&) = delete; + ShaderResourceCacheD3D11 (const ShaderResourceCacheD3D11&) = delete; ShaderResourceCacheD3D11& operator = (const ShaderResourceCacheD3D11&) = delete; - ShaderResourceCacheD3D11(ShaderResourceCacheD3D11&&) = delete; - ShaderResourceCacheD3D11& operator = (ShaderResourceCacheD3D11&&) = delete; + ShaderResourceCacheD3D11 (ShaderResourceCacheD3D11&&) = delete; + ShaderResourceCacheD3D11& operator = (ShaderResourceCacheD3D11&&) = delete; /// Describes resources associated with the cached constant buffer struct CachedCB @@ -93,7 +93,7 @@ public: // There is no need to keep strong reference to D3D11 resource as // it is already kept by either pTexture or pBuffer ID3D11Resource *pd3d11Resource; - CachedResource() : pTexture(nullptr), pBuffer(nullptr), pd3d11Resource(nullptr) + CachedResource()noexcept : pTexture(nullptr), pBuffer(nullptr), pd3d11Resource(nullptr) {} __forceinline void Set(RefCntAutoPtr<TextureViewD3D11Impl>&& pTexView) @@ -116,10 +116,10 @@ public: }; void Initialize(Int32 CBCount, Int32 SRVCount, Int32 SamplerCount, Int32 UAVCount, class IMemoryAllocator &MemAllocator); - void Destroy(class IMemoryAllocator &MemAllocator); + void Destroy(class IMemoryAllocator& MemAllocator); - __forceinline void SetCB(Uint32 Slot, RefCntAutoPtr<BufferD3D11Impl> &&pBuffD3D11Impl) + __forceinline void SetCB(Uint32 Slot, RefCntAutoPtr<BufferD3D11Impl>&& pBuffD3D11Impl) { auto *pd3d11Buff = pBuffD3D11Impl ? pBuffD3D11Impl->BufferD3D11Impl::GetD3D11Buffer() : nullptr; SetD3D11ResourceInternal<CachedCB>(Slot, GetCBCount(), &ShaderResourceCacheD3D11::GetCBArrays, std::move(pBuffD3D11Impl), pd3d11Buff); @@ -131,7 +131,7 @@ public: SetD3D11ResourceInternal<CachedResource>(Slot, GetSRVCount(), &ShaderResourceCacheD3D11::GetSRVArrays, std::move(pTexView), pd3d11SRV); } - __forceinline void SetBufSRV(Uint32 Slot, RefCntAutoPtr<BufferViewD3D11Impl> &&pBuffView) + __forceinline void SetBufSRV(Uint32 Slot, RefCntAutoPtr<BufferViewD3D11Impl>&& pBuffView) { auto pd3d11SRV = pBuffView ? static_cast<ID3D11ShaderResourceView*>(pBuffView->BufferViewD3D11Impl::GetD3D11View()) : nullptr; SetD3D11ResourceInternal<CachedResource>(Slot, GetSRVCount(), &ShaderResourceCacheD3D11::GetSRVArrays, std::move(pBuffView), pd3d11SRV); @@ -143,7 +143,7 @@ public: SetD3D11ResourceInternal<CachedResource>(Slot, GetUAVCount(), &ShaderResourceCacheD3D11::GetUAVArrays, std::move(pTexView), pd3d11UAV); } - __forceinline void SetBufUAV(Uint32 Slot, RefCntAutoPtr<BufferViewD3D11Impl> &&pBuffView) + __forceinline void SetBufUAV(Uint32 Slot, RefCntAutoPtr<BufferViewD3D11Impl>&& pBuffView) { auto pd3d11UAV = pBuffView ? static_cast<ID3D11UnorderedAccessView*>(pBuffView->BufferViewD3D11Impl::GetD3D11View()) : nullptr; SetD3D11ResourceInternal<CachedResource>(Slot, GetUAVCount(), &ShaderResourceCacheD3D11::GetUAVArrays, std::move(pBuffView), pd3d11UAV); diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h index 354c21d5..af4a60dc 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h @@ -53,19 +53,19 @@ public: ~ShaderResourceLayoutD3D11(); // No copies or moves - ShaderResourceLayoutD3D11(const ShaderResourceLayoutD3D11&) = delete; + ShaderResourceLayoutD3D11 (const ShaderResourceLayoutD3D11&) = delete; ShaderResourceLayoutD3D11& operator = (const ShaderResourceLayoutD3D11&) = delete; - ShaderResourceLayoutD3D11(ShaderResourceLayoutD3D11&&) = default; - ShaderResourceLayoutD3D11& operator = (ShaderResourceLayoutD3D11&&) = delete; + ShaderResourceLayoutD3D11 (ShaderResourceLayoutD3D11&&) = default; + ShaderResourceLayoutD3D11& operator = (ShaderResourceLayoutD3D11&&) = delete; void Initialize(const std::shared_ptr<const ShaderResourcesD3D11>& pSrcResources, - const SHADER_VARIABLE_TYPE *VarTypes, - Uint32 NumVarTypes, - ShaderResourceCacheD3D11& ResourceCache, - IMemoryAllocator& ResCacheDataAllocator, - IMemoryAllocator& ResLayoutDataAllocator); + const SHADER_VARIABLE_TYPE* VarTypes, + Uint32 NumVarTypes, + ShaderResourceCacheD3D11& ResourceCache, + IMemoryAllocator& ResCacheDataAllocator, + IMemoryAllocator& ResLayoutDataAllocator); - void CopyResources(ShaderResourceCacheD3D11 &DstCache); + void CopyResources(ShaderResourceCacheD3D11& DstCache); using ShaderVariableD3D11Base = ShaderVariableD3DBase<ShaderResourceLayoutD3D11>; @@ -76,8 +76,8 @@ public: ShaderVariableD3D11Base(ParentResLayout, ResourceAttribs) {} // Non-virtual function - __forceinline void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout); - virtual void Set(IDeviceObject *pObject)override final{ BindResource(pObject, 0, nullptr); } + __forceinline void BindResource(IDeviceObject* pObject, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11* dbgResLayout); + virtual void Set(IDeviceObject* pObject)override final{ BindResource(pObject, 0, nullptr); } virtual void SetArray(IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements)override final { @@ -92,14 +92,14 @@ public: { TexAndSamplerBindInfo( const D3DShaderResourceAttribs& _TextureAttribs, const D3DShaderResourceAttribs& _SamplerAttribs, - ShaderResourceLayoutD3D11 &ParentResLayout) : + ShaderResourceLayoutD3D11& ParentResLayout) : ShaderVariableD3D11Base(ParentResLayout, _TextureAttribs), SamplerAttribs(_SamplerAttribs) {} // Non-virtual function - __forceinline void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout); - virtual void Set(IDeviceObject *pObject)override final{ BindResource(pObject, 0, nullptr); } + __forceinline void BindResource(IDeviceObject* pObject, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11* dbgResLayout); + virtual void Set(IDeviceObject* pObject)override final{ BindResource(pObject, 0, nullptr); } virtual void SetArray(IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements)override final { @@ -117,13 +117,13 @@ public: struct TexUAVBindInfo : ShaderVariableD3D11Base { TexUAVBindInfo( const D3DShaderResourceAttribs& ResourceAttribs, - ShaderResourceLayoutD3D11 &ParentResLayout ) : + ShaderResourceLayoutD3D11& ParentResLayout ) : ShaderVariableD3D11Base(ParentResLayout, ResourceAttribs) {} // Provide non-virtual function - __forceinline void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout); - virtual void Set(IDeviceObject *pObject)override final{ BindResource(pObject, 0, nullptr); } + __forceinline void BindResource(IDeviceObject* pObject, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11* dbgResLayout); + virtual void Set(IDeviceObject* pObject)override final{ BindResource(pObject, 0, nullptr); } virtual void SetArray(IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements)override final { @@ -137,13 +137,13 @@ public: struct BuffUAVBindInfo : ShaderVariableD3D11Base { BuffUAVBindInfo( const D3DShaderResourceAttribs& ResourceAttribs, - ShaderResourceLayoutD3D11 &ParentResLayout ) : + ShaderResourceLayoutD3D11& ParentResLayout ) : ShaderVariableD3D11Base(ParentResLayout, ResourceAttribs) {} // Non-virtual function - __forceinline void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout); - virtual void Set(IDeviceObject *pObject)override final{ BindResource(pObject, 0, nullptr); } + __forceinline void BindResource(IDeviceObject* pObject, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11* dbgResLayout); + virtual void Set(IDeviceObject* pObject)override final{ BindResource(pObject, 0, nullptr); } virtual void SetArray(IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements)override final { @@ -157,13 +157,13 @@ public: struct BuffSRVBindInfo : ShaderVariableD3D11Base { BuffSRVBindInfo( const D3DShaderResourceAttribs& ResourceAttribs, - ShaderResourceLayoutD3D11 &ParentResLayout ) : + ShaderResourceLayoutD3D11& ParentResLayout ) : ShaderVariableD3D11Base(ParentResLayout, ResourceAttribs) {} // Non-virtual function - __forceinline void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout); - virtual void Set(IDeviceObject *pObject)override final{ BindResource(pObject, 0, nullptr); } + __forceinline void BindResource(IDeviceObject* pObject, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11* dbgResLayout); + virtual void Set(IDeviceObject* pObject)override final{ BindResource(pObject, 0, nullptr); } virtual void SetArray(IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements)override final { @@ -176,7 +176,7 @@ public: // dbgResourceCache is only used for sanity check and as a remainder that the resource cache must be alive // while Layout is alive - void BindResources( IResourceMapping* pResourceMapping, Uint32 Flags, const ShaderResourceCacheD3D11 &dbgResourceCache ); + void BindResources( IResourceMapping* pResourceMapping, Uint32 Flags, const ShaderResourceCacheD3D11& dbgResourceCache ); #ifdef VERIFY_SHADER_BINDINGS void dbgVerifyBindings()const; @@ -270,7 +270,7 @@ private: typename THandleTexUAV, typename THandleBufSRV, typename THandleBufUAV> - void HandleResources(THandleCB HandleCB, + void HandleResources(THandleCB HandleCB, THandleTexSRV HandleTexSRV, THandleTexUAV HandleTexUAV, THandleBufSRV HandleBufSRV, diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h index 93c07ad3..da6809e4 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h @@ -84,7 +84,7 @@ class ShaderResourcesD3D11 : public ShaderResources { public: // Loads shader resources from the compiled shader bytecode - ShaderResourcesD3D11(class RenderDeviceD3D11Impl *pDeviceD3D11Impl, ID3DBlob *pShaderBytecode, const ShaderDesc &ShdrDesc); + ShaderResourcesD3D11(class RenderDeviceD3D11Impl* pDeviceD3D11Impl, ID3DBlob* pShaderBytecode, const ShaderDesc& ShdrDesc); ~ShaderResourcesD3D11(); __forceinline Int32 GetMaxCBBindPoint() const{return m_MaxCBBindPoint; } @@ -99,12 +99,12 @@ public: ID3D11SamplerState* CommittedD3D11Samplers[], ID3D11UnorderedAccessView* CommittedD3D11UAVs[], ID3D11Resource* CommittedD3D11UAVResources[], - class ShaderResourceCacheD3D11 &ResourceCache)const; + class ShaderResourceCacheD3D11& ResourceCache)const; #endif const Char *GetShaderName()const{return m_ShaderName;} - void InitStaticSamplers(class ShaderResourceCacheD3D11 &ResourceCache)const; + void InitStaticSamplers(class ShaderResourceCacheD3D11& ResourceCache)const; private: typedef Int8 MaxBindPointType; diff --git a/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h index f1ea1a4d..28775938 100644 --- a/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h @@ -38,12 +38,12 @@ class SwapChainD3D11Impl : public SwapChainD3DBase<ISwapChainD3D11, IDXGISwapCha { public: using TSwapChainBase = SwapChainD3DBase<ISwapChainD3D11, IDXGISwapChain>; - SwapChainD3D11Impl(IReferenceCounters *pRefCounters, - const SwapChainDesc& SCDesc, - const FullScreenModeDesc& FSDesc, - class RenderDeviceD3D11Impl* pRenderDeviceD3D11, + SwapChainD3D11Impl(IReferenceCounters* pRefCounters, + const SwapChainDesc& SCDesc, + const FullScreenModeDesc& FSDesc, + class RenderDeviceD3D11Impl* pRenderDeviceD3D11, class DeviceContextD3D11Impl* pDeviceContextD3D11, - void* pNativeWndHandle); + void* pNativeWndHandle); ~SwapChainD3D11Impl(); virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; diff --git a/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h b/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h index 4878ed86..d089cb42 100644 --- a/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h @@ -35,22 +35,23 @@ namespace Diligent class Texture1D_D3D11 : public TextureBaseD3D11 { public: - Texture1D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - class RenderDeviceD3D11Impl *pDeviceD3D11, - const TextureDesc& TexDesc, - const TextureData &InitData = TextureData()); - Texture1D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - class RenderDeviceD3D11Impl *pDeviceD3D11, - ID3D11Texture1D *pd3d11Texture); + Texture1D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + class RenderDeviceD3D11Impl* pDeviceD3D11, + const TextureDesc& TexDesc, + const TextureData& InitData = TextureData()); + + Texture1D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + class RenderDeviceD3D11Impl* pDeviceD3D11, + ID3D11Texture1D* pd3d11Texture); ~Texture1D_D3D11(); protected: - virtual void CreateSRV( TextureViewDesc &SRVDesc, ID3D11ShaderResourceView **ppD3D11SRV )override final; - virtual void CreateRTV( TextureViewDesc &RTVDesc, ID3D11RenderTargetView **ppD3D11RTV )override final; - virtual void CreateDSV( TextureViewDesc &DSVDesc, ID3D11DepthStencilView **ppD3D11DSV )override final; - virtual void CreateUAV( TextureViewDesc &UAVDesc, ID3D11UnorderedAccessView **ppD3D11UAV )override final; + virtual void CreateSRV( TextureViewDesc& SRVDesc, ID3D11ShaderResourceView** ppD3D11SRV )override final; + virtual void CreateRTV( TextureViewDesc& RTVDesc, ID3D11RenderTargetView** ppD3D11RTV )override final; + virtual void CreateDSV( TextureViewDesc& DSVDesc, ID3D11DepthStencilView** ppD3D11DSV )override final; + virtual void CreateUAV( TextureViewDesc& UAVDesc, ID3D11UnorderedAccessView** ppD3D11UAV )override final; }; } diff --git a/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h b/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h index 4e5c9ef5..fd1f61d6 100644 --- a/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h @@ -35,22 +35,23 @@ namespace Diligent class Texture2D_D3D11 : public TextureBaseD3D11 { public: - Texture2D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - class RenderDeviceD3D11Impl *pDeviceD3D11, - const TextureDesc& TexDesc, - const TextureData &InitData = TextureData()); - Texture2D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - class RenderDeviceD3D11Impl *pDeviceD3D11, - ID3D11Texture2D *pd3d11Texture); + Texture2D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + class RenderDeviceD3D11Impl* pDeviceD3D11, + const TextureDesc& TexDesc, + const TextureData& InitData = TextureData()); + + Texture2D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + class RenderDeviceD3D11Impl* pDeviceD3D11, + ID3D11Texture2D* pd3d11Texture); ~Texture2D_D3D11(); protected: - virtual void CreateSRV( TextureViewDesc &SRVDesc, ID3D11ShaderResourceView **ppD3D11SRV )override final; - virtual void CreateRTV( TextureViewDesc &RTVDesc, ID3D11RenderTargetView **ppD3D11RTV )override final; - virtual void CreateDSV( TextureViewDesc &DSVDesc, ID3D11DepthStencilView **ppD3D11DSV )override final; - virtual void CreateUAV( TextureViewDesc &UAVDesc, ID3D11UnorderedAccessView **ppD3D11UAV )override final; + virtual void CreateSRV( TextureViewDesc& SRVDesc, ID3D11ShaderResourceView** ppD3D11SRV )override final; + virtual void CreateRTV( TextureViewDesc& RTVDesc, ID3D11RenderTargetView** ppD3D11RTV )override final; + virtual void CreateDSV( TextureViewDesc& DSVDesc, ID3D11DepthStencilView** ppD3D11DSV )override final; + virtual void CreateUAV( TextureViewDesc& UAVDesc, ID3D11UnorderedAccessView** ppD3D11UAV )override final; }; } diff --git a/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h b/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h index 1ba4912b..8df510f3 100644 --- a/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h @@ -35,22 +35,23 @@ namespace Diligent class Texture3D_D3D11 : public TextureBaseD3D11 { public: - Texture3D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - class RenderDeviceD3D11Impl *pDeviceD3D11, - const TextureDesc& TexDesc, - const TextureData &InitData = TextureData()); - Texture3D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - class RenderDeviceD3D11Impl *pDeviceD3D11, - ID3D11Texture3D *pd3d11Texture); + Texture3D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + class RenderDeviceD3D11Impl* pDeviceD3D11, + const TextureDesc& TexDesc, + const TextureData& InitData = TextureData()); + + Texture3D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + class RenderDeviceD3D11Impl* pDeviceD3D11, + ID3D11Texture3D* pd3d11Texture); ~Texture3D_D3D11(); protected: - virtual void CreateSRV( TextureViewDesc &SRVDesc, ID3D11ShaderResourceView **ppD3D11SRV )override final; - virtual void CreateRTV( TextureViewDesc &RTVDesc, ID3D11RenderTargetView **ppD3D11RTV )override final; - virtual void CreateDSV( TextureViewDesc &DSVDesc, ID3D11DepthStencilView **ppD3D11DSV )override final; - virtual void CreateUAV( TextureViewDesc &UAVDesc, ID3D11UnorderedAccessView **ppD3D11UAV )override final; + virtual void CreateSRV( TextureViewDesc& SRVDesc, ID3D11ShaderResourceView** ppD3D11SRV )override final; + virtual void CreateRTV( TextureViewDesc& RTVDesc, ID3D11RenderTargetView** ppD3D11RTV )override final; + virtual void CreateDSV( TextureViewDesc& DSVDesc, ID3D11DepthStencilView** ppD3D11DSV )override final; + virtual void CreateUAV( TextureViewDesc& UAVDesc, ID3D11UnorderedAccessView** ppD3D11UAV )override final; }; } diff --git a/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h b/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h index f8e05a6d..dcd58c0d 100644 --- a/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h @@ -52,16 +52,16 @@ class TextureBaseD3D11 : public TextureBase<ITextureD3D11, TextureViewD3D11Impl, public: typedef TextureBase<ITextureD3D11, TextureViewD3D11Impl, FixedBlockMemoryAllocator> TTextureBase; - TextureBaseD3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - class RenderDeviceD3D11Impl *pDeviceD3D11, - const TextureDesc& TexDesc, - const TextureData &InitData = TextureData()); + TextureBaseD3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + class RenderDeviceD3D11Impl* pDeviceD3D11, + const TextureDesc& TexDesc, + const TextureData& InitData = TextureData()); ~TextureBaseD3D11(); virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; - virtual void UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )override final; + virtual void UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData )override final; //virtual void CopyData(CTexture *pSrcTexture, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size); virtual void Map( IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags, MappedTextureSubresource &MappedData )override final; @@ -71,19 +71,19 @@ public: virtual void* GetNativeHandle()override final { return GetD3D11Texture(); } - void CopyData(IDeviceContext *pContext, - ITexture *pSrcTexture, - Uint32 SrcMipLevel, - Uint32 SrcSlice, - const Box *pSrcBox, - Uint32 DstMipLevel, - Uint32 DstSlice, - Uint32 DstX, - Uint32 DstY, - Uint32 DstZ); + void CopyData(IDeviceContext* pContext, + ITexture* pSrcTexture, + Uint32 SrcMipLevel, + Uint32 SrcSlice, + const Box* pSrcBox, + Uint32 DstMipLevel, + Uint32 DstSlice, + Uint32 DstX, + Uint32 DstY, + Uint32 DstZ); void ResetState(D3D11TextureState State){m_State = static_cast<Uint32>(State);} - void AddState(D3D11TextureState State){m_State |= static_cast<Uint32>(State);} + void AddState(D3D11TextureState State) {m_State |= static_cast<Uint32>(State);} void ClearState(D3D11TextureState State){m_State &= ~static_cast<Uint32>(State);} bool CheckState(D3D11TextureState State){return (m_State & static_cast<Uint32>(State)) ? true : false;} @@ -92,10 +92,10 @@ protected: void PrepareD3D11InitData(const TextureData &InitData, Uint32 NumSubresources, std::vector<D3D11_SUBRESOURCE_DATA, STDAllocatorRawMem<D3D11_SUBRESOURCE_DATA> > &D3D11InitData); - virtual void CreateSRV( TextureViewDesc &SRVDesc, ID3D11ShaderResourceView **ppD3D11SRV ) = 0; - virtual void CreateRTV( TextureViewDesc &RTVDesc, ID3D11RenderTargetView **ppD3D11RTV ) = 0; - virtual void CreateDSV( TextureViewDesc &DSVDesc, ID3D11DepthStencilView **ppD3D11DSV ) = 0; - virtual void CreateUAV( TextureViewDesc &UAVDesc, ID3D11UnorderedAccessView **ppD3D11UAV ) = 0; + virtual void CreateSRV( TextureViewDesc& SRVDesc, ID3D11ShaderResourceView** ppD3D11SRV ) = 0; + virtual void CreateRTV( TextureViewDesc& RTVDesc, ID3D11RenderTargetView** ppD3D11RTV ) = 0; + virtual void CreateDSV( TextureViewDesc& DSVDesc, ID3D11DepthStencilView** ppD3D11DSV ) = 0; + virtual void CreateUAV( TextureViewDesc& UAVDesc, ID3D11UnorderedAccessView** ppD3D11UAV ) = 0; friend class RenderDeviceD3D11Impl; /// D3D11 texture diff --git a/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h index 652ce3a0..3dca4273 100644 --- a/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h @@ -41,12 +41,12 @@ class TextureViewD3D11Impl : public TextureViewBase<ITextureViewD3D11> public: typedef TextureViewBase<ITextureViewD3D11> TTextureViewBase; - TextureViewD3D11Impl( IReferenceCounters *pRefCounters, - IRenderDevice *pDevice, + TextureViewD3D11Impl( IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, const TextureViewDesc& ViewDesc, - class ITexture *pTexture, - ID3D11View* pD3D11View, - bool bIsDefaultView); + class ITexture* pTexture, + ID3D11View* pD3D11View, + bool bIsDefaultView); virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override final; diff --git a/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h b/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h index 78baed0c..18a184de 100644 --- a/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/BufferD3D11.h @@ -44,7 +44,7 @@ public: /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11Buffer *GetD3D11Buffer() = 0; + virtual ID3D11Buffer* GetD3D11Buffer() = 0; }; } diff --git a/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h b/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h index 7998f6fd..9285ffe3 100644 --- a/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/RenderDeviceD3D11.h @@ -57,7 +57,7 @@ public: /// buffer interface will be stored. /// The function calls AddRef(), so that the new object will contain /// one reference. - virtual void CreateBufferFromD3DResource(ID3D11Buffer *pd3d11Buffer, const BufferDesc& BuffDesc, IBuffer **ppBuffer) = 0; + virtual void CreateBufferFromD3DResource(ID3D11Buffer* pd3d11Buffer, const BufferDesc& BuffDesc, IBuffer** ppBuffer) = 0; /// Creates a texture object from native d3d11 1D texture @@ -66,7 +66,7 @@ public: /// texture interface will be stored. /// The function calls AddRef(), so that the new object will contain /// one reference. - virtual void CreateTextureFromD3DResource(ID3D11Texture1D *pd3d11Texture, ITexture **ppTexture) = 0; + virtual void CreateTextureFromD3DResource(ID3D11Texture1D* pd3d11Texture, ITexture** ppTexture) = 0; /// Creates a texture object from native d3d11 2D texture @@ -75,7 +75,7 @@ public: /// texture interface will be stored. /// The function calls AddRef(), so that the new object will contain /// one reference. - virtual void CreateTextureFromD3DResource(ID3D11Texture2D *pd3d11Texture, ITexture **ppTexture) = 0; + virtual void CreateTextureFromD3DResource(ID3D11Texture2D* pd3d11Texture, ITexture** ppTexture) = 0; /// Creates a texture object from native d3d11 3D texture @@ -84,7 +84,7 @@ public: /// texture interface will be stored. /// The function calls AddRef(), so that the new object will contain /// one reference. - virtual void CreateTextureFromD3DResource(ID3D11Texture3D *pd3d11Texture, ITexture **ppTexture) = 0; + virtual void CreateTextureFromD3DResource(ID3D11Texture3D* pd3d11Texture, ITexture** ppTexture) = 0; }; diff --git a/Graphics/GraphicsEngineD3D11/interface/RenderDeviceFactoryD3D11.h b/Graphics/GraphicsEngineD3D11/interface/RenderDeviceFactoryD3D11.h index 69029ce9..6bba85f6 100644 --- a/Graphics/GraphicsEngineD3D11/interface/RenderDeviceFactoryD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/RenderDeviceFactoryD3D11.h @@ -45,32 +45,32 @@ class IEngineFactoryD3D11 { public: virtual void CreateDeviceAndContextsD3D11( const EngineD3D11Attribs& EngineAttribs, - IRenderDevice **ppDevice, - IDeviceContext **ppContexts, - Uint32 NumDeferredContexts ) = 0; + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts ) = 0; - virtual void CreateSwapChainD3D11( IRenderDevice *pDevice, - IDeviceContext *pImmediateContext, - const SwapChainDesc& SCDesc, + virtual void CreateSwapChainD3D11( IRenderDevice* pDevice, + IDeviceContext* pImmediateContext, + const SwapChainDesc& SCDesc, const FullScreenModeDesc& FSDesc, - void* pNativeWndHandle, - ISwapChain **ppSwapChain ) = 0; + void* pNativeWndHandle, + ISwapChain** ppSwapChain ) = 0; - virtual void AttachToD3D11Device(void *pd3d11NativeDevice, - void *pd3d11ImmediateContext, + virtual void AttachToD3D11Device(void* pd3d11NativeDevice, + void* pd3d11ImmediateContext, const EngineD3D11Attribs& EngineAttribs, - IRenderDevice **ppDevice, - IDeviceContext **ppContexts, - Uint32 NumDeferredContexts) = 0; - - virtual void EnumerateHardwareAdapters(Uint32 &NumAdapters, - HardwareAdapterAttribs *Adapters) = 0; - - virtual void EnumerateDisplayModes(Uint32 AdapterId, - Uint32 OutputId, - TEXTURE_FORMAT Format, - Uint32 &NumDisplayModes, - DisplayModeAttribs *DisplayModes) = 0; + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts) = 0; + + virtual void EnumerateHardwareAdapters(Uint32& NumAdapters, + HardwareAdapterAttribs* Adapters) = 0; + + virtual void EnumerateDisplayModes(Uint32 AdapterId, + Uint32 OutputId, + TEXTURE_FORMAT Format, + Uint32& NumDisplayModes, + DisplayModeAttribs* DisplayModes) = 0; }; #if ENGINE_DLL @@ -128,4 +128,4 @@ public: #endif -}
\ No newline at end of file +} diff --git a/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h b/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h index 3d903ec0..f6ee357e 100644 --- a/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h +++ b/Graphics/GraphicsEngineD3D11/interface/SwapChainD3D11.h @@ -44,19 +44,19 @@ public: /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual IDXGISwapChain *GetDXGISwapChain() = 0; + virtual IDXGISwapChain* GetDXGISwapChain() = 0; /// Returns d3d11 render target view of the swap chain's back buffer /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11RenderTargetView *GetRTV() = 0; + virtual ID3D11RenderTargetView* GetRTV() = 0; /// Returns d3d11 depth stencil view of the internal depth buffer object /// The method does *NOT* call AddRef() on the returned interface, /// so Release() must not be called. - virtual ID3D11DepthStencilView *GetDSV() = 0; + virtual ID3D11DepthStencilView* GetDSV() = 0; }; } diff --git a/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp index 5224cb0b..9ee4726c 100644 --- a/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp @@ -35,11 +35,11 @@ namespace Diligent { -BufferD3D11Impl :: BufferD3D11Impl(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &BuffViewObjMemAllocator, - RenderDeviceD3D11Impl *pRenderDeviceD3D11, - const BufferDesc& BuffDesc, - const BufferData &BuffData /*= BufferData()*/) : +BufferD3D11Impl :: BufferD3D11Impl(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& BuffViewObjMemAllocator, + RenderDeviceD3D11Impl* pRenderDeviceD3D11, + const BufferDesc& BuffDesc, + const BufferData& BuffData /*= BufferData()*/) : TBufferBase(pRefCounters, BuffViewObjMemAllocator, pRenderDeviceD3D11, BuffDesc, false) { #define LOG_BUFFER_ERROR_AND_THROW(...) LOG_ERROR_AND_THROW("Buffer \"", m_Desc.Name ? m_Desc.Name : "", "\": ", ##__VA_ARGS__); @@ -139,11 +139,11 @@ static BufferDesc BuffDescFromD3D11Buffer(ID3D11Buffer *pd3d11Buffer, BufferDesc return BuffDesc; } -BufferD3D11Impl :: BufferD3D11Impl(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &BuffViewObjMemAllocator, - class RenderDeviceD3D11Impl *pDeviceD3D11, - const BufferDesc& BuffDesc, - ID3D11Buffer *pd3d11Buffer) : +BufferD3D11Impl :: BufferD3D11Impl(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& BuffViewObjMemAllocator, + class RenderDeviceD3D11Impl* pDeviceD3D11, + const BufferDesc& BuffDesc, + ID3D11Buffer* pd3d11Buffer) : TBufferBase(pRefCounters, BuffViewObjMemAllocator, pDeviceD3D11, BuffDescFromD3D11Buffer(pd3d11Buffer, BuffDesc), false) { m_pd3d11Buffer = pd3d11Buffer; @@ -189,7 +189,7 @@ void BufferD3D11Impl :: CopyData(IDeviceContext *pContext, IBuffer *pSrcBuffer, pd3d11DeviceContext->CopySubresourceRegion(m_pd3d11Buffer, 0, DstOffset, 0, 0, pSrBufferD3D11Impl->m_pd3d11Buffer, 0, &SrcBox); } -void BufferD3D11Impl :: Map(IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData) +void BufferD3D11Impl :: Map(IDeviceContext* pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData) { TBufferBase::Map( pContext, MapType, MapFlags, pMappedData ); @@ -206,7 +206,7 @@ void BufferD3D11Impl :: Map(IDeviceContext *pContext, MAP_TYPE MapType, Uint32 M VERIFY( pMappedData || (MapFlags & MAP_FLAG_DO_NOT_WAIT) && (hr == DXGI_ERROR_WAS_STILL_DRAWING), "Map failed" ); } -void BufferD3D11Impl::Unmap( IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags ) +void BufferD3D11Impl::Unmap( IDeviceContext* pContext, MAP_TYPE MapType, Uint32 MapFlags ) { TBufferBase::Unmap( pContext, MapType, MapFlags ); @@ -214,7 +214,7 @@ void BufferD3D11Impl::Unmap( IDeviceContext *pContext, MAP_TYPE MapType, Uint32 pd3d11DeviceContext->Unmap(m_pd3d11Buffer, 0); } -void BufferD3D11Impl::CreateViewInternal( const BufferViewDesc &OrigViewDesc, IBufferView **ppView, bool bIsDefaultView ) +void BufferD3D11Impl::CreateViewInternal( const BufferViewDesc& OrigViewDesc, IBufferView** ppView, bool bIsDefaultView ) { VERIFY( ppView != nullptr, "Null pointer provided" ); if( !ppView )return; @@ -254,7 +254,7 @@ void BufferD3D11Impl::CreateViewInternal( const BufferViewDesc &OrigViewDesc, IB } } -void BufferD3D11Impl::CreateUAV( BufferViewDesc &UAVDesc, ID3D11UnorderedAccessView **ppD3D11UAV ) +void BufferD3D11Impl::CreateUAV( BufferViewDesc& UAVDesc, ID3D11UnorderedAccessView** ppD3D11UAV ) { CorrectBufferViewDesc( UAVDesc ); @@ -266,7 +266,7 @@ void BufferD3D11Impl::CreateUAV( BufferViewDesc &UAVDesc, ID3D11UnorderedAccessV "Failed to create D3D11 unordered access view" ); } -void BufferD3D11Impl::CreateSRV( struct BufferViewDesc &SRVDesc, ID3D11ShaderResourceView **ppD3D11SRV ) +void BufferD3D11Impl::CreateSRV( struct BufferViewDesc& SRVDesc, ID3D11ShaderResourceView** ppD3D11SRV ) { CorrectBufferViewDesc( SRVDesc ); diff --git a/Graphics/GraphicsEngineD3D11/src/BufferViewD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/BufferViewD3D11Impl.cpp index 13fddcfe..f500e9c1 100644 --- a/Graphics/GraphicsEngineD3D11/src/BufferViewD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/BufferViewD3D11Impl.cpp @@ -27,12 +27,12 @@ namespace Diligent { -BufferViewD3D11Impl::BufferViewD3D11Impl( IReferenceCounters *pRefCounters, - IRenderDevice *pDevice, +BufferViewD3D11Impl::BufferViewD3D11Impl( IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, const BufferViewDesc& ViewDesc, - IBuffer *pBuffer, - ID3D11View* pD3D11View, - bool bIsDefaultView ) : + IBuffer* pBuffer, + ID3D11View* pD3D11View, + bool bIsDefaultView ) : TBufferViewBase( pRefCounters, pDevice, ViewDesc, pBuffer, bIsDefaultView ), m_pD3D11View( pD3D11View ) { diff --git a/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp index d5161592..c415c998 100644 --- a/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp @@ -30,9 +30,9 @@ namespace Diligent { -CommandListD3D11Impl :: CommandListD3D11Impl(IReferenceCounters *pRefCounters, - IRenderDevice *pDevice, - ID3D11CommandList *pd3d11CommandList) : +CommandListD3D11Impl :: CommandListD3D11Impl(IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, + ID3D11CommandList* pd3d11CommandList) : TCommandListBase(pRefCounters, pDevice), m_pd3d11CommandList(pd3d11CommandList) { diff --git a/Graphics/GraphicsEngineD3D11/src/D3D11TypeConversions.cpp b/Graphics/GraphicsEngineD3D11/src/D3D11TypeConversions.cpp index 935ee14f..8ebe5aa9 100644 --- a/Graphics/GraphicsEngineD3D11/src/D3D11TypeConversions.cpp +++ b/Graphics/GraphicsEngineD3D11/src/D3D11TypeConversions.cpp @@ -46,19 +46,19 @@ D3D11_COMPARISON_FUNC ComparisonFuncToD3D11ComparisonFunc(COMPARISON_FUNCTION Fu return ComparisonFuncToD3DComparisonFunc<D3D11_COMPARISON_FUNC>(Func); } -void DepthStencilStateDesc_To_D3D11_DEPTH_STENCIL_DESC(const DepthStencilStateDesc &DepthStencilDesc, D3D11_DEPTH_STENCIL_DESC &d3d11DSSDesc) +void DepthStencilStateDesc_To_D3D11_DEPTH_STENCIL_DESC(const DepthStencilStateDesc& DepthStencilDesc, D3D11_DEPTH_STENCIL_DESC& d3d11DSSDesc) { DepthStencilStateDesc_To_D3D_DEPTH_STENCIL_DESC<D3D11_DEPTH_STENCIL_DESC, D3D11_DEPTH_STENCILOP_DESC, D3D11_STENCIL_OP, D3D11_COMPARISON_FUNC>(DepthStencilDesc, d3d11DSSDesc); } -void RasterizerStateDesc_To_D3D11_RASTERIZER_DESC(const RasterizerStateDesc &RasterizerDesc, D3D11_RASTERIZER_DESC &d3d11RSDesc) +void RasterizerStateDesc_To_D3D11_RASTERIZER_DESC(const RasterizerStateDesc& RasterizerDesc, D3D11_RASTERIZER_DESC& d3d11RSDesc) { RasterizerStateDesc_To_D3D_RASTERIZER_DESC<D3D11_RASTERIZER_DESC, D3D11_FILL_MODE, D3D11_CULL_MODE>(RasterizerDesc, d3d11RSDesc); d3d11RSDesc.ScissorEnable = RasterizerDesc.ScissorEnable ? TRUE : FALSE; } -void BlendStateDesc_To_D3D11_BLEND_DESC(const BlendStateDesc &BSDesc, D3D11_BLEND_DESC &d3d11BSDesc) +void BlendStateDesc_To_D3D11_BLEND_DESC(const BlendStateDesc& BSDesc, D3D11_BLEND_DESC& d3d11BSDesc) { BlendStateDescToD3DBlendDesc<D3D11_BLEND_DESC, D3D11_BLEND, D3D11_BLEND_OP>(BSDesc, d3d11BSDesc); @@ -72,8 +72,8 @@ void BlendStateDesc_To_D3D11_BLEND_DESC(const BlendStateDesc &BSDesc, D3D11_BLEN } } -void LayoutElements_To_D3D11_INPUT_ELEMENT_DESCs(const std::vector<LayoutElement, STDAllocatorRawMem<LayoutElement> > &LayoutElements, - std::vector<D3D11_INPUT_ELEMENT_DESC, STDAllocatorRawMem<D3D11_INPUT_ELEMENT_DESC> > &D3D11InputElements) +void LayoutElements_To_D3D11_INPUT_ELEMENT_DESCs(const std::vector<LayoutElement, STDAllocatorRawMem<LayoutElement> >& LayoutElements, + std::vector<D3D11_INPUT_ELEMENT_DESC, STDAllocatorRawMem<D3D11_INPUT_ELEMENT_DESC> >& D3D11InputElements) { LayoutElements_To_D3D_INPUT_ELEMENT_DESCs<D3D11_INPUT_ELEMENT_DESC>(LayoutElements, D3D11InputElements); } @@ -85,34 +85,34 @@ D3D11_PRIMITIVE_TOPOLOGY TopologyToD3D11Topology(PRIMITIVE_TOPOLOGY Topology) -void TextureViewDesc_to_D3D11_SRV_DESC(const TextureViewDesc& TexViewDesc, D3D11_SHADER_RESOURCE_VIEW_DESC &D3D11SRVDesc, Uint32 SampleCount) +void TextureViewDesc_to_D3D11_SRV_DESC(const TextureViewDesc& TexViewDesc, D3D11_SHADER_RESOURCE_VIEW_DESC& D3D11SRVDesc, Uint32 SampleCount) { TextureViewDesc_to_D3D_SRV_DESC(TexViewDesc, D3D11SRVDesc, SampleCount); } -void TextureViewDesc_to_D3D11_RTV_DESC(const TextureViewDesc& TexViewDesc, D3D11_RENDER_TARGET_VIEW_DESC &D3D11RTVDesc, Uint32 SampleCount) +void TextureViewDesc_to_D3D11_RTV_DESC(const TextureViewDesc& TexViewDesc, D3D11_RENDER_TARGET_VIEW_DESC& D3D11RTVDesc, Uint32 SampleCount) { TextureViewDesc_to_D3D_RTV_DESC(TexViewDesc, D3D11RTVDesc, SampleCount); } -void TextureViewDesc_to_D3D11_DSV_DESC(const TextureViewDesc& TexViewDesc, D3D11_DEPTH_STENCIL_VIEW_DESC &D3D11DSVDesc, Uint32 SampleCount) +void TextureViewDesc_to_D3D11_DSV_DESC(const TextureViewDesc& TexViewDesc, D3D11_DEPTH_STENCIL_VIEW_DESC& D3D11DSVDesc, Uint32 SampleCount) { TextureViewDesc_to_D3D_DSV_DESC(TexViewDesc, D3D11DSVDesc, SampleCount); } -void TextureViewDesc_to_D3D11_UAV_DESC(const TextureViewDesc& TexViewDesc, D3D11_UNORDERED_ACCESS_VIEW_DESC &D3D11UAVDesc) +void TextureViewDesc_to_D3D11_UAV_DESC(const TextureViewDesc& TexViewDesc, D3D11_UNORDERED_ACCESS_VIEW_DESC& D3D11UAVDesc) { TextureViewDesc_to_D3D_UAV_DESC(TexViewDesc, D3D11UAVDesc); } -void BufferViewDesc_to_D3D11_SRV_DESC(const BufferDesc &BuffDesc, const BufferViewDesc& SRVDesc, D3D11_SHADER_RESOURCE_VIEW_DESC &D3D11SRVDesc) +void BufferViewDesc_to_D3D11_SRV_DESC(const BufferDesc& BuffDesc, const BufferViewDesc& SRVDesc, D3D11_SHADER_RESOURCE_VIEW_DESC& D3D11SRVDesc) { BufferViewDesc_to_D3D_SRV_DESC(BuffDesc, SRVDesc, D3D11SRVDesc); } -void BufferViewDesc_to_D3D11_UAV_DESC(const BufferDesc &BuffDesc, const BufferViewDesc& UAVDesc, D3D11_UNORDERED_ACCESS_VIEW_DESC &D3D11UAVDesc) +void BufferViewDesc_to_D3D11_UAV_DESC(const BufferDesc& BuffDesc, const BufferViewDesc& UAVDesc, D3D11_UNORDERED_ACCESS_VIEW_DESC& D3D11UAVDesc) { BufferViewDesc_to_D3D_UAV_DESC(BuffDesc, UAVDesc, D3D11UAVDesc); D3D11UAVDesc.Buffer.Flags = 0; // D3D11_BUFFER_UAV_FLAG_RAW, D3D11_BUFFER_UAV_FLAG_APPEND, D3D11_BUFFER_UAV_FLAG_COUNTER diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index 77b70ea2..862474fc 100644 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -43,7 +43,12 @@ using namespace Diligent; namespace Diligent { - DeviceContextD3D11Impl::DeviceContextD3D11Impl( IReferenceCounters *pRefCounters, IMemoryAllocator &Allocator, IRenderDevice *pDevice, ID3D11DeviceContext *pd3d11DeviceContext, const struct EngineD3D11Attribs &EngineAttribs, bool bIsDeferred ) : + DeviceContextD3D11Impl::DeviceContextD3D11Impl( IReferenceCounters* pRefCounters, + IMemoryAllocator& Allocator, + IRenderDevice* pDevice, + ID3D11DeviceContext* pd3d11DeviceContext, + const struct EngineD3D11Attribs& EngineAttribs, + bool bIsDeferred ) : TDeviceContextBase(pRefCounters, pDevice, bIsDeferred), m_pd3d11DeviceContext( pd3d11DeviceContext ), m_CommittedIBFormat(VT_UNDEFINED), @@ -70,14 +75,14 @@ namespace Diligent IMPLEMENT_QUERY_INTERFACE( DeviceContextD3D11Impl, IID_DeviceContextD3D11, TDeviceContextBase ) - void DeviceContextD3D11Impl::SetPipelineState(IPipelineState *pPipelineState) + void DeviceContextD3D11Impl::SetPipelineState(IPipelineState* pPipelineState) { TDeviceContextBase::SetPipelineState( pPipelineState ); - auto *pPipelineStateD3D11 = ValidatedCast<PipelineStateD3D11Impl>(pPipelineState); + auto* pPipelineStateD3D11 = ValidatedCast<PipelineStateD3D11Impl>(pPipelineState); auto &Desc = pPipelineStateD3D11->GetDesc(); if (Desc.IsComputePipeline) { - auto *pd3d11CS = pPipelineStateD3D11->GetD3D11ComputeShader(); + auto* pd3d11CS = pPipelineStateD3D11->GetD3D11ComputeShader(); if (pd3d11CS == nullptr) { LOG_ERROR("Compute shader is not set in the pipeline"); @@ -86,7 +91,7 @@ namespace Diligent #define COMMIT_SHADER(SN, ShaderName)\ { \ - auto *pd3d11Shader = pPipelineStateD3D11->GetD3D11##ShaderName(); \ + auto* pd3d11Shader = pPipelineStateD3D11->GetD3D11##ShaderName(); \ if (m_CommittedD3DShaders[SN##Ind] != pd3d11Shader) \ { \ m_CommittedD3DShaders[SN##Ind] = pd3d11Shader; \ @@ -109,7 +114,7 @@ namespace Diligent m_pd3d11DeviceContext->RSSetState( pPipelineStateD3D11->GetD3D11RasterizerState() ); m_pd3d11DeviceContext->OMSetDepthStencilState( pPipelineStateD3D11->GetD3D11DepthStencilState(), m_StencilRef ); - auto *pd3d11InputLayout = pPipelineStateD3D11->GetD3D11InputLayout(); + auto* pd3d11InputLayout = pPipelineStateD3D11->GetD3D11InputLayout(); // It is safe to perform raw pointer comparison as the device context // keeps bound input layout alive if( m_CommittedD3D11InputLayout != pd3d11InputLayout ) @@ -160,7 +165,7 @@ namespace Diligent // http://diligentgraphics.com/diligent-engine/architecture/d3d11/committing-shader-resources-to-the-gpu-pipeline/ template<bool TransitionResources, bool CommitResources> - void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState *pPSO, IShaderResourceBinding *pShaderResourceBinding) + void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* pPSO, IShaderResourceBinding* pShaderResourceBinding) { static_assert(TransitionResources || CommitResources, "At least one of TransitionResources or CommitResources flags is expected to be true"); @@ -196,7 +201,7 @@ namespace Diligent { auto ShaderTypeInd = pShaderResBindingD3D11->GetActiveShaderTypeIndex(s); #ifdef _DEBUG - auto *pShaderD3D11 = ValidatedCast<ShaderD3D11Impl>(ppdbgShaders[s]); + auto* pShaderD3D11 = ValidatedCast<ShaderD3D11Impl>(ppdbgShaders[s]); VERIFY_EXPR( ShaderTypeInd == static_cast<Int32>(pShaderD3D11->GetShaderTypeIndex()) ); #endif @@ -234,7 +239,7 @@ namespace Diligent if(TransitionResources) { auto &CB = CachedCBs[cb]; - if( auto *pBuff = const_cast<BufferD3D11Impl*>(CB.pBuff.RawPtr()) ) + if( auto* pBuff = const_cast<BufferD3D11Impl*>(CB.pBuff.RawPtr()) ) { // WARNING! This code is not thread-safe. If several threads change // the buffer state, the results will be undefined. @@ -256,7 +261,7 @@ namespace Diligent { VERIFY_EXPR(CommitResources); auto &CB = CachedCBs[cb]; - if( auto *pBuff = const_cast<BufferD3D11Impl*>(CB.pBuff.RawPtr()) ) + if( auto* pBuff = const_cast<BufferD3D11Impl*>(CB.pBuff.RawPtr()) ) { if (!pBuff->CheckState(D3D11BufferState::ConstantBuffer)) { @@ -312,7 +317,7 @@ namespace Diligent // individually, or not rely on the state and check current context bindings if( TransitionResources ) { - if (auto *pTexture = const_cast<TextureBaseD3D11*>(SRVRes.pTexture)) + if (auto* pTexture = const_cast<TextureBaseD3D11*>(SRVRes.pTexture)) { if( !pTexture->CheckState(D3D11TextureState::ShaderResource) ) { @@ -328,7 +333,7 @@ namespace Diligent pTexture->ResetState(D3D11TextureState::ShaderResource); } } - else if(auto *pBuffer = const_cast<BufferD3D11Impl*>(SRVRes.pBuffer)) + else if(auto* pBuffer = const_cast<BufferD3D11Impl*>(SRVRes.pBuffer)) { if( !pBuffer->CheckState(D3D11BufferState::ShaderResource) ) { @@ -345,14 +350,14 @@ namespace Diligent else { VERIFY_EXPR(CommitResources); - if (auto *pTexture = const_cast<TextureBaseD3D11*>(SRVRes.pTexture)) + if (auto* pTexture = const_cast<TextureBaseD3D11*>(SRVRes.pTexture)) { if( !pTexture->CheckState(D3D11TextureState::ShaderResource) ) { LOG_ERROR_MESSAGE("Texture \"", pTexture->GetDesc().Name, "\" has not been transitioned to Shader Resource state. Did you forget to call TransitionResources()?"); } } - else if(auto *pBuffer = const_cast<BufferD3D11Impl*>(SRVRes.pBuffer)) + else if(auto* pBuffer = const_cast<BufferD3D11Impl*>(SRVRes.pBuffer)) { if( !pBuffer->CheckState(D3D11BufferState::ShaderResource) ) { @@ -454,7 +459,7 @@ namespace Diligent pTexture->ResetState(D3D11TextureState::UnorderedAccess); } } - else if( auto *pBuffer = const_cast<BufferD3D11Impl*>(UAVRes.pBuffer) ) + else if( auto* pBuffer = const_cast<BufferD3D11Impl*>(UAVRes.pBuffer) ) { if( !pBuffer->CheckState(D3D11BufferState::UnorderedAccess) ) { @@ -474,7 +479,7 @@ namespace Diligent LOG_ERROR_MESSAGE("Texture \"", pTexture->GetDesc().Name, "\" has not been transitioned to Unordered Access state. Did you forget to call TransitionResources()?"); } } - else if( auto *pBuffer = const_cast<BufferD3D11Impl*>(UAVRes.pBuffer) ) + else if( auto* pBuffer = const_cast<BufferD3D11Impl*>(UAVRes.pBuffer) ) { if( !pBuffer->CheckState(D3D11BufferState::UnorderedAccess) ) { @@ -527,12 +532,12 @@ namespace Diligent } } - void DeviceContextD3D11Impl::TransitionShaderResources(IPipelineState *pPipelineState, IShaderResourceBinding *pShaderResourceBinding) + void DeviceContextD3D11Impl::TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) { TransitionAndCommitShaderResources<true, false>(pPipelineState, pShaderResourceBinding); } - void DeviceContextD3D11Impl::CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, Uint32 Flags) + void DeviceContextD3D11Impl::CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, Uint32 Flags) { if( !DeviceContextBase::CommitShaderResources<PipelineStateD3D11Impl>(pShaderResourceBinding, Flags, 0 /*Dummy*/) ) return; @@ -547,7 +552,7 @@ namespace Diligent { if (TDeviceContextBase::SetStencilRef(StencilRef, 0)) { - ID3D11DepthStencilState *pd3d11DSS = + ID3D11DepthStencilState* pd3d11DSS = m_pPipelineState ? m_pPipelineState.RawPtr<PipelineStateD3D11Impl>()->GetD3D11DepthStencilState() : nullptr; m_pd3d11DeviceContext->OMSetDepthStencilState( pd3d11DSS, m_StencilRef ); } @@ -559,7 +564,7 @@ namespace Diligent if (TDeviceContextBase::SetBlendFactors(pBlendFactors, 0)) { Uint32 SampleMask = 0xFFFFFFFF; - ID3D11BlendState *pd3d11BS = nullptr; + ID3D11BlendState* pd3d11BS = nullptr; if(m_pPipelineState) { SampleMask = m_pPipelineState->GetDesc().GraphicsPipeline.SampleMask; @@ -577,7 +582,7 @@ namespace Diligent return; } - BufferD3D11Impl *pBuffD3D11 = m_pIndexBuffer.RawPtr<BufferD3D11Impl>(); + BufferD3D11Impl* pBuffD3D11 = m_pIndexBuffer.RawPtr<BufferD3D11Impl>(); if( pBuffD3D11->CheckState( D3D11BufferState::UnorderedAccess ) ) { UnbindResourceFromUAV(pBuffD3D11, pBuffD3D11->m_pd3d11Buffer); @@ -609,7 +614,7 @@ namespace Diligent m_bCommittedD3D11IBUpToDate = true; } - void DeviceContextD3D11Impl::CommitD3D11VertexBuffers(PipelineStateD3D11Impl *pPipelineStateD3D11) + void DeviceContextD3D11Impl::CommitD3D11VertexBuffers(PipelineStateD3D11Impl* pPipelineStateD3D11) { VERIFY( m_NumVertexStreams <= MaxBufferSlots, "Too many buffers are being set" ); UINT NumBuffersToSet = std::max(m_NumVertexStreams, m_NumCommittedD3D11VBs ); @@ -621,8 +626,8 @@ namespace Diligent { auto &CurrStream = m_VertexStreams[Slot]; VERIFY( CurrStream.pBuffer, "Attempting to bind a null buffer for rendering" ); - auto *pBuffD3D11Impl = CurrStream.pBuffer.RawPtr<BufferD3D11Impl>(); - ID3D11Buffer *pd3d11Buffer = pBuffD3D11Impl->m_pd3d11Buffer; + auto* pBuffD3D11Impl = CurrStream.pBuffer.RawPtr<BufferD3D11Impl>(); + ID3D11Buffer* pd3d11Buffer = pBuffD3D11Impl->m_pd3d11Buffer; auto Stride = Strides[Slot]; auto Offset = CurrStream.Offset; @@ -676,7 +681,7 @@ namespace Diligent } #endif - auto *pPipelineStateD3D11 = m_pPipelineState.RawPtr<PipelineStateD3D11Impl>(); + auto* pPipelineStateD3D11 = m_pPipelineState.RawPtr<PipelineStateD3D11Impl>(); #ifdef _DEBUG if (pPipelineStateD3D11->GetDesc().IsComputePipeline) { @@ -685,7 +690,7 @@ namespace Diligent } #endif - auto *pd3d11InputLayout = pPipelineStateD3D11->GetD3D11InputLayout(); + auto* pd3d11InputLayout = pPipelineStateD3D11->GetD3D11InputLayout(); if( pd3d11InputLayout != nullptr && !m_bCommittedD3D11VBsUpToDate ) { VERIFY( m_NumVertexStreams >= pPipelineStateD3D11->GetNumBufferSlotsUsed(), "Currently bound pipeline state \"", pPipelineStateD3D11->GetDesc().Name, "\" expects ", pPipelineStateD3D11->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound"); @@ -720,8 +725,8 @@ namespace Diligent if( DrawAttribs.IsIndirect ) { VERIFY( DrawAttribs.pIndirectDrawAttribs, "Indirect draw command attributes buffer is not set" ); - auto *pBufferD3D11 = static_cast<BufferD3D11Impl*>(DrawAttribs.pIndirectDrawAttribs); - ID3D11Buffer *pd3d11ArgsBuff = pBufferD3D11 ? pBufferD3D11->m_pd3d11Buffer : nullptr; + auto* pBufferD3D11 = static_cast<BufferD3D11Impl*>(DrawAttribs.pIndirectDrawAttribs); + ID3D11Buffer* pd3d11ArgsBuff = pBufferD3D11 ? pBufferD3D11->m_pd3d11Buffer : nullptr; if( DrawAttribs.IsIndexed ) m_pd3d11DeviceContext->DrawIndexedInstancedIndirect( pd3d11ArgsBuff, DrawAttribs.IndirectDrawArgsOffset ); else @@ -772,23 +777,23 @@ namespace Diligent if( DispatchAttrs.pIndirectDispatchAttribs ) { CHECK_DYNAMIC_TYPE( BufferD3D11Impl, DispatchAttrs.pIndirectDispatchAttribs ); - auto *pd3d11Buff = static_cast<BufferD3D11Impl*>(DispatchAttrs.pIndirectDispatchAttribs)->GetD3D11Buffer(); + auto* pd3d11Buff = static_cast<BufferD3D11Impl*>(DispatchAttrs.pIndirectDispatchAttribs)->GetD3D11Buffer(); m_pd3d11DeviceContext->DispatchIndirect( pd3d11Buff, DispatchAttrs.DispatchArgsByteOffset ); } else m_pd3d11DeviceContext->Dispatch( DispatchAttrs.ThreadGroupCountX, DispatchAttrs.ThreadGroupCountY, DispatchAttrs.ThreadGroupCountZ ); } - void DeviceContextD3D11Impl::ClearDepthStencil( ITextureView *pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil ) + void DeviceContextD3D11Impl::ClearDepthStencil( ITextureView* pView, Uint32 ClearFlags, float fDepth, Uint8 Stencil ) { - ID3D11DepthStencilView *pd3d11DSV = nullptr; + ID3D11DepthStencilView* pd3d11DSV = nullptr; if( pView != nullptr ) { #ifdef _DEBUG const auto& ViewDesc = pView->GetDesc(); VERIFY( ViewDesc.ViewType == TEXTURE_VIEW_DEPTH_STENCIL, "Incorrect view type: depth stencil is expected" ); #endif - auto *pViewD3D11 = ValidatedCast<TextureViewD3D11Impl>(pView); + auto* pViewD3D11 = ValidatedCast<TextureViewD3D11Impl>(pView); pd3d11DSV = static_cast<ID3D11DepthStencilView *>(pViewD3D11->GetD3D11View()); } else @@ -812,16 +817,16 @@ namespace Diligent m_pd3d11DeviceContext->ClearDepthStencilView( pd3d11DSV, d3d11ClearFlags, fDepth, Stencil ); } - void DeviceContextD3D11Impl::ClearRenderTarget( ITextureView *pView, const float *RGBA ) + void DeviceContextD3D11Impl::ClearRenderTarget( ITextureView* pView, const float *RGBA ) { - ID3D11RenderTargetView *pd3d11RTV = nullptr; + ID3D11RenderTargetView* pd3d11RTV = nullptr; if( pView != nullptr ) { #ifdef _DEBUG const auto& ViewDesc = pView->GetDesc(); VERIFY( ViewDesc.ViewType == TEXTURE_VIEW_RENDER_TARGET, "Incorrect view type: render target is expected" ); #endif - auto *pViewD3D11 = ValidatedCast<TextureViewD3D11Impl>(pView); + auto* pViewD3D11 = ValidatedCast<TextureViewD3D11Impl>(pView); pd3d11RTV = static_cast<ID3D11RenderTargetView*>(pViewD3D11->GetD3D11View()); } else @@ -852,19 +857,19 @@ namespace Diligent m_pd3d11DeviceContext->Flush(); } - void DeviceContextD3D11Impl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, Uint32 Flags ) + void DeviceContextD3D11Impl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32* pOffsets, Uint32 Flags ) { TDeviceContextBase::SetVertexBuffers( StartSlot, NumBuffersSet, ppBuffers, pOffsets, Flags ); m_bCommittedD3D11VBsUpToDate = false; } - void DeviceContextD3D11Impl::SetIndexBuffer( IBuffer *pIndexBuffer, Uint32 ByteOffset ) + void DeviceContextD3D11Impl::SetIndexBuffer( IBuffer* pIndexBuffer, Uint32 ByteOffset ) { TDeviceContextBase::SetIndexBuffer( pIndexBuffer, ByteOffset ); m_bCommittedD3D11IBUpToDate = false; } - void DeviceContextD3D11Impl::SetViewports( Uint32 NumViewports, const Viewport *pViewports, Uint32 RTWidth, Uint32 RTHeight ) + void DeviceContextD3D11Impl::SetViewports( Uint32 NumViewports, const Viewport* pViewports, Uint32 RTWidth, Uint32 RTHeight ) { static_assert(MaxViewports >= D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE, "MaxViewports constant must be greater than D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE"); TDeviceContextBase::SetViewports( NumViewports, pViewports, RTWidth, RTHeight ); @@ -885,7 +890,7 @@ namespace Diligent m_pd3d11DeviceContext->RSSetViewports( NumViewports, d3d11Viewports ); } - void DeviceContextD3D11Impl::SetScissorRects( Uint32 NumRects, const Rect *pRects, Uint32 RTWidth, Uint32 RTHeight ) + void DeviceContextD3D11Impl::SetScissorRects( Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight ) { static_assert(MaxViewports >= D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE, "MaxViewports constant must be greater than D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE"); TDeviceContextBase::SetScissorRects(NumRects, pRects, RTWidth, RTHeight); @@ -913,15 +918,15 @@ namespace Diligent NumRenderTargets = std::min( MaxD3D11RTs, NumRenderTargets ); // Do not waste time setting RTVs to null - ID3D11RenderTargetView *pd3d11RTs[MaxD3D11RTs]; - ID3D11DepthStencilView *pd3d11DSV = nullptr; + ID3D11RenderTargetView* pd3d11RTs[MaxD3D11RTs]; + ID3D11DepthStencilView* pd3d11DSV = nullptr; if( m_IsDefaultFramebufferBound ) { if (m_pSwapChain) { NumRenderTargets = 1; - auto *pSwapChainD3D11 = m_pSwapChain.RawPtr<ISwapChainD3D11>(); + auto* pSwapChainD3D11 = m_pSwapChain.RawPtr<ISwapChainD3D11>(); pd3d11RTs[0] = pSwapChainD3D11->GetRTV(); pd3d11DSV = pSwapChainD3D11->GetDSV(); VERIFY_EXPR(pd3d11RTs[0] != nullptr && pd3d11DSV != nullptr); @@ -936,20 +941,20 @@ namespace Diligent { for( Uint32 rt = 0; rt < NumRenderTargets; ++rt ) { - auto *pView = m_pBoundRenderTargets[rt].RawPtr(); + auto* pView = m_pBoundRenderTargets[rt].RawPtr(); if( pView ) { - auto *pViewD3D11 = static_cast<TextureViewD3D11Impl*>(pView); + auto* pViewD3D11 = static_cast<TextureViewD3D11Impl*>(pView); pd3d11RTs[rt] = static_cast<ID3D11RenderTargetView*>(pViewD3D11->GetD3D11View()); } else pd3d11RTs[rt] = nullptr; } - auto *pDepthStencil = m_pBoundDepthStencil.RawPtr(); + auto* pDepthStencil = m_pBoundDepthStencil.RawPtr(); if( pDepthStencil != nullptr ) { - auto *pViewD3D11 = static_cast<TextureViewD3D11Impl*>(pDepthStencil); + auto* pViewD3D11 = static_cast<TextureViewD3D11Impl*>(pDepthStencil); pd3d11DSV = static_cast<ID3D11DepthStencilView*>(pViewD3D11->GetD3D11View()); } } @@ -958,15 +963,15 @@ namespace Diligent } - void UnbindView( ID3D11DeviceContext *pContext, TSetShaderResourcesType SetSRVMethod, UINT Slot ) + void UnbindView( ID3D11DeviceContext* pContext, TSetShaderResourcesType SetSRVMethod, UINT Slot ) { - ID3D11ShaderResourceView *ppNullView[] = { nullptr }; + ID3D11ShaderResourceView* ppNullView[] = { nullptr }; (pContext->*SetSRVMethod)(Slot, 1, ppNullView); } - void UnbindView( ID3D11DeviceContext *pContext, TSetUnorderedAccessViewsType SetUAVMethod, UINT Slot ) + void UnbindView( ID3D11DeviceContext* pContext, TSetUnorderedAccessViewsType SetUAVMethod, UINT Slot ) { - ID3D11UnorderedAccessView *ppNullView[] = { nullptr }; + ID3D11UnorderedAccessView* ppNullView[] = { nullptr }; (pContext->*SetUAVMethod)(Slot, 1, ppNullView, nullptr); } @@ -985,8 +990,8 @@ namespace Diligent void DeviceContextD3D11Impl::UnbindResourceView( TD3D11ResourceViewType CommittedD3D11ViewsArr[][NumSlots], ID3D11Resource* CommittedD3D11ResourcesArr[][NumSlots], Uint8 NumCommittedResourcesArr[], - IDeviceObject *pResToUnbind, - ID3D11Resource *pd3d11ResToUndind, + IDeviceObject* pResToUnbind, + ID3D11Resource* pd3d11ResToUndind, TSetD3D11View SetD3D11ViewMethods[]) { for( Int32 ShaderTypeInd = 0; ShaderTypeInd < NumShaderTypes; ++ShaderTypeInd ) @@ -1016,7 +1021,7 @@ namespace Diligent } } - void DeviceContextD3D11Impl::UnbindTextureFromInput( TextureBaseD3D11 *pTexture, ID3D11Resource *pd3d11Resource ) + void DeviceContextD3D11Impl::UnbindTextureFromInput( TextureBaseD3D11* pTexture, ID3D11Resource* pd3d11Resource ) { VERIFY( pTexture, "Null texture provided" ); if( !pTexture )return; @@ -1025,7 +1030,7 @@ namespace Diligent pTexture->ClearState(D3D11TextureState::ShaderResource); } - void DeviceContextD3D11Impl::UnbindBufferFromInput( BufferD3D11Impl *pBuffer, ID3D11Resource *pd3d11Buffer ) + void DeviceContextD3D11Impl::UnbindBufferFromInput( BufferD3D11Impl* pBuffer, ID3D11Resource* pd3d11Buffer ) { VERIFY( pBuffer, "Null buffer provided" ); if( !pBuffer )return; @@ -1066,7 +1071,7 @@ namespace Diligent { // Unbind only D3D11 buffer //*VertStream = VertexStreamInfo(); - ID3D11Buffer *ppNullBuffer[] = { nullptr }; + ID3D11Buffer* ppNullBuffer[] = { nullptr }; const UINT Zero[] = { 0 }; m_CommittedD3D11VertexBuffers[Slot] = nullptr; m_CommittedD3D11VBStrides[Slot] = 0; @@ -1094,7 +1099,7 @@ namespace Diligent { CommittedD3D11CBs[Slot] = nullptr; auto SetCBMethod = SetCBMethods[ShaderTypeInd]; - ID3D11Buffer *ppNullBuffer[] = { nullptr }; + ID3D11Buffer* ppNullBuffer[] = { nullptr }; (m_pd3d11DeviceContext->*SetCBMethod)(Slot, 1, ppNullBuffer); } } @@ -1107,7 +1112,7 @@ namespace Diligent } } - void DeviceContextD3D11Impl::UnbindResourceFromUAV( IDeviceObject *pResource, ID3D11Resource *pd3d11Resource ) + void DeviceContextD3D11Impl::UnbindResourceFromUAV( IDeviceObject* pResource, ID3D11Resource* pd3d11Resource ) { VERIFY( pResource, "Null resource provided" ); if( !pResource )return; @@ -1115,7 +1120,7 @@ namespace Diligent UnbindResourceView( m_CommittedD3D11UAVs, m_CommittedD3D11UAVResources, m_NumCommittedUAVs, pResource, pd3d11Resource, SetUAVMethods ); } - void DeviceContextD3D11Impl::UnbindTextureFromRenderTarget( TextureBaseD3D11 *pTexture ) + void DeviceContextD3D11Impl::UnbindTextureFromRenderTarget( TextureBaseD3D11* pTexture ) { VERIFY( pTexture, "Null resource provided" ); if( !pTexture )return; @@ -1139,7 +1144,7 @@ namespace Diligent pTexture->ClearState(D3D11TextureState::RenderTarget); } - void DeviceContextD3D11Impl::UnbindTextureFromDepthStencil(TextureBaseD3D11 *pTexD3D11) + void DeviceContextD3D11Impl::UnbindTextureFromDepthStencil(TextureBaseD3D11* pTexD3D11) { VERIFY( pTexD3D11, "Null resource provided" ); if( !pTexD3D11 )return; @@ -1152,20 +1157,20 @@ namespace Diligent pTexD3D11->ClearState(D3D11TextureState::DepthStencil); } - void DeviceContextD3D11Impl::SetRenderTargets( Uint32 NumRenderTargets, ITextureView *ppRenderTargets[], ITextureView *pDepthStencil ) + void DeviceContextD3D11Impl::SetRenderTargets( Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil ) { if( TDeviceContextBase::SetRenderTargets( NumRenderTargets, ppRenderTargets, pDepthStencil ) ) { for( Uint32 RT = 0; RT < NumRenderTargets; ++RT ) if( ppRenderTargets[RT] ) { - auto *pTex = ValidatedCast<TextureBaseD3D11>(ppRenderTargets[RT]->GetTexture()); + auto* pTex = ValidatedCast<TextureBaseD3D11>(ppRenderTargets[RT]->GetTexture()); UnbindTextureFromInput( pTex, pTex->GetD3D11Texture() ); pTex->ResetState(D3D11TextureState::RenderTarget); } if( pDepthStencil ) { - auto *pTex = ValidatedCast<TextureBaseD3D11>(pDepthStencil->GetTexture()); + auto* pTex = ValidatedCast<TextureBaseD3D11>(pDepthStencil->GetTexture()); UnbindTextureFromInput( pTex, pTex->GetD3D11Texture() ); pTex->ResetState(D3D11TextureState::DepthStencil); } @@ -1178,7 +1183,7 @@ namespace Diligent } template<typename TD3D11ResourceType, typename TSetD3D11ResMethodType> - void SetD3D11ResourcesHelper(ID3D11DeviceContext *pDeviceCtx, + void SetD3D11ResourcesHelper(ID3D11DeviceContext* pDeviceCtx, TSetD3D11ResMethodType SetD3D11ResMethod, UINT StartSlot, UINT NumSlots, TD3D11ResourceType **ppResources) @@ -1187,7 +1192,7 @@ namespace Diligent } template<> - void SetD3D11ResourcesHelper(ID3D11DeviceContext *pDeviceCtx, + void SetD3D11ResourcesHelper(ID3D11DeviceContext* pDeviceCtx, TSetUnorderedAccessViewsType SetD3D11UAVMethod, UINT StartSlot, UINT NumSlots, ID3D11UnorderedAccessView **ppUAVs) @@ -1199,7 +1204,7 @@ namespace Diligent void ReleaseCommittedShaderResourcesHelper(TD3D11ResourceType CommittedD3D11Res[], Uint8 NumCommittedResources, TSetD3D11ResMethodType SetD3D11ResMethod, - ID3D11DeviceContext *pDeviceCtx) + ID3D11DeviceContext* pDeviceCtx) { if( NumCommittedResources > 0) { @@ -1250,7 +1255,7 @@ namespace Diligent // ID3D11DeviceContext::ClearState() was called. &pd3d11CmdList); - CommandListD3D11Impl *pCmdListD3D11( NEW_RC_OBJ(m_CmdListAllocator, "CommandListD3D11Impl instance", CommandListD3D11Impl)(m_pDevice, pd3d11CmdList) ); + CommandListD3D11Impl* pCmdListD3D11( NEW_RC_OBJ(m_CmdListAllocator, "CommandListD3D11Impl instance", CommandListD3D11Impl)(m_pDevice, pd3d11CmdList) ); pCmdListD3D11->QueryInterface( IID_CommandList, reinterpret_cast<IObject**>(ppCommandList) ); // Device context is now in default state @@ -1269,7 +1274,7 @@ namespace Diligent } } - void DeviceContextD3D11Impl::ExecuteCommandList(ICommandList *pCommandList) + void DeviceContextD3D11Impl::ExecuteCommandList(ICommandList* pCommandList) { if (m_bIsDeferred) { @@ -1278,7 +1283,7 @@ namespace Diligent } CommandListD3D11Impl* pCmdListD3D11 = ValidatedCast<CommandListD3D11Impl>(pCommandList); - auto *pd3d11CmdList = pCmdListD3D11->GetD3D11CommandList(); + auto* pd3d11CmdList = pCmdListD3D11->GetD3D11CommandList(); m_pd3d11DeviceContext->ExecuteCommandList(pd3d11CmdList, FALSE // A Boolean flag that determines whether the target context state is // saved prior to and restored after the execution of a command list. @@ -1615,7 +1620,7 @@ namespace Diligent VERIFY( pInputLayout == m_CommittedD3D11InputLayout, "Inconsistent input layout" ); const Uint32 MaxVBs = D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; - ID3D11Buffer *pVBs[MaxVBs]; + ID3D11Buffer* pVBs[MaxVBs]; UINT Strides[MaxVBs]; UINT Offsets[MaxVBs]; m_pd3d11DeviceContext->IAGetVertexBuffers( 0, MaxVBs, pVBs, Strides, Offsets ); @@ -1651,7 +1656,7 @@ namespace Diligent template<typename TD3D11ShaderType, typename TGetShaderMethodType> void dbgVerifyCommittedShadersHelper(SHADER_TYPE ShaderType, const CComPtr<ID3D11DeviceChild> BoundD3DShaders[], - ID3D11DeviceContext *pCtx, + ID3D11DeviceContext* pCtx, TGetShaderMethodType GetShaderMethod) { RefCntAutoPtr<TD3D11ShaderType> pctxShader; diff --git a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp index be3f72d5..e96270b8 100644 --- a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp @@ -30,14 +30,16 @@ namespace Diligent { -PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters *pRefCounters, RenderDeviceD3D11Impl *pRenderDeviceD3D11, const PipelineStateDesc& PipelineDesc) : +PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D11Impl* pRenderDeviceD3D11, + const PipelineStateDesc& PipelineDesc) : TPipelineStateBase(pRefCounters, pRenderDeviceD3D11, PipelineDesc), m_pDefaultShaderResBinding( nullptr, STDDeleter<ShaderResourceBindingD3D11Impl, FixedBlockMemoryAllocator>(pRenderDeviceD3D11->GetSRBAllocator()) ), m_DummyShaderVar(*this) { if (PipelineDesc.IsComputePipeline) { - auto *pCS = ValidatedCast<ShaderD3D11Impl>(PipelineDesc.ComputePipeline.pCS); + auto* pCS = ValidatedCast<ShaderD3D11Impl>(PipelineDesc.ComputePipeline.pCS); m_pCS = pCS; if (m_pCS == nullptr) { @@ -55,7 +57,7 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters *pRefCounters, #define INIT_SHADER(ShortName, ExpectedType)\ { \ - auto *pShader = ValidatedCast<ShaderD3D11Impl>(PipelineDesc.GraphicsPipeline.p##ShortName); \ + auto* pShader = ValidatedCast<ShaderD3D11Impl>(PipelineDesc.GraphicsPipeline.p##ShortName); \ m_p##ShortName = pShader; \ if (m_p##ShortName && m_p##ShortName->GetDesc().ShaderType != ExpectedType) \ { \ @@ -77,7 +79,7 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters *pRefCounters, LOG_ERROR_AND_THROW("Vertex shader is null"); } - auto *pDeviceD3D11 = pRenderDeviceD3D11->GetD3D11Device(); + auto* pDeviceD3D11 = pRenderDeviceD3D11->GetD3D11Device(); D3D11_BLEND_DESC D3D11BSDesc = {}; BlendStateDesc_To_D3D11_BLEND_DESC(PipelineDesc.GraphicsPipeline.BlendDesc, D3D11BSDesc); CHECK_D3D_RESULT_THROW( pDeviceD3D11->CreateBlendState( &D3D11BSDesc, &m_pd3d11BlendState ), @@ -100,7 +102,7 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters *pRefCounters, std::vector<D3D11_INPUT_ELEMENT_DESC, STDAllocatorRawMem<D3D11_INPUT_ELEMENT_DESC> > d311InputElements(STD_ALLOCATOR_RAW_MEM(D3D11_INPUT_ELEMENT_DESC, GetRawAllocator(), "Allocator for vector<D3D11_INPUT_ELEMENT_DESC>") ); LayoutElements_To_D3D11_INPUT_ELEMENT_DESCs(m_LayoutElements, d311InputElements); - ID3DBlob *pVSByteCode = m_pVS.RawPtr<ShaderD3D11Impl>()->GetBytecode(); + ID3DBlob* pVSByteCode = m_pVS.RawPtr<ShaderD3D11Impl>()->GetBytecode(); if( !pVSByteCode ) LOG_ERROR_AND_THROW( "Vertex Shader byte code does not exist" ); @@ -167,7 +169,7 @@ ID3D11InputLayout* PipelineStateD3D11Impl::GetD3D11InputLayout() return m_pd3d11InputLayout; } -void PipelineStateD3D11Impl::BindShaderResources(IResourceMapping *pResourceMapping, Uint32 Flags) +void PipelineStateD3D11Impl::BindShaderResources(IResourceMapping* pResourceMapping, Uint32 Flags) { if( m_Desc.IsComputePipeline ) { @@ -183,22 +185,22 @@ void PipelineStateD3D11Impl::BindShaderResources(IResourceMapping *pResourceMapp } } -void PipelineStateD3D11Impl::CreateShaderResourceBinding(IShaderResourceBinding **ppShaderResourceBinding) +void PipelineStateD3D11Impl::CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding) { - auto *pRenderDeviceD3D11 = ValidatedCast<RenderDeviceD3D11Impl>( GetDevice() ); + auto* pRenderDeviceD3D11 = ValidatedCast<RenderDeviceD3D11Impl>( GetDevice() ); auto &SRBAllocator = pRenderDeviceD3D11->GetSRBAllocator(); auto pShaderResBinding = NEW_RC_OBJ(SRBAllocator, "ShaderResourceBindingD3D11Impl instance", ShaderResourceBindingD3D11Impl)(this, false); pShaderResBinding->QueryInterface(IID_ShaderResourceBinding, reinterpret_cast<IObject**>(static_cast<IShaderResourceBinding**>(ppShaderResourceBinding))); } -bool PipelineStateD3D11Impl::IsCompatibleWith(const IPipelineState *pPSO)const +bool PipelineStateD3D11Impl::IsCompatibleWith(const IPipelineState* pPSO)const { VERIFY_EXPR(pPSO != nullptr); if (pPSO == this) return true; - const PipelineStateD3D11Impl *pPSOD3D11 = ValidatedCast<const PipelineStateD3D11Impl>(pPSO); + const PipelineStateD3D11Impl* pPSOD3D11 = ValidatedCast<const PipelineStateD3D11Impl>(pPSO); if (m_ShaderResourceLayoutHash != pPSOD3D11->m_ShaderResourceLayoutHash) return false; @@ -207,12 +209,12 @@ bool PipelineStateD3D11Impl::IsCompatibleWith(const IPipelineState *pPSO)const for (Uint32 s = 0; s < m_NumShaders; ++s) { - auto *pShader0 = ValidatedCast<ShaderD3D11Impl>(m_ppShaders[s]); - auto *pShader1 = ValidatedCast<ShaderD3D11Impl>(pPSOD3D11->m_ppShaders[s]); + auto* pShader0 = ValidatedCast<ShaderD3D11Impl>(m_ppShaders[s]); + auto* pShader1 = ValidatedCast<ShaderD3D11Impl>(pPSOD3D11->m_ppShaders[s]); if (pShader0->GetShaderTypeIndex() != pShader1->GetShaderTypeIndex()) return false; - const ShaderResourcesD3D11 *pRes0 = pShader0->GetResources().get(); - const ShaderResourcesD3D11 *pRes1 = pShader1->GetResources().get(); + const ShaderResourcesD3D11* pRes0 = pShader0->GetResources().get(); + const ShaderResourcesD3D11* pRes1 = pShader1->GetResources().get(); if (!pRes0->IsCompatibleWith(*pRes1)) return false; } @@ -223,42 +225,42 @@ bool PipelineStateD3D11Impl::IsCompatibleWith(const IPipelineState *pPSO)const ID3D11VertexShader* PipelineStateD3D11Impl::GetD3D11VertexShader() { if(!m_pVS)return nullptr; - auto *pVSD3D11 = m_pVS.RawPtr<ShaderD3D11Impl>(); + auto* pVSD3D11 = m_pVS.RawPtr<ShaderD3D11Impl>(); return static_cast<ID3D11VertexShader*>(pVSD3D11->GetD3D11Shader()); } ID3D11PixelShader* PipelineStateD3D11Impl::GetD3D11PixelShader() { if(!m_pPS)return nullptr; - auto *pPSD3D11 = m_pPS.RawPtr<ShaderD3D11Impl>(); + auto* pPSD3D11 = m_pPS.RawPtr<ShaderD3D11Impl>(); return static_cast<ID3D11PixelShader*>(pPSD3D11->GetD3D11Shader()); } ID3D11GeometryShader* PipelineStateD3D11Impl::GetD3D11GeometryShader() { if(!m_pGS)return nullptr; - auto *pGSD3D11 = m_pGS.RawPtr<ShaderD3D11Impl>(); + auto* pGSD3D11 = m_pGS.RawPtr<ShaderD3D11Impl>(); return static_cast<ID3D11GeometryShader*>(pGSD3D11->GetD3D11Shader()); } ID3D11DomainShader* PipelineStateD3D11Impl::GetD3D11DomainShader() { if(!m_pDS)return nullptr; - auto *pDSD3D11 = m_pDS.RawPtr<ShaderD3D11Impl>(); + auto* pDSD3D11 = m_pDS.RawPtr<ShaderD3D11Impl>(); return static_cast<ID3D11DomainShader*>(pDSD3D11->GetD3D11Shader()); } ID3D11HullShader* PipelineStateD3D11Impl::GetD3D11HullShader() { if(!m_pHS)return nullptr; - auto *pHSD3D11 = m_pHS.RawPtr<ShaderD3D11Impl>(); + auto* pHSD3D11 = m_pHS.RawPtr<ShaderD3D11Impl>(); return static_cast<ID3D11HullShader*>(pHSD3D11->GetD3D11Shader()); } ID3D11ComputeShader* PipelineStateD3D11Impl::GetD3D11ComputeShader() { if(!m_pCS)return nullptr; - auto *pCSD3D11 = m_pCS.RawPtr<ShaderD3D11Impl>(); + auto* pCSD3D11 = m_pCS.RawPtr<ShaderD3D11Impl>(); return static_cast<ID3D11ComputeShader*>(pCSD3D11->GetD3D11Shader()); } diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp index 4614298d..222be0c5 100644 --- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp @@ -39,8 +39,25 @@ namespace Diligent { -RenderDeviceD3D11Impl :: RenderDeviceD3D11Impl(IReferenceCounters *pRefCounters, IMemoryAllocator &RawMemAllocator, const EngineD3D11Attribs& EngineAttribs, ID3D11Device *pd3d11Device, Uint32 NumDeferredContexts) : - TRenderDeviceBase(pRefCounters, RawMemAllocator, NumDeferredContexts, sizeof(TextureBaseD3D11), sizeof(TextureViewD3D11Impl), sizeof(BufferD3D11Impl), sizeof(BufferViewD3D11Impl), sizeof(ShaderD3D11Impl), sizeof(SamplerD3D11Impl), sizeof(PipelineStateD3D11Impl), sizeof(ShaderResourceBindingD3D11Impl)), +RenderDeviceD3D11Impl :: RenderDeviceD3D11Impl(IReferenceCounters* pRefCounters, + IMemoryAllocator& RawMemAllocator, + const EngineD3D11Attribs& EngineAttribs, + ID3D11Device* pd3d11Device, + Uint32 NumDeferredContexts) : + TRenderDeviceBase + { + pRefCounters, + RawMemAllocator, + NumDeferredContexts, + sizeof(TextureBaseD3D11), + sizeof(TextureViewD3D11Impl), + sizeof(BufferD3D11Impl), + sizeof(BufferViewD3D11Impl), + sizeof(ShaderD3D11Impl), + sizeof(SamplerD3D11Impl), + sizeof(PipelineStateD3D11Impl), + sizeof(ShaderResourceBindingD3D11Impl) + }, m_EngineAttribs(EngineAttribs), m_pd3d11Device(pd3d11Device) { @@ -52,7 +69,7 @@ RenderDeviceD3D11Impl :: RenderDeviceD3D11Impl(IReferenceCounters *pRefCounters, } -bool CreateTestTexture1D(ID3D11Device *pDevice, const D3D11_TEXTURE1D_DESC &TexDesc) +bool CreateTestTexture1D(ID3D11Device* pDevice, const D3D11_TEXTURE1D_DESC& TexDesc) { // Set the texture pointer address to nullptr to validate input parameters // without creating the texture @@ -61,7 +78,7 @@ bool CreateTestTexture1D(ID3D11Device *pDevice, const D3D11_TEXTURE1D_DESC &TexD return hr == S_FALSE; // S_FALSE means that input parameters passed validation } -bool CreateTestTexture2D(ID3D11Device *pDevice, const D3D11_TEXTURE2D_DESC &TexDesc) +bool CreateTestTexture2D(ID3D11Device* pDevice, const D3D11_TEXTURE2D_DESC &TexDesc) { // Set the texture pointer address to nullptr to validate input parameters // without creating the texture @@ -70,7 +87,7 @@ bool CreateTestTexture2D(ID3D11Device *pDevice, const D3D11_TEXTURE2D_DESC &TexD return hr == S_FALSE; // S_FALSE means that input parameters passed validation } -bool CreateTestTexture3D(ID3D11Device *pDevice, const D3D11_TEXTURE3D_DESC &TexDesc) +bool CreateTestTexture3D(ID3D11Device* pDevice, const D3D11_TEXTURE3D_DESC& TexDesc) { // Set the texture pointer address to nullptr to validate input parameters // without creating the texture @@ -194,12 +211,12 @@ void RenderDeviceD3D11Impl::TestTextureFormat( TEXTURE_FORMAT TexFormat ) IMPLEMENT_QUERY_INTERFACE( RenderDeviceD3D11Impl, IID_RenderDeviceD3D11, TRenderDeviceBase ) -void RenderDeviceD3D11Impl :: CreateBufferFromD3DResource(ID3D11Buffer *pd3d11Buffer, const BufferDesc& BuffDesc, IBuffer **ppBuffer) +void RenderDeviceD3D11Impl :: CreateBufferFromD3DResource(ID3D11Buffer* pd3d11Buffer, const BufferDesc& BuffDesc, IBuffer** ppBuffer) { CreateDeviceObject("buffer", BuffDesc, ppBuffer, [&]() { - BufferD3D11Impl *pBufferD3D11( NEW_RC_OBJ(m_BufObjAllocator, "BufferD3D11Impl instance", BufferD3D11Impl) + BufferD3D11Impl* pBufferD3D11( NEW_RC_OBJ(m_BufObjAllocator, "BufferD3D11Impl instance", BufferD3D11Impl) (m_BuffViewObjAllocator, this, BuffDesc, pd3d11Buffer ) ); pBufferD3D11->QueryInterface( IID_Buffer, reinterpret_cast<IObject**>(ppBuffer) ); pBufferD3D11->CreateDefaultViews(); @@ -208,12 +225,12 @@ void RenderDeviceD3D11Impl :: CreateBufferFromD3DResource(ID3D11Buffer *pd3d11Bu ); } -void RenderDeviceD3D11Impl :: CreateBuffer(const BufferDesc& BuffDesc, const BufferData &BuffData, IBuffer **ppBuffer) +void RenderDeviceD3D11Impl :: CreateBuffer(const BufferDesc& BuffDesc, const BufferData& BuffData, IBuffer** ppBuffer) { CreateDeviceObject("buffer", BuffDesc, ppBuffer, [&]() { - BufferD3D11Impl *pBufferD3D11( NEW_RC_OBJ(m_BufObjAllocator, "BufferD3D11Impl instance", BufferD3D11Impl) + BufferD3D11Impl* pBufferD3D11( NEW_RC_OBJ(m_BufObjAllocator, "BufferD3D11Impl instance", BufferD3D11Impl) (m_BuffViewObjAllocator, this, BuffDesc, BuffData ) ); pBufferD3D11->QueryInterface( IID_Buffer, reinterpret_cast<IObject**>(ppBuffer) ); pBufferD3D11->CreateDefaultViews(); @@ -222,12 +239,12 @@ void RenderDeviceD3D11Impl :: CreateBuffer(const BufferDesc& BuffDesc, const Buf ); } -void RenderDeviceD3D11Impl :: CreateShader(const ShaderCreationAttribs &ShaderCreationAttribs, IShader **ppShader) +void RenderDeviceD3D11Impl :: CreateShader(const ShaderCreationAttribs& ShaderCreationAttribs, IShader** ppShader) { CreateDeviceObject( "shader", ShaderCreationAttribs.Desc, ppShader, [&]() { - ShaderD3D11Impl *pShaderD3D11( NEW_RC_OBJ(m_ShaderObjAllocator, "ShaderD3D11Impl instance", ShaderD3D11Impl) + ShaderD3D11Impl* pShaderD3D11( NEW_RC_OBJ(m_ShaderObjAllocator, "ShaderD3D11Impl instance", ShaderD3D11Impl) (this, ShaderCreationAttribs ) ); pShaderD3D11->QueryInterface( IID_Shader, reinterpret_cast<IObject**>(ppShader) ); @@ -236,7 +253,7 @@ void RenderDeviceD3D11Impl :: CreateShader(const ShaderCreationAttribs &ShaderCr ); } -void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture1D *pd3d11Texture, ITexture **ppTexture) +void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture1D* pd3d11Texture, ITexture** ppTexture) { if (pd3d11Texture == nullptr) return; @@ -246,7 +263,7 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture1D *pd3d11 CreateDeviceObject( "texture", TexDesc, ppTexture, [&]() { - TextureBaseD3D11 *pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture1D_D3D11 instance", Texture1D_D3D11) + TextureBaseD3D11* pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture1D_D3D11 instance", Texture1D_D3D11) (m_TexViewObjAllocator, this, pd3d11Texture); pTextureD3D11->QueryInterface( IID_Texture, reinterpret_cast<IObject**>(ppTexture) ); pTextureD3D11->CreateDefaultViews(); @@ -255,7 +272,7 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture1D *pd3d11 ); } -void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture2D *pd3d11Texture, ITexture **ppTexture) +void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture2D* pd3d11Texture, ITexture** ppTexture) { if (pd3d11Texture == nullptr) return; @@ -265,7 +282,7 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture2D *pd3d11 CreateDeviceObject( "texture", TexDesc, ppTexture, [&]() { - TextureBaseD3D11 *pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture2D_D3D11 instance", Texture2D_D3D11) + TextureBaseD3D11* pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture2D_D3D11 instance", Texture2D_D3D11) (m_TexViewObjAllocator, this, pd3d11Texture); pTextureD3D11->QueryInterface( IID_Texture, reinterpret_cast<IObject**>(ppTexture) ); pTextureD3D11->CreateDefaultViews(); @@ -274,7 +291,7 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture2D *pd3d11 ); } -void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture3D *pd3d11Texture, ITexture **ppTexture) +void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture3D* pd3d11Texture, ITexture** ppTexture) { if (pd3d11Texture == nullptr) return; @@ -284,7 +301,7 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture3D *pd3d11 CreateDeviceObject( "texture", TexDesc, ppTexture, [&]() { - TextureBaseD3D11 *pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture3D_D3D11 instance", Texture3D_D3D11) + TextureBaseD3D11* pTextureD3D11 = NEW_RC_OBJ(m_TexObjAllocator, "Texture3D_D3D11 instance", Texture3D_D3D11) (m_TexViewObjAllocator, this, pd3d11Texture); pTextureD3D11->QueryInterface( IID_Texture, reinterpret_cast<IObject**>(ppTexture) ); pTextureD3D11->CreateDefaultViews(); @@ -294,12 +311,12 @@ void RenderDeviceD3D11Impl::CreateTextureFromD3DResource(ID3D11Texture3D *pd3d11 } -void RenderDeviceD3D11Impl :: CreateTexture(const TextureDesc& TexDesc, const TextureData &Data, ITexture **ppTexture) +void RenderDeviceD3D11Impl :: CreateTexture(const TextureDesc& TexDesc, const TextureData& Data, ITexture** ppTexture) { CreateDeviceObject( "texture", TexDesc, ppTexture, [&]() { - TextureBaseD3D11 *pTextureD3D11 = nullptr; + TextureBaseD3D11* pTextureD3D11 = nullptr; switch( TexDesc.Type ) { case RESOURCE_DIM_TEX_1D: @@ -330,30 +347,30 @@ void RenderDeviceD3D11Impl :: CreateTexture(const TextureDesc& TexDesc, const Te ); } -void RenderDeviceD3D11Impl :: CreateSampler(const SamplerDesc& SamplerDesc, ISampler **ppSampler) +void RenderDeviceD3D11Impl :: CreateSampler(const SamplerDesc& SamplerDesc, ISampler** ppSampler) { CreateDeviceObject( "sampler", SamplerDesc, ppSampler, [&]() { m_SamplersRegistry.Find( SamplerDesc, reinterpret_cast<IDeviceObject**>(ppSampler) ); - if( *ppSampler == nullptr ) + if(* ppSampler == nullptr ) { - SamplerD3D11Impl *pSamplerD3D11( NEW_RC_OBJ(m_SamplerObjAllocator, "SamplerD3D11Impl instance", SamplerD3D11Impl) + SamplerD3D11Impl* pSamplerD3D11( NEW_RC_OBJ(m_SamplerObjAllocator, "SamplerD3D11Impl instance", SamplerD3D11Impl) (this, SamplerDesc ) ); pSamplerD3D11->QueryInterface( IID_Sampler, reinterpret_cast<IObject**>(ppSampler) ); OnCreateDeviceObject( pSamplerD3D11 ); - m_SamplersRegistry.Add( SamplerDesc, *ppSampler ); + m_SamplersRegistry.Add( SamplerDesc,* ppSampler ); } } ); } -void RenderDeviceD3D11Impl::CreatePipelineState(const PipelineStateDesc &PipelineDesc, IPipelineState **ppPipelineState) +void RenderDeviceD3D11Impl::CreatePipelineState(const PipelineStateDesc& PipelineDesc, IPipelineState** ppPipelineState) { CreateDeviceObject( "Pipeline state", PipelineDesc, ppPipelineState, [&]() { - PipelineStateD3D11Impl *pPipelineStateD3D11( NEW_RC_OBJ(m_PSOAllocator, "PipelineStateD3D11Impl instance", PipelineStateD3D11Impl) + PipelineStateD3D11Impl* pPipelineStateD3D11( NEW_RC_OBJ(m_PSOAllocator, "PipelineStateD3D11Impl instance", PipelineStateD3D11Impl) (this, PipelineDesc ) ); pPipelineStateD3D11->QueryInterface( IID_PipelineState, reinterpret_cast<IObject**>(ppPipelineState) ); OnCreateDeviceObject( pPipelineStateD3D11 ); diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceFactoryD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceFactoryD3D11.cpp index 90f4c6c0..eb8558c2 100644 --- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceFactoryD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceFactoryD3D11.cpp @@ -49,23 +49,23 @@ public: } void CreateDeviceAndContextsD3D11( const EngineD3D11Attribs& EngineAttribs, - IRenderDevice **ppDevice, - IDeviceContext **ppContexts, - Uint32 NumDeferredContexts )override final; + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts )override final; - void CreateSwapChainD3D11( IRenderDevice *pDevice, - IDeviceContext *pImmediateContext, - const SwapChainDesc& SCDesc, + void CreateSwapChainD3D11( IRenderDevice* pDevice, + IDeviceContext* pImmediateContext, + const SwapChainDesc& SCDesc, const FullScreenModeDesc& FSDesc, - void* pNativeWndHandle, - ISwapChain **ppSwapChain )override final; + void* pNativeWndHandle, + ISwapChain** ppSwapChain )override final; - void AttachToD3D11Device(void *pd3d11NativeDevice, - void *pd3d11ImmediateContext, + void AttachToD3D11Device(void* pd3d11NativeDevice, + void* pd3d11ImmediateContext, const EngineD3D11Attribs& EngineAttribs, - IRenderDevice **ppDevice, - IDeviceContext **ppContexts, - Uint32 NumDeferredContexts)override final; + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts)override final; }; @@ -104,9 +104,9 @@ inline bool SdkLayersAvailable() /// contexts are written to ppContexts array starting /// at position 1 void EngineFactoryD3D11Impl::CreateDeviceAndContextsD3D11( const EngineD3D11Attribs& EngineAttribs, - IRenderDevice **ppDevice, - IDeviceContext **ppContexts, - Uint32 NumDeferredContexts ) + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts ) { if (EngineAttribs.DebugMessageCallback != nullptr) SetDebugMessageCallback(EngineAttribs.DebugMessageCallback); @@ -218,12 +218,12 @@ void EngineFactoryD3D11Impl::CreateDeviceAndContextsD3D11( const EngineD3D11Attr /// of deferred contexts is requested, pointers to the /// contexts are written to ppContexts array starting /// at position 1 -void EngineFactoryD3D11Impl::AttachToD3D11Device(void *pd3d11NativeDevice, - void *pd3d11ImmediateContext, +void EngineFactoryD3D11Impl::AttachToD3D11Device(void* pd3d11NativeDevice, + void* pd3d11ImmediateContext, const EngineD3D11Attribs& EngineAttribs, - IRenderDevice **ppDevice, - IDeviceContext **ppContexts, - Uint32 NumDeferredContexts) + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts) { if (EngineAttribs.DebugMessageCallback != nullptr) SetDebugMessageCallback(EngineAttribs.DebugMessageCallback); @@ -299,12 +299,12 @@ void EngineFactoryD3D11Impl::AttachToD3D11Device(void *pd3d11NativeDevice, /// /// \param [out] ppSwapChain - Address of the memory location where pointer to the new /// swap chain will be written -void EngineFactoryD3D11Impl::CreateSwapChainD3D11( IRenderDevice *pDevice, - IDeviceContext *pImmediateContext, - const SwapChainDesc& SCDesc, +void EngineFactoryD3D11Impl::CreateSwapChainD3D11( IRenderDevice* pDevice, + IDeviceContext* pImmediateContext, + const SwapChainDesc& SCDesc, const FullScreenModeDesc& FSDesc, - void* pNativeWndHandle, - ISwapChain **ppSwapChain ) + void* pNativeWndHandle, + ISwapChain** ppSwapChain ) { VERIFY( ppSwapChain, "Null pointer provided" ); if( !ppSwapChain ) diff --git a/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp index 0bd53bc5..a2777163 100644 --- a/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp @@ -29,7 +29,9 @@ namespace Diligent { -SamplerD3D11Impl::SamplerD3D11Impl(IReferenceCounters *pRefCounters, class RenderDeviceD3D11Impl *pRenderDeviceD3D11, const SamplerDesc& SamplerDesc) : +SamplerD3D11Impl::SamplerD3D11Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D11Impl* pRenderDeviceD3D11, + const SamplerDesc& SamplerDesc) : TSamplerBase(pRefCounters, pRenderDeviceD3D11, SamplerDesc) { auto *pd3d11Device = pRenderDeviceD3D11->GetD3D11Device(); diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp index f747bae2..6ef63462 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp @@ -30,7 +30,9 @@ namespace Diligent { -ShaderD3D11Impl::ShaderD3D11Impl(IReferenceCounters *pRefCounters, RenderDeviceD3D11Impl *pRenderDeviceD3D11, const ShaderCreationAttribs &CreationAttribs) : +ShaderD3D11Impl::ShaderD3D11Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D11Impl* pRenderDeviceD3D11, + const ShaderCreationAttribs& CreationAttribs) : TShaderBase(pRefCounters, pRenderDeviceD3D11, CreationAttribs.Desc), ShaderD3DBase(CreationAttribs), m_StaticResLayout(*this, GetRawAllocator()), diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp index 6effe2d0..9259c563 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp @@ -31,7 +31,9 @@ namespace Diligent { -ShaderResourceBindingD3D11Impl::ShaderResourceBindingD3D11Impl( IReferenceCounters *pRefCounters, PipelineStateD3D11Impl *pPSO, bool IsInternal) : +ShaderResourceBindingD3D11Impl::ShaderResourceBindingD3D11Impl( IReferenceCounters* pRefCounters, + PipelineStateD3D11Impl* pPSO, + bool IsInternal) : TBase( pRefCounters, pPSO, IsInternal ), m_bIsStaticResourcesBound(false) { @@ -143,7 +145,7 @@ void ShaderResourceBindingD3D11Impl::BindStaticShaderResources() m_bIsStaticResourcesBound = true; } -IShaderVariable *ShaderResourceBindingD3D11Impl::GetVariable(SHADER_TYPE ShaderType, const char *Name) +IShaderVariable *ShaderResourceBindingD3D11Impl::GetVariable(SHADER_TYPE ShaderType, const char* Name) { auto Ind = GetShaderTypeIndex(ShaderType); VERIFY_EXPR(Ind >= 0 && Ind < _countof(m_ResourceLayoutIndex)); diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp index 9e6e719d..36f6645e 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp @@ -32,7 +32,7 @@ namespace Diligent { - void ShaderResourceCacheD3D11::Initialize(Int32 CBCount, Int32 SRVCount, Int32 SamplerCount, Int32 UAVCount, IMemoryAllocator &MemAllocator) + void ShaderResourceCacheD3D11::Initialize(Int32 CBCount, Int32 SRVCount, Int32 SamplerCount, Int32 UAVCount, IMemoryAllocator& MemAllocator) { // http://diligentgraphics.com/diligent-engine/architecture/d3d11/shader-resource-cache/ if (IsInitialized()) @@ -125,7 +125,7 @@ namespace Diligent new(UAVResources+uav)CachedResource; } - void ShaderResourceCacheD3D11::Destroy(IMemoryAllocator &MemAllocator) + void ShaderResourceCacheD3D11::Destroy(IMemoryAllocator& MemAllocator) { VERIFY( IsInitialized(), "Resource cache is not initialized"); VERIFY( m_pdbgMemoryAllocator == &MemAllocator, "The allocator does not match the one used to create resources"); @@ -167,7 +167,7 @@ namespace Diligent VERIFY( !IsInitialized(), "Shader resource cache memory must be released with ShaderResourceCacheD3D11::Destroy()" ); } - void dbgVerifyResource(ShaderResourceCacheD3D11::CachedResource &Res, ID3D11View *pd3d11View, const char *ViewType) + void dbgVerifyResource(ShaderResourceCacheD3D11::CachedResource& Res, ID3D11View* pd3d11View, const char* ViewType) { if (pd3d11View != nullptr) { diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index 14ef0e84..e1502f8b 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -38,7 +38,7 @@ namespace Diligent { -ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject &Owner, IMemoryAllocator& ResLayoutDataAllocator) : +ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& Owner, IMemoryAllocator& ResLayoutDataAllocator) : m_Owner(Owner), #if USE_VARIABLE_HASH_MAP m_VariableHash(STD_ALLOCATOR_RAW_MEM(VariableHashData, GetRawAllocator(), "Allocator for vector<BuffSRVBindInfo>")), @@ -80,11 +80,11 @@ ShaderResourceLayoutD3D11::~ShaderResourceLayoutD3D11() const D3DShaderResourceAttribs ShaderResourceLayoutD3D11::TexAndSamplerBindInfo::InvalidSamplerAttribs("Invalid sampler", D3DShaderResourceAttribs::InvalidBindPoint, 0, D3D_SIT_SAMPLER, SHADER_VARIABLE_TYPE_NUM_TYPES, D3D_SRV_DIMENSION_UNKNOWN, D3DShaderResourceAttribs::InvalidSamplerId, false); void ShaderResourceLayoutD3D11::Initialize(const std::shared_ptr<const ShaderResourcesD3D11>& pSrcResources, - const SHADER_VARIABLE_TYPE *VarTypes, - Uint32 NumVarTypes, - ShaderResourceCacheD3D11& ResourceCache, - IMemoryAllocator& ResCacheDataAllocator, - IMemoryAllocator& ResLayoutDataAllocator) + const SHADER_VARIABLE_TYPE* VarTypes, + Uint32 NumVarTypes, + ShaderResourceCacheD3D11& ResourceCache, + IMemoryAllocator& ResCacheDataAllocator, + IMemoryAllocator& ResLayoutDataAllocator) { // http://diligentgraphics.com/diligent-engine/architecture/d3d11/shader-resource-layout#Shader-Resource-Layout-Initialization @@ -212,7 +212,7 @@ void ShaderResourceLayoutD3D11::Initialize(const std::shared_ptr<const ShaderRes InitVariablesHashMap(); } -void ShaderResourceLayoutD3D11::CopyResources(ShaderResourceCacheD3D11 &DstCache) +void ShaderResourceLayoutD3D11::CopyResources(ShaderResourceCacheD3D11& DstCache) { VERIFY(m_pResourceCache, "Resource cache must not be null"); @@ -355,7 +355,9 @@ do{ "\" in shader \"", ShaderName, "\". ", __VA_ARGS__ ); \ }while(false) -void ShaderResourceLayoutD3D11::ConstBuffBindInfo::BindResource(IDeviceObject *pBuffer, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout) +void ShaderResourceLayoutD3D11::ConstBuffBindInfo::BindResource(IDeviceObject* pBuffer, + Uint32 ArrayIndex, + const ShaderResourceLayoutD3D11* dbgResLayout) { auto &pResourceCache = m_ParentResLayout.m_pResourceCache; VERIFY(pResourceCache, "Resource cache is null"); @@ -438,7 +440,9 @@ bool dbgVerifyViewType( const char *ViewTypeName, } #endif -void ShaderResourceLayoutD3D11::TexAndSamplerBindInfo::BindResource( IDeviceObject *pView, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout ) +void ShaderResourceLayoutD3D11::TexAndSamplerBindInfo::BindResource( IDeviceObject* pView, + Uint32 ArrayIndex, + const ShaderResourceLayoutD3D11* dbgResLayout ) { auto &pResourceCache = m_ParentResLayout.m_pResourceCache; VERIFY(pResourceCache, "Resource cache is null"); @@ -499,7 +503,9 @@ void ShaderResourceLayoutD3D11::TexAndSamplerBindInfo::BindResource( IDeviceObje } -void ShaderResourceLayoutD3D11::BuffSRVBindInfo::BindResource( IDeviceObject *pView, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout ) +void ShaderResourceLayoutD3D11::BuffSRVBindInfo::BindResource( IDeviceObject* pView, + Uint32 ArrayIndex, + const ShaderResourceLayoutD3D11* dbgResLayout ) { auto &pResourceCache = m_ParentResLayout.m_pResourceCache; VERIFY(pResourceCache, "Resource cache is null"); @@ -530,7 +536,9 @@ void ShaderResourceLayoutD3D11::BuffSRVBindInfo::BindResource( IDeviceObject *pV } -void ShaderResourceLayoutD3D11::TexUAVBindInfo::BindResource( IDeviceObject *pView, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout ) +void ShaderResourceLayoutD3D11::TexUAVBindInfo::BindResource( IDeviceObject* pView, + Uint32 ArrayIndex, + const ShaderResourceLayoutD3D11* dbgResLayout ) { auto &pResourceCache = m_ParentResLayout.m_pResourceCache; VERIFY(pResourceCache, "Resource cache is null"); @@ -561,7 +569,9 @@ void ShaderResourceLayoutD3D11::TexUAVBindInfo::BindResource( IDeviceObject *pVi } -void ShaderResourceLayoutD3D11::BuffUAVBindInfo::BindResource( IDeviceObject *pView, Uint32 ArrayIndex, const ShaderResourceLayoutD3D11 *dbgResLayout ) +void ShaderResourceLayoutD3D11::BuffUAVBindInfo::BindResource( IDeviceObject* pView, + Uint32 ArrayIndex, + const ShaderResourceLayoutD3D11* dbgResLayout ) { auto &pResourceCache = m_ParentResLayout.m_pResourceCache; VERIFY(pResourceCache, "Resource cache is null"); @@ -635,7 +645,7 @@ bool ShaderResourceLayoutD3D11::BuffUAVBindInfo::IsBound(Uint32 ArrayIndex) class BindResourceHelper { public: - BindResourceHelper(IResourceMapping *pRM, Uint32 Fl, const ShaderResourceLayoutD3D11 *pSRL) : + BindResourceHelper(IResourceMapping* pRM, Uint32 Fl, const ShaderResourceLayoutD3D11* pSRL) : pResourceMapping(pRM), Flags(Fl), pShaderResLayout(pSRL) @@ -678,7 +688,7 @@ private: const ShaderResourceLayoutD3D11 *pShaderResLayout; }; -void ShaderResourceLayoutD3D11::BindResources( IResourceMapping* pResourceMapping, Uint32 Flags, const ShaderResourceCacheD3D11 &dbgResourceCache ) +void ShaderResourceLayoutD3D11::BindResources( IResourceMapping* pResourceMapping, Uint32 Flags, const ShaderResourceCacheD3D11& dbgResourceCache ) { VERIFY(&dbgResourceCache == m_pResourceCache, "Resource cache does not match the cache provided at initialization"); diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp index d8532762..23b7c71d 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp @@ -34,7 +34,7 @@ namespace Diligent { -ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl *pDeviceD3D11Impl, ID3DBlob *pShaderBytecode, const ShaderDesc &ShdrDesc) : +ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl* pDeviceD3D11Impl, ID3DBlob* pShaderBytecode, const ShaderDesc& ShdrDesc) : ShaderResources(GetRawAllocator(), ShdrDesc.ShaderType), m_ShaderName(ShdrDesc.Name), m_StaticSamplers(nullptr, STDDeleterRawMem< void >(GetRawAllocator())) diff --git a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp index ad619ef7..cdc8e744 100644 --- a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp @@ -32,12 +32,12 @@ using namespace Diligent; namespace Diligent { -SwapChainD3D11Impl::SwapChainD3D11Impl(IReferenceCounters *pRefCounters, - const SwapChainDesc& SCDesc, +SwapChainD3D11Impl::SwapChainD3D11Impl(IReferenceCounters* pRefCounters, + const SwapChainDesc& SCDesc, const FullScreenModeDesc& FSDesc, - RenderDeviceD3D11Impl* pRenderDeviceD3D11, - DeviceContextD3D11Impl* pDeviceContextD3D11, - void* pNativeWndHandle) : + RenderDeviceD3D11Impl* pRenderDeviceD3D11, + DeviceContextD3D11Impl* pDeviceContextD3D11, + void* pNativeWndHandle) : TSwapChainBase(pRefCounters, pRenderDeviceD3D11, pDeviceContextD3D11, SCDesc, FSDesc, pNativeWndHandle) { auto *pd3d11Device = pRenderDeviceD3D11->GetD3D11Device(); diff --git a/Graphics/GraphicsEngineD3D11/src/Texture1D_D3D11.cpp b/Graphics/GraphicsEngineD3D11/src/Texture1D_D3D11.cpp index f762a721..d3801fe3 100644 --- a/Graphics/GraphicsEngineD3D11/src/Texture1D_D3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/Texture1D_D3D11.cpp @@ -29,11 +29,11 @@ namespace Diligent { -Texture1D_D3D11 :: Texture1D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - RenderDeviceD3D11Impl *pRenderDeviceD3D11, - const TextureDesc& TexDesc, - const TextureData &InitData /*= TextureData()*/) : +Texture1D_D3D11 :: Texture1D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceD3D11Impl* pRenderDeviceD3D11, + const TextureDesc& TexDesc, + const TextureData& InitData /*= TextureData()*/) : TextureBaseD3D11(pRefCounters, TexViewObjAllocator, pRenderDeviceD3D11, TexDesc, InitData) { auto D3D11TexFormat = TexFormatToDXGI_Format(m_Desc.Format, m_Desc.BindFlags); @@ -86,10 +86,10 @@ static TextureDesc TexDescFromD3D11Texture1D(ID3D11Texture1D *pd3d11Texture) return TexDesc; } -Texture1D_D3D11 :: Texture1D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - RenderDeviceD3D11Impl *pDeviceD3D11, - ID3D11Texture1D *pd3d11Texture) : +Texture1D_D3D11 :: Texture1D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceD3D11Impl* pDeviceD3D11, + ID3D11Texture1D* pd3d11Texture) : TextureBaseD3D11(pRefCounters, TexViewObjAllocator, pDeviceD3D11, TexDescFromD3D11Texture1D(pd3d11Texture), TextureData()) { m_pd3d11Texture = pd3d11Texture; @@ -120,7 +120,7 @@ void Texture1D_D3D11::CreateSRV( TextureViewDesc &SRVDesc, ID3D11ShaderResourceV "Failed to create D3D11 shader resource view"); } -void Texture1D_D3D11::CreateRTV( TextureViewDesc &RTVDesc, ID3D11RenderTargetView **ppD3D11RTV ) +void Texture1D_D3D11::CreateRTV( TextureViewDesc& RTVDesc, ID3D11RenderTargetView** ppD3D11RTV ) { VERIFY( ppD3D11RTV && *ppD3D11RTV == nullptr, "RTV pointer address is null or contains non-null pointer to an existing object" ); @@ -141,7 +141,7 @@ void Texture1D_D3D11::CreateRTV( TextureViewDesc &RTVDesc, ID3D11RenderTargetVie "Failed to create D3D11 render target view"); } -void Texture1D_D3D11::CreateDSV( TextureViewDesc &DSVDesc, ID3D11DepthStencilView **ppD3D11DSV ) +void Texture1D_D3D11::CreateDSV( TextureViewDesc& DSVDesc, ID3D11DepthStencilView** ppD3D11DSV ) { VERIFY( ppD3D11DSV && *ppD3D11DSV == nullptr, "DSV pointer address is null or contains non-null pointer to an existing object" ); @@ -162,7 +162,7 @@ void Texture1D_D3D11::CreateDSV( TextureViewDesc &DSVDesc, ID3D11DepthStencilVie "Failed to create D3D11 depth stencil view"); } -void Texture1D_D3D11::CreateUAV( TextureViewDesc &UAVDesc, ID3D11UnorderedAccessView **ppD3D11UAV ) +void Texture1D_D3D11::CreateUAV( TextureViewDesc& UAVDesc, ID3D11UnorderedAccessView** ppD3D11UAV ) { VERIFY( ppD3D11UAV && *ppD3D11UAV == nullptr, "UAV pointer address is null or contains non-null pointer to an existing object" ); diff --git a/Graphics/GraphicsEngineD3D11/src/Texture2D_D3D11.cpp b/Graphics/GraphicsEngineD3D11/src/Texture2D_D3D11.cpp index 22631c03..99c40da2 100644 --- a/Graphics/GraphicsEngineD3D11/src/Texture2D_D3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/Texture2D_D3D11.cpp @@ -29,11 +29,11 @@ namespace Diligent { -Texture2D_D3D11 :: Texture2D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - RenderDeviceD3D11Impl *pRenderDeviceD3D11, - const TextureDesc& TexDesc, - const TextureData &InitData /*= TextureData()*/) : +Texture2D_D3D11 :: Texture2D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceD3D11Impl* pRenderDeviceD3D11, + const TextureDesc& TexDesc, + const TextureData& InitData /*= TextureData()*/) : TextureBaseD3D11(pRefCounters, TexViewObjAllocator, pRenderDeviceD3D11, TexDesc, InitData) { auto D3D11TexFormat = TexFormatToDXGI_Format(m_Desc.Format, m_Desc.BindFlags); @@ -91,10 +91,10 @@ static TextureDesc TexDescFromD3D11Texture2D(ID3D11Texture2D *pd3d11Texture) return TexDesc; } -Texture2D_D3D11 :: Texture2D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - RenderDeviceD3D11Impl *pDeviceD3D11, - ID3D11Texture2D *pd3d11Texture) : +Texture2D_D3D11 :: Texture2D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceD3D11Impl* pDeviceD3D11, + ID3D11Texture2D* pd3d11Texture) : TextureBaseD3D11(pRefCounters, TexViewObjAllocator, pDeviceD3D11, TexDescFromD3D11Texture2D(pd3d11Texture), TextureData()) { m_pd3d11Texture = pd3d11Texture; @@ -104,7 +104,7 @@ Texture2D_D3D11 :: ~Texture2D_D3D11() { } -void Texture2D_D3D11::CreateSRV( TextureViewDesc &SRVDesc, ID3D11ShaderResourceView **ppD3D11SRV ) +void Texture2D_D3D11::CreateSRV( TextureViewDesc& SRVDesc, ID3D11ShaderResourceView** ppD3D11SRV ) { VERIFY( ppD3D11SRV && *ppD3D11SRV == nullptr, "SRV pointer address is null or contains non-null pointer to an existing object" ); @@ -126,7 +126,7 @@ void Texture2D_D3D11::CreateSRV( TextureViewDesc &SRVDesc, ID3D11ShaderResourceV "Failed to create D3D11 shader resource view"); } -void Texture2D_D3D11::CreateRTV( TextureViewDesc &RTVDesc, ID3D11RenderTargetView **ppD3D11RTV ) +void Texture2D_D3D11::CreateRTV( TextureViewDesc& RTVDesc, ID3D11RenderTargetView** ppD3D11RTV ) { VERIFY( ppD3D11RTV && *ppD3D11RTV == nullptr, "RTV pointer address is null or contains non-null pointer to an existing object" ); @@ -147,7 +147,7 @@ void Texture2D_D3D11::CreateRTV( TextureViewDesc &RTVDesc, ID3D11RenderTargetVie "Failed to create D3D11 render target view"); } -void Texture2D_D3D11::CreateDSV( TextureViewDesc &DSVDesc, ID3D11DepthStencilView **ppD3D11DSV ) +void Texture2D_D3D11::CreateDSV( TextureViewDesc& DSVDesc, ID3D11DepthStencilView** ppD3D11DSV ) { VERIFY( ppD3D11DSV && *ppD3D11DSV == nullptr, "DSV pointer address is null or contains non-null pointer to an existing object" ); @@ -168,7 +168,7 @@ void Texture2D_D3D11::CreateDSV( TextureViewDesc &DSVDesc, ID3D11DepthStencilVie "Failed to create D3D11 depth stencil view"); } -void Texture2D_D3D11::CreateUAV( TextureViewDesc &UAVDesc, ID3D11UnorderedAccessView **ppD3D11UAV ) +void Texture2D_D3D11::CreateUAV( TextureViewDesc& UAVDesc, ID3D11UnorderedAccessView** ppD3D11UAV ) { VERIFY( ppD3D11UAV && *ppD3D11UAV == nullptr, "UAV pointer address is null or contains non-null pointer to an existing object" ); diff --git a/Graphics/GraphicsEngineD3D11/src/Texture3D_D3D11.cpp b/Graphics/GraphicsEngineD3D11/src/Texture3D_D3D11.cpp index 5bbb6ad3..3fefb804 100644 --- a/Graphics/GraphicsEngineD3D11/src/Texture3D_D3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/Texture3D_D3D11.cpp @@ -29,11 +29,11 @@ namespace Diligent { -Texture3D_D3D11 :: Texture3D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - RenderDeviceD3D11Impl *pRenderDeviceD3D11, - const TextureDesc& TexDesc, - const TextureData &InitData /*= TextureData()*/) : +Texture3D_D3D11 :: Texture3D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceD3D11Impl* pRenderDeviceD3D11, + const TextureDesc& TexDesc, + const TextureData& InitData /*= TextureData()*/) : TextureBaseD3D11(pRefCounters, TexViewObjAllocator, pRenderDeviceD3D11, TexDesc, InitData) { auto D3D11TexFormat = TexFormatToDXGI_Format(m_Desc.Format, m_Desc.BindFlags); @@ -65,7 +65,7 @@ Texture3D_D3D11 :: Texture3D_D3D11(IReferenceCounters *pRefCounters, CHECK_D3D_RESULT_THROW( hr, "Failed to create the Direct3D11 Texture3D" ); } -static TextureDesc TexDescFromD3D11Texture3D(ID3D11Texture3D *pd3d11Texture) +static TextureDesc TexDescFromD3D11Texture3D(ID3D11Texture3D* pd3d11Texture) { D3D11_TEXTURE3D_DESC D3D11TexDesc; pd3d11Texture->GetDesc(&D3D11TexDesc); @@ -87,16 +87,16 @@ static TextureDesc TexDescFromD3D11Texture3D(ID3D11Texture3D *pd3d11Texture) return TexDesc; } -Texture3D_D3D11 :: Texture3D_D3D11(IReferenceCounters *pRefCounters, - FixedBlockMemoryAllocator &TexViewObjAllocator, - RenderDeviceD3D11Impl *pDeviceD3D11, - ID3D11Texture3D *pd3d11Texture) : +Texture3D_D3D11 :: Texture3D_D3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceD3D11Impl* pDeviceD3D11, + ID3D11Texture3D* pd3d11Texture) : TextureBaseD3D11(pRefCounters, TexViewObjAllocator, pDeviceD3D11, TexDescFromD3D11Texture3D(pd3d11Texture), TextureData()) { m_pd3d11Texture = pd3d11Texture; } -void Texture3D_D3D11::CreateSRV( TextureViewDesc &SRVDesc, ID3D11ShaderResourceView **ppD3D11SRV ) +void Texture3D_D3D11::CreateSRV( TextureViewDesc& SRVDesc, ID3D11ShaderResourceView** ppD3D11SRV ) { VERIFY( ppD3D11SRV && *ppD3D11SRV == nullptr, "SRV pointer address is null or contains non-null pointer to an existing object" ); @@ -117,7 +117,7 @@ void Texture3D_D3D11::CreateSRV( TextureViewDesc &SRVDesc, ID3D11ShaderResourceV "Failed to create D3D11 shader resource view"); } -void Texture3D_D3D11::CreateRTV( TextureViewDesc &RTVDesc, ID3D11RenderTargetView **ppD3D11RTV ) +void Texture3D_D3D11::CreateRTV( TextureViewDesc& RTVDesc, ID3D11RenderTargetView** ppD3D11RTV ) { VERIFY( ppD3D11RTV && *ppD3D11RTV == nullptr, "RTV pointer address is null or contains non-null pointer to an existing object" ); @@ -138,12 +138,12 @@ void Texture3D_D3D11::CreateRTV( TextureViewDesc &RTVDesc, ID3D11RenderTargetVie "Failed to create D3D11 render target view"); } -void Texture3D_D3D11::CreateDSV( TextureViewDesc &pDSVDesc, ID3D11DepthStencilView **ppD3D11DSV ) +void Texture3D_D3D11::CreateDSV( TextureViewDesc& DSVDesc, ID3D11DepthStencilView** ppD3D11DSV ) { LOG_ERROR_AND_THROW("Depth stencil views are not supported for 3D textures"); } -void Texture3D_D3D11::CreateUAV( TextureViewDesc &UAVDesc, ID3D11UnorderedAccessView **ppD3D11UAV ) +void Texture3D_D3D11::CreateUAV( TextureViewDesc& UAVDesc, ID3D11UnorderedAccessView** ppD3D11UAV ) { VERIFY( ppD3D11UAV && *ppD3D11UAV == nullptr, "UAV pointer address is null or contains non-null pointer to an existing object" ); diff --git a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp index c758aa2c..0fe0ace0 100644 --- a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp @@ -32,7 +32,11 @@ namespace Diligent { -TextureBaseD3D11 :: TextureBaseD3D11(IReferenceCounters *pRefCounters, FixedBlockMemoryAllocator &TexViewObjAllocator, RenderDeviceD3D11Impl *pRenderDeviceD3D11, const TextureDesc& TexDesc, const TextureData &InitData /*= TextureData()*/) : +TextureBaseD3D11 :: TextureBaseD3D11(IReferenceCounters* pRefCounters, + FixedBlockMemoryAllocator& TexViewObjAllocator, + RenderDeviceD3D11Impl* pRenderDeviceD3D11, + const TextureDesc& TexDesc, + const TextureData& InitData /*= TextureData()*/) : TTextureBase(pRefCounters, TexViewObjAllocator, pRenderDeviceD3D11, TexDesc) { if( TexDesc.Usage == USAGE_STATIC && InitData.pSubResources == nullptr ) @@ -45,9 +49,9 @@ void TextureBaseD3D11::CreateViewInternal( const struct TextureViewDesc &ViewDes { VERIFY( ppView != nullptr, "View pointer address is null" ); if( !ppView )return; - VERIFY( *ppView == nullptr, "Overwriting reference to existing object may cause memory leaks" ); + VERIFY(* ppView == nullptr, "Overwriting reference to existing object may cause memory leaks" ); - *ppView = nullptr; + * ppView = nullptr; try { @@ -60,7 +64,7 @@ void TextureBaseD3D11::CreateViewInternal( const struct TextureViewDesc &ViewDes case TEXTURE_VIEW_SHADER_RESOURCE: { VERIFY( m_Desc.BindFlags & BIND_SHADER_RESOURCE, "BIND_SHADER_RESOURCE flag is not set" ); - ID3D11ShaderResourceView *pSRV = nullptr; + ID3D11ShaderResourceView* pSRV = nullptr; CreateSRV( UpdatedViewDesc, &pSRV ); pD3D11View.Attach( pSRV ); } @@ -69,7 +73,7 @@ void TextureBaseD3D11::CreateViewInternal( const struct TextureViewDesc &ViewDes case TEXTURE_VIEW_RENDER_TARGET: { VERIFY( m_Desc.BindFlags & BIND_RENDER_TARGET, "BIND_RENDER_TARGET flag is not set" ); - ID3D11RenderTargetView *pRTV = nullptr; + ID3D11RenderTargetView* pRTV = nullptr; CreateRTV( UpdatedViewDesc, &pRTV ); pD3D11View.Attach( pRTV ); } @@ -78,7 +82,7 @@ void TextureBaseD3D11::CreateViewInternal( const struct TextureViewDesc &ViewDes case TEXTURE_VIEW_DEPTH_STENCIL: { VERIFY( m_Desc.BindFlags & BIND_DEPTH_STENCIL, "BIND_DEPTH_STENCIL is not set" ); - ID3D11DepthStencilView *pDSV = nullptr; + ID3D11DepthStencilView* pDSV = nullptr; CreateDSV( UpdatedViewDesc, &pDSV ); pD3D11View.Attach( pDSV ); } @@ -87,7 +91,7 @@ void TextureBaseD3D11::CreateViewInternal( const struct TextureViewDesc &ViewDes case TEXTURE_VIEW_UNORDERED_ACCESS: { VERIFY( m_Desc.BindFlags & BIND_UNORDERED_ACCESS, "BIND_UNORDERED_ACCESS flag is not set" ); - ID3D11UnorderedAccessView *pUAV = nullptr; + ID3D11UnorderedAccessView* pUAV = nullptr; CreateUAV( UpdatedViewDesc, &pUAV ); pD3D11View.Attach( pUAV ); } @@ -96,7 +100,7 @@ void TextureBaseD3D11::CreateViewInternal( const struct TextureViewDesc &ViewDes default: UNEXPECTED( "Unknown view type" ); break; } - auto *pDeviceD3D11Impl = ValidatedCast<RenderDeviceD3D11Impl>(GetDevice()); + auto* pDeviceD3D11Impl = ValidatedCast<RenderDeviceD3D11Impl>(GetDevice()); auto &TexViewAllocator = pDeviceD3D11Impl->GetTexViewObjAllocator(); VERIFY( &TexViewAllocator == &m_dbgTexViewObjAllocator, "Texture view allocator does not match allocator provided during texture initialization" ); @@ -105,7 +109,7 @@ void TextureBaseD3D11::CreateViewInternal( const struct TextureViewDesc &ViewDes VERIFY( pViewD3D11->GetDesc().ViewType == ViewDesc.ViewType, "Incorrect view type" ); if( bIsDefaultView ) - *ppView = pViewD3D11; + * ppView = pViewD3D11; else pViewD3D11->QueryInterface(IID_TextureView, reinterpret_cast<IObject**>(ppView) ); } @@ -116,7 +120,7 @@ void TextureBaseD3D11::CreateViewInternal( const struct TextureViewDesc &ViewDes } } -void TextureBaseD3D11 :: PrepareD3D11InitData(const TextureData &InitData, Uint32 NumSubresources, +void TextureBaseD3D11 :: PrepareD3D11InitData(const TextureData& InitData, Uint32 NumSubresources, std::vector<D3D11_SUBRESOURCE_DATA, STDAllocatorRawMem<D3D11_SUBRESOURCE_DATA> > &D3D11InitData) { if( InitData.pSubResources ) @@ -142,7 +146,7 @@ TextureBaseD3D11 :: ~TextureBaseD3D11() { } -void TextureBaseD3D11::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData ) +void TextureBaseD3D11::UpdateData( IDeviceContext* pContext, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData ) { TTextureBase::UpdateData( pContext, MipLevel, Slice, DstBox, SubresData ); if (SubresData.pSrcBuffer != nullptr) @@ -153,7 +157,7 @@ void TextureBaseD3D11::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Ui VERIFY( m_Desc.Usage == USAGE_DEFAULT, "Only default usage resiurces can be updated with UpdateData()" ); - auto *pd3d11DeviceContext = static_cast<DeviceContextD3D11Impl*>(pContext)->GetD3D11DeviceContext(); + auto* pd3d11DeviceContext = static_cast<DeviceContextD3D11Impl*>(pContext)->GetD3D11DeviceContext(); D3D11_BOX D3D11Box; D3D11Box.left = DstBox.MinX; @@ -166,24 +170,24 @@ void TextureBaseD3D11::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Ui pd3d11DeviceContext->UpdateSubresource(m_pd3d11Texture, SubresIndex, &D3D11Box, SubresData.pData, SubresData.Stride, SubresData.DepthStride); } -void TextureBaseD3D11 :: CopyData(IDeviceContext *pContext, - ITexture *pSrcTexture, - Uint32 SrcMipLevel, - Uint32 SrcSlice, - const Box *pSrcBox, - Uint32 DstMipLevel, - Uint32 DstSlice, - Uint32 DstX, - Uint32 DstY, - Uint32 DstZ) +void TextureBaseD3D11 :: CopyData(IDeviceContext* pContext, + ITexture* pSrcTexture, + Uint32 SrcMipLevel, + Uint32 SrcSlice, + const Box* pSrcBox, + Uint32 DstMipLevel, + Uint32 DstSlice, + Uint32 DstX, + Uint32 DstY, + Uint32 DstZ) { TTextureBase::CopyData( pContext, pSrcTexture, SrcMipLevel, SrcSlice, pSrcBox, DstMipLevel, DstSlice, DstX, DstY, DstZ ); - auto *pd3d11DeviceContext = ValidatedCast<DeviceContextD3D11Impl>(pContext )->GetD3D11DeviceContext(); - auto *pSrTextureBaseD3D11 = ValidatedCast<TextureBaseD3D11>( pSrcTexture ); + auto* pd3d11DeviceContext = ValidatedCast<DeviceContextD3D11Impl>(pContext )->GetD3D11DeviceContext(); + auto* pSrTextureBaseD3D11 = ValidatedCast<TextureBaseD3D11>( pSrcTexture ); - D3D11_BOX D3D11SrcBox, *pD3D11SrcBox = nullptr; + D3D11_BOX D3D11SrcBox,* pD3D11SrcBox = nullptr; if( pSrcBox ) { D3D11SrcBox.left = pSrcBox->MinX; @@ -199,11 +203,11 @@ void TextureBaseD3D11 :: CopyData(IDeviceContext *pContext, pd3d11DeviceContext->CopySubresourceRegion(m_pd3d11Texture, DstSubRes, DstX, DstY, DstZ, pSrTextureBaseD3D11->GetD3D11Texture(), SrcSubRes, pD3D11SrcBox); } -void TextureBaseD3D11 :: Map( IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags, MappedTextureSubresource &MappedData ) +void TextureBaseD3D11 :: Map( IDeviceContext* pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags, MappedTextureSubresource& MappedData ) { TTextureBase::Map( pContext, Subresource, MapType, MapFlags, MappedData ); - auto *pd3d11DeviceContext = static_cast<DeviceContextD3D11Impl*>(pContext)->GetD3D11DeviceContext(); + auto* pd3d11DeviceContext = static_cast<DeviceContextD3D11Impl*>(pContext)->GetD3D11DeviceContext(); D3D11_MAP d3d11MapType = static_cast<D3D11_MAP>(0); UINT d3d11MapFlags = 0; MapParamsToD3D11MapParams(MapType, MapFlags, d3d11MapType, d3d11MapFlags); @@ -223,11 +227,11 @@ void TextureBaseD3D11 :: Map( IDeviceContext *pContext, Uint32 Subresource, MAP_ } } -void TextureBaseD3D11::Unmap( IDeviceContext *pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags ) +void TextureBaseD3D11::Unmap( IDeviceContext* pContext, Uint32 Subresource, MAP_TYPE MapType, Uint32 MapFlags ) { TTextureBase::Unmap( pContext, Subresource, MapType, MapFlags ); - auto *pd3d11DeviceContext = static_cast<DeviceContextD3D11Impl*>(pContext)->GetD3D11DeviceContext(); + auto* pd3d11DeviceContext = static_cast<DeviceContextD3D11Impl*>(pContext)->GetD3D11DeviceContext(); pd3d11DeviceContext->Unmap(m_pd3d11Texture, Subresource); } diff --git a/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp index ecfbca2f..f24e2661 100644 --- a/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp @@ -28,12 +28,12 @@ namespace Diligent { -TextureViewD3D11Impl::TextureViewD3D11Impl( IReferenceCounters *pRefCounters, - IRenderDevice *pDevice, +TextureViewD3D11Impl::TextureViewD3D11Impl( IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, const TextureViewDesc& ViewDesc, - ITexture *pTexture, - ID3D11View* pD3D11View, - bool bIsDefaultView ) : + ITexture* pTexture, + ID3D11View* pD3D11View, + bool bIsDefaultView ) : TTextureViewBase( pRefCounters, pDevice, ViewDesc, pTexture, bIsDefaultView ), m_pD3D11View( pD3D11View ) { |
