diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-01-26 21:44:37 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-01-26 21:44:37 +0000 |
| commit | 38ad2d5cb659074ad9b4bde16bcbf71481719b94 (patch) | |
| tree | 519ded6e25d22d63f7be706c3d71aaf7dd2a6279 /Graphics/GraphicsEngineD3D11 | |
| parent | Renamed .h -> .hpp files in GLSLTools, GraphicsAccessories, and GraphicsTools... (diff) | |
| download | DiligentCore-38ad2d5cb659074ad9b4bde16bcbf71481719b94.tar.gz DiligentCore-38ad2d5cb659074ad9b4bde16bcbf71481719b94.zip | |
Renamed .h -> .hpp in GraphicsEngine, GraphicsEngineD3DBase, GraphicsEningeD3D11, and GraphicsEningeD3D12 projects
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
45 files changed, 1028 insertions, 1028 deletions
diff --git a/Graphics/GraphicsEngineD3D11/CMakeLists.txt b/Graphics/GraphicsEngineD3D11/CMakeLists.txt index ab544ad1..614f6264 100644 --- a/Graphics/GraphicsEngineD3D11/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D11/CMakeLists.txt @@ -4,32 +4,32 @@ project(Diligent-GraphicsEngineD3D11 CXX) set(INCLUDE - include/BufferD3D11Impl.h - include/BufferViewD3D11Impl.h - include/CommandListD3D11Impl.h + include/BufferD3D11Impl.hpp + include/BufferViewD3D11Impl.hpp + include/CommandListD3D11Impl.hpp include/D3D11TypeConversions.h include/D3D11TypeDefinitions.h - include/DeviceContextD3D11Impl.h - include/DisjointQueryPool.h + include/DeviceContextD3D11Impl.hpp + include/DisjointQueryPool.hpp include/EngineD3D11Defines.h include/pch.h - include/FenceD3D11Impl.h - include/PipelineStateD3D11Impl.h - include/QueryD3D11Impl.h - include/RenderDeviceD3D11Impl.h - include/SamplerD3D11Impl.h - include/ShaderD3D11Impl.h - include/ShaderResourceBindingD3D11Impl.h - include/ShaderResourceCacheD3D11.h - include/ShaderResourceLayoutD3D11.h - include/ShaderResourcesD3D11.h - include/SwapChainD3D11Impl.h + include/FenceD3D11Impl.hpp + include/PipelineStateD3D11Impl.hpp + include/QueryD3D11Impl.hpp + include/RenderDeviceD3D11Impl.hpp + include/SamplerD3D11Impl.hpp + include/ShaderD3D11Impl.hpp + include/ShaderResourceBindingD3D11Impl.hpp + include/ShaderResourceCacheD3D11.hpp + include/ShaderResourceLayoutD3D11.hpp + include/ShaderResourcesD3D11.hpp + include/SwapChainD3D11Impl.hpp include/targetver.h - include/Texture1D_D3D11.h - include/Texture2D_D3D11.h - include/Texture3D_D3D11.h - include/TextureBaseD3D11.h - include/TextureViewD3D11Impl.h + include/Texture1D_D3D11.hpp + include/Texture2D_D3D11.hpp + include/Texture3D_D3D11.hpp + include/TextureBaseD3D11.hpp + include/TextureViewD3D11Impl.hpp ) set(INTERFACE diff --git a/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.hpp index 77c74f45..1deb3f91 100644 --- a/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/BufferD3D11Impl.hpp @@ -32,9 +32,9 @@ #include "BufferD3D11.h" #include "RenderDeviceD3D11.h" -#include "BufferBase.h" -#include "BufferViewD3D11Impl.h" -#include "RenderDeviceD3D11Impl.h" +#include "BufferBase.hpp" +#include "BufferViewD3D11Impl.hpp" +#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.hpp index a44eae3a..a0067e3c 100644 --- a/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/BufferViewD3D11Impl.hpp @@ -32,8 +32,8 @@ #include "BufferViewD3D11.h" #include "RenderDeviceD3D11.h" -#include "BufferViewBase.h" -#include "RenderDeviceD3D11Impl.h" +#include "BufferViewBase.hpp" +#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.hpp index 5394a37b..031e8339 100644 --- a/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/CommandListD3D11Impl.hpp @@ -31,8 +31,8 @@ /// Declaration of Diligent::CommandListD3D11Impl class #include "RenderDeviceD3D11.h" -#include "CommandListBase.h" -#include "RenderDeviceD3D11Impl.h" +#include "CommandListBase.hpp" +#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp index 162a1285..f1105509 100755..100644 --- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp @@ -1,438 +1,438 @@ -/*
- * Copyright 2019-2020 Diligent Graphics LLC
- * Copyright 2015-2019 Egor Yusov
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * In no event and under no legal theory, whether in tort (including negligence),
- * contract, or otherwise, unless required by applicable law (such as deliberate
- * and grossly negligent acts) or agreed to in writing, shall any Contributor be
- * liable for any damages, including any direct, indirect, special, incidental,
- * or consequential damages of any character arising as a result of this License or
- * out of the use or inability to use the software (including but not limited to damages
- * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
- * all other commercial damages or losses), even if such Contributor has been advised
- * of the possibility of such damages.
- */
-
-#pragma once
-
-/// \file
-/// Declaration of Diligent::DeviceContextD3D11Impl class
-
-#include "DeviceContextD3D11.h"
-#include "DeviceContextBase.h"
-#include "ShaderD3D11Impl.h"
-#include "BufferD3D11Impl.h"
-#include "TextureBaseD3D11.h"
-#include "PipelineStateD3D11Impl.h"
-#include "QueryD3D11Impl.h"
-#include "DisjointQueryPool.h"
-
-#ifdef _DEBUG
-# define VERIFY_CONTEXT_BINDINGS
-#endif
-
-namespace Diligent
-{
-
-class RenderDeviceD3D11Impl;
-
-struct DeviceContextD3D11ImplTraits
-{
- using BufferType = BufferD3D11Impl;
- using TextureType = TextureBaseD3D11;
- using PipelineStateType = PipelineStateD3D11Impl;
- using DeviceType = RenderDeviceD3D11Impl;
- using QueryType = QueryD3D11Impl;
-};
-
-/// Device context implementation in Direct3D11 backend.
-class DeviceContextD3D11Impl final : public DeviceContextBase<IDeviceContextD3D11, DeviceContextD3D11ImplTraits>
-{
-public:
- using TDeviceContextBase = DeviceContextBase<IDeviceContextD3D11, DeviceContextD3D11ImplTraits>;
-
- DeviceContextD3D11Impl(IReferenceCounters* pRefCounters,
- IMemoryAllocator& Allocator,
- RenderDeviceD3D11Impl* pDevice,
- ID3D11DeviceContext* pd3d11DeviceContext,
- const struct EngineD3D11CreateInfo& EngineAttribs,
- bool bIsDeferred);
- virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
-
- /// Implementation of IDeviceContext::SetPipelineState() in Direct3D11 backend.
- virtual void SetPipelineState(IPipelineState* pPipelineState) override final;
-
- /// Implementation of IDeviceContext::TransitionShaderResources() in Direct3D11 backend.
- virtual void TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) override final;
-
- /// Implementation of IDeviceContext::CommitShaderResources() in Direct3D11 backend.
- virtual void CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final;
-
- /// Implementation of IDeviceContext::SetStencilRef() in Direct3D11 backend.
- virtual void SetStencilRef(Uint32 StencilRef) override final;
-
- /// Implementation of IDeviceContext::SetBlendFactors() in Direct3D11 backend.
- virtual void SetBlendFactors(const float* pBlendFactors = nullptr) override final;
-
- /// Implementation of IDeviceContext::SetVertexBuffers() in Direct3D11 backend.
- virtual void SetVertexBuffers(Uint32 StartSlot,
- Uint32 NumBuffersSet,
- IBuffer** ppBuffers,
- Uint32* pOffsets,
- RESOURCE_STATE_TRANSITION_MODE StateTransitionMode,
- SET_VERTEX_BUFFERS_FLAGS Flags) override final;
-
- /// Implementation of IDeviceContext::InvalidateState() in Direct3D11 backend.
- virtual void InvalidateState() override final;
-
- /// Implementation of IDeviceContext::SetIndexBuffer() in Direct3D11 backend.
- virtual void SetIndexBuffer(IBuffer* pIndexBuffer, Uint32 ByteOffset, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final;
-
- /// Implementation of IDeviceContext::SetViewports() in Direct3D11 backend.
- virtual void SetViewports(Uint32 NumViewports, const Viewport* pViewports, Uint32 RTWidth, Uint32 RTHeight) override final;
-
- /// Implementation of IDeviceContext::SetScissorRects() in Direct3D11 backend.
- virtual void SetScissorRects(Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight) override final;
-
- /// Implementation of IDeviceContext::SetRenderTargets() in Direct3D11 backend.
- virtual void SetRenderTargets(Uint32 NumRenderTargets,
- ITextureView* ppRenderTargets[],
- ITextureView* pDepthStencil,
- RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final;
-
- /// Implementation of IDeviceContext::Draw() in Direct3D11 backend.
- virtual void Draw(const DrawAttribs& Attribs) override final;
- /// Implementation of IDeviceContext::DrawIndexed() in Direct3D11 backend.
- virtual void DrawIndexed(const DrawIndexedAttribs& Attribs) override final;
- /// Implementation of IDeviceContext::DrawIndirect() in Direct3D11 backend.
- virtual void DrawIndirect(const DrawIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) override final;
- /// Implementation of IDeviceContext::DrawIndexedIndirect() in Direct3D11 backend.
- virtual void DrawIndexedIndirect(const DrawIndexedIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) override final;
-
- /// Implementation of IDeviceContext::DispatchCompute() in Direct3D11 backend.
- virtual void DispatchCompute(const DispatchComputeAttribs& Attribs) override final;
- /// Implementation of IDeviceContext::DispatchComputeIndirect() in Direct3D11 backend.
- virtual void DispatchComputeIndirect(const DispatchComputeIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) override final;
-
- /// Implementation of IDeviceContext::ClearDepthStencil() in Direct3D11 backend.
- virtual void ClearDepthStencil(ITextureView* pView,
- CLEAR_DEPTH_STENCIL_FLAGS ClearFlags,
- float fDepth,
- Uint8 Stencil,
- RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final;
-
- /// Implementation of IDeviceContext::ClearRenderTarget() in Direct3D11 backend.
- virtual void ClearRenderTarget(ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final;
-
- /// Implementation of IDeviceContext::UpdateBuffer() in Direct3D11 backend.
- virtual void UpdateBuffer(IBuffer* pBuffer,
- Uint32 Offset,
- Uint32 Size,
- const void* pData,
- RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final;
-
- /// Implementation of IDeviceContext::CopyBuffer() in Direct3D11 backend.
- virtual void CopyBuffer(IBuffer* pSrcBuffer,
- Uint32 SrcOffset,
- RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode,
- IBuffer* pDstBuffer,
- Uint32 DstOffset,
- Uint32 Size,
- RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode) override final;
-
- /// Implementation of IDeviceContext::MapBuffer() in Direct3D11 backend.
- virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData) override final;
-
- /// Implementation of IDeviceContext::UnmapBuffer() in Direct3D11 backend.
- virtual void UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType) override final;
-
- /// Implementation of IDeviceContext::UpdateTexture() in Direct3D11 backend.
- virtual void UpdateTexture(ITexture* pTexture,
- Uint32 MipLevel,
- Uint32 Slice,
- const Box& DstBox,
- const TextureSubResData& SubresData,
- RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode,
- RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final;
-
- /// Implementation of IDeviceContext::CopyTexture() in Direct3D11 backend.
- virtual void CopyTexture(const CopyTextureAttribs& CopyAttribs) override final;
-
- /// Implementation of IDeviceContext::MapTextureSubresource() in Direct3D11 backend.
- virtual void MapTextureSubresource(ITexture* pTexture,
- Uint32 MipLevel,
- Uint32 ArraySlice,
- MAP_TYPE MapType,
- MAP_FLAGS MapFlags,
- const Box* pMapRegion,
- MappedTextureSubresource& MappedData) override final;
-
- /// Implementation of IDeviceContext::UnmapTextureSubresource() in Direct3D11 backend.
- virtual void UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice) override final;
-
- /// Implementation of IDeviceContext::GenerateMips() in Direct3D11 backend.
- virtual void GenerateMips(ITextureView* pTextureView) override final;
-
- /// Implementation of IDeviceContext::FinishFrame() in Direct3D11 backend.
- virtual void FinishFrame() override final;
-
- /// Implementation of IDeviceContext::TransitionResourceStates() in Direct3D11 backend.
- virtual void TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) override final;
-
- /// Implementation of IDeviceContext::ResolveTextureSubresource() in Direct3D11 backend.
- virtual void ResolveTextureSubresource(ITexture* pSrcTexture,
- ITexture* pDstTexture,
- const ResolveTextureSubresourceAttribs& ResolveAttribs) override final;
-
- /// Implementation of IDeviceContext::FinishCommandList() in Direct3D11 backend.
- void FinishCommandList(class ICommandList** ppCommandList) override final;
-
- /// Implementation of IDeviceContext::ExecuteCommandList() in Direct3D11 backend.
- virtual void ExecuteCommandList(class ICommandList* pCommandList) override final;
-
- /// Implementation of IDeviceContext::SignalFence() in Direct3D11 backend.
- virtual void SignalFence(IFence* pFence, Uint64 Value) override final;
-
- /// Implementation of IDeviceContext::WaitForFence() in Direct3D11 backend.
- virtual void WaitForFence(IFence* pFence, Uint64 Value, bool FlushContext) override final;
-
- /// Implementation of IDeviceContext::WaitForIdle() in Direct3D11 backend.
- virtual void WaitForIdle() override final;
-
- /// Implementation of IDeviceContext::BeginQuery() in Direct3D11 backend.
- virtual void BeginQuery(IQuery* pQuery) override final;
-
- /// Implementation of IDeviceContext::EndQuery() in Direct3D11 backend.
- virtual void EndQuery(IQuery* pQuery) override final;
-
- /// Implementation of IDeviceContext::Flush() in Direct3D11 backend.
- virtual void Flush() override final;
-
- /// Implementation of IDeviceContextD3D11::GetD3D11DeviceContext().
- virtual ID3D11DeviceContext* GetD3D11DeviceContext() override final { return m_pd3d11DeviceContext; }
-
- void CommitRenderTargets();
-
- /// Clears committed shader resource cache. This function
- /// is called once per frame (before present) to release all
- /// outstanding objects that are only kept alive by references
- /// in the cache. The function does not release cached vertex and
- /// index buffers, input layout, depth-stencil, rasterizer, and blend
- /// states.
- void ReleaseCommittedShaderResources();
-
- /// Unbinds all render targets. Used when resizing the swap chain.
- virtual void ResetRenderTargets() override final;
-
- /// Number of different shader types (Vertex, Pixel, Geometry, Domain, Hull, Compute)
- static constexpr int NumShaderTypes = 6;
-
-private:
- /// Commits d3d11 index buffer to d3d11 device context.
- void CommitD3D11IndexBuffer(VALUE_TYPE IndexType);
-
- /// Commits d3d11 vertex buffers to d3d11 device context.
- 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[],
- ID3D11Resource* pd3d11ResToUndind,
- TSetD3D11View SetD3D11ViewMethods[]);
-
- /// Unbinds a texture from 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);
-
- /// Unbinds a buffer from 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);
-
- /// Unbinds a resource from UAV slots.
- /// \note The function only unbinds the resource from d3d11 device
- /// context. All shader bindings are retained.
- void UnbindResourceFromUAV(IDeviceObject* pResource, ID3D11Resource* pd3d11Resource);
-
- /// Unbinds a texture from render target slots.
- void UnbindTextureFromRenderTarget(TextureBaseD3D11* pResource);
-
- /// Unbinds a texture from depth-stencil.
- void UnbindTextureFromDepthStencil(TextureBaseD3D11* pTexD3D11);
-
- /// Prepares for a draw command
- __forceinline void PrepareForDraw(DRAW_FLAGS Flags);
-
- /// Prepares for an indexed draw command
- __forceinline void PrepareForIndexedDraw(DRAW_FLAGS Flags, VALUE_TYPE IndexType);
-
-
- template <bool TransitionResources,
- bool CommitResources>
- void TransitionAndCommitShaderResources(IPipelineState* pPSO, IShaderResourceBinding* pShaderResourceBinding, bool VerifyStates);
-
- void ClearStateCache();
-
- CComPtr<ID3D11DeviceContext> m_pd3d11DeviceContext; ///< D3D11 device context
-
- // clang-format off
-
- /// An array of D3D11 constant buffers committed to D3D11 device context,
- /// for each shader type. The context addref's all bound resources, so we do
- /// not need to keep strong references.
- ID3D11Buffer* m_CommittedD3D11CBs [NumShaderTypes][D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT] = {};
-
- /// An array of D3D11 shader resource views committed to D3D11 device context,
- /// for each shader type. The context addref's all bound resources, so we do
- /// not need to keep strong references.
- ID3D11ShaderResourceView* m_CommittedD3D11SRVs [NumShaderTypes][D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT] = {};
-
- /// An array of D3D11 samplers committed to D3D11 device context,
- /// for each shader type. The context addref's all bound resources, so we do
- /// not need to keep strong references.
- ID3D11SamplerState* m_CommittedD3D11Samplers[NumShaderTypes][D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT] = {};
-
- /// An array of D3D11 UAVs committed to D3D11 device context,
- /// for each shader type. The context addref's all bound resources, so we do
- /// not need to keep strong references.
- ID3D11UnorderedAccessView* m_CommittedD3D11UAVs [NumShaderTypes][D3D11_PS_CS_UAV_REGISTER_COUNT] = {};
-
- /// An array of D3D11 resources commited as SRV to D3D11 device context,
- /// for each shader type. The context addref's all bound resources, so we do
- /// not need to keep strong references.
- ID3D11Resource* m_CommittedD3D11SRVResources [NumShaderTypes][D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT] = {};
-
- /// An array of D3D11 resources commited as UAV to D3D11 device context,
- /// for each shader type. The context addref's all bound resources, so we do
- /// not need to keep strong references.
- ID3D11Resource* m_CommittedD3D11UAVResources [NumShaderTypes][D3D11_PS_CS_UAV_REGISTER_COUNT] = {};
-
- Uint8 m_NumCommittedCBs [NumShaderTypes] = {};
- Uint8 m_NumCommittedSRVs [NumShaderTypes] = {};
- Uint8 m_NumCommittedSamplers[NumShaderTypes] = {};
- Uint8 m_NumCommittedUAVs [NumShaderTypes] = {};
-
- // clang-format on
-
- /// An array of D3D11 vertex buffers committed to D3D device context.
- /// There is no need to keep strong references because D3D11 device context
- /// already does. Buffers cannot be destroyed while bound to the context.
- /// We only mirror all bindings.
- ID3D11Buffer* m_CommittedD3D11VertexBuffers[MAX_BUFFER_SLOTS] = {};
- /// An array of strides of committed vertex buffers
- UINT m_CommittedD3D11VBStrides[MAX_BUFFER_SLOTS] = {};
- /// An array of offsets of committed vertex buffers
- UINT m_CommittedD3D11VBOffsets[MAX_BUFFER_SLOTS] = {};
- /// Number committed vertex buffers
- UINT m_NumCommittedD3D11VBs = 0;
- /// Flag indicating if currently committed D3D11 vertex buffers are up to date
- bool m_bCommittedD3D11VBsUpToDate = false;
-
- /// D3D11 input layout committed to device context.
- /// The context keeps the layout alive, so there is no need
- /// to keep strong reference.
- ID3D11InputLayout* m_CommittedD3D11InputLayout = nullptr;
-
- /// Strong reference to D3D11 buffer committed as index buffer
- /// to D3D device context.
- CComPtr<ID3D11Buffer> m_CommittedD3D11IndexBuffer;
- /// Format of the committed D3D11 index buffer
- VALUE_TYPE m_CommittedIBFormat = VT_UNDEFINED;
- /// Offset of the committed D3D11 index buffer
- Uint32 m_CommittedD3D11IndexDataStartOffset = 0;
- /// Flag indicating if currently committed D3D11 index buffer is up to date
- bool m_bCommittedD3D11IBUpToDate = false;
-
- D3D11_PRIMITIVE_TOPOLOGY m_CommittedD3D11PrimTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
- PRIMITIVE_TOPOLOGY m_CommittedPrimitiveTopology = PRIMITIVE_TOPOLOGY_UNDEFINED;
-
- /// Strong references to committed D3D11 shaders
- CComPtr<ID3D11DeviceChild> m_CommittedD3DShaders[NumShaderTypes];
-
- const Uint32 m_DebugFlags;
-
- FixedBlockMemoryAllocator m_CmdListAllocator;
-
- DisjointQueryPool m_DisjointQueryPool;
- std::shared_ptr<DisjointQueryPool::DisjointQueryWrapper> m_ActiveDisjointQuery;
-
-#ifdef VERIFY_CONTEXT_BINDINGS
-
- /// Helper template function used to facilitate context verification
- template <UINT MaxResources, typename TD3D11ResourceType, typename TGetD3D11ResourcesType>
- void dbgVerifyCommittedResources(TD3D11ResourceType CommittedD3D11ResourcesArr[][MaxResources],
- Uint8 NumCommittedResourcesArr[],
- TGetD3D11ResourcesType GetD3D11ResMethods[],
- 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],
- ID3D11Resource* CommittedD3D11ResourcesArr[][MaxResources],
- 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 D3D11 device context
- void dbgVerifyCommittedSRVs(SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN);
-
- /// Debug function that verifies that UAVs cached in m_CommittedD3D11UAVs
- /// array comply with resources actually committed to D3D11 device context
- void dbgVerifyCommittedUAVs(SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN);
-
- /// Debug function that verifies that samplers cached in m_CommittedD3D11Samplers
- /// array comply with resources actually committed to D3D11 device context
- void dbgVerifyCommittedSamplers(SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN);
-
- /// Debug function that verifies that constant buffers cached in m_CommittedD3D11CBs
- /// array comply with buffers actually committed to D3D11 device context
- void dbgVerifyCommittedCBs(SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN);
-
- /// Debug function that verifies that index buffer cached in
- /// m_CommittedD3D11IndexBuffer is the buffer actually committed to D3D11
- /// device context
- void dbgVerifyCommittedIndexBuffer();
-
- /// Debug function that verifies that vertex buffers cached in
- /// m_CommittedD3D11VertexBuffers are the buffers actually committed to D3D11
- /// device context
- void dbgVerifyCommittedVertexBuffers();
-
- /// Debug function that verifies that shaders cached in
- /// m_CommittedD3DShaders are the shaders actually committed to D3D11
- /// device context
- void dbgVerifyCommittedShaders();
-
-#else
-# define dbgVerifyRenderTargetFormats(...)
-# define dbgVerifyCommittedSRVs(...)
-# define dbgVerifyCommittedUAVs(...)
-# define dbgVerifyCommittedSamplers(...)
-# define dbgVerifyCommittedCBs(...)
-# define dbgVerifyCommittedIndexBuffer(...)
-# define dbgVerifyCommittedVertexBuffers(...)
-# define dbgVerifyCommittedShaders(...)
-#endif // VERIFY_CONTEXT_BINDINGS
-};
-
-} // namespace Diligent
+/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +/// \file +/// Declaration of Diligent::DeviceContextD3D11Impl class + +#include "DeviceContextD3D11.h" +#include "DeviceContextBase.hpp" +#include "ShaderD3D11Impl.hpp" +#include "BufferD3D11Impl.hpp" +#include "TextureBaseD3D11.hpp" +#include "PipelineStateD3D11Impl.hpp" +#include "QueryD3D11Impl.hpp" +#include "DisjointQueryPool.hpp" + +#ifdef _DEBUG +# define VERIFY_CONTEXT_BINDINGS +#endif + +namespace Diligent +{ + +class RenderDeviceD3D11Impl; + +struct DeviceContextD3D11ImplTraits +{ + using BufferType = BufferD3D11Impl; + using TextureType = TextureBaseD3D11; + using PipelineStateType = PipelineStateD3D11Impl; + using DeviceType = RenderDeviceD3D11Impl; + using QueryType = QueryD3D11Impl; +}; + +/// Device context implementation in Direct3D11 backend. +class DeviceContextD3D11Impl final : public DeviceContextBase<IDeviceContextD3D11, DeviceContextD3D11ImplTraits> +{ +public: + using TDeviceContextBase = DeviceContextBase<IDeviceContextD3D11, DeviceContextD3D11ImplTraits>; + + DeviceContextD3D11Impl(IReferenceCounters* pRefCounters, + IMemoryAllocator& Allocator, + RenderDeviceD3D11Impl* pDevice, + ID3D11DeviceContext* pd3d11DeviceContext, + const struct EngineD3D11CreateInfo& EngineAttribs, + bool bIsDeferred); + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; + + /// Implementation of IDeviceContext::SetPipelineState() in Direct3D11 backend. + virtual void SetPipelineState(IPipelineState* pPipelineState) override final; + + /// Implementation of IDeviceContext::TransitionShaderResources() in Direct3D11 backend. + virtual void TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding) override final; + + /// Implementation of IDeviceContext::CommitShaderResources() in Direct3D11 backend. + virtual void CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; + + /// Implementation of IDeviceContext::SetStencilRef() in Direct3D11 backend. + virtual void SetStencilRef(Uint32 StencilRef) override final; + + /// Implementation of IDeviceContext::SetBlendFactors() in Direct3D11 backend. + virtual void SetBlendFactors(const float* pBlendFactors = nullptr) override final; + + /// Implementation of IDeviceContext::SetVertexBuffers() in Direct3D11 backend. + virtual void SetVertexBuffers(Uint32 StartSlot, + Uint32 NumBuffersSet, + IBuffer** ppBuffers, + Uint32* pOffsets, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode, + SET_VERTEX_BUFFERS_FLAGS Flags) override final; + + /// Implementation of IDeviceContext::InvalidateState() in Direct3D11 backend. + virtual void InvalidateState() override final; + + /// Implementation of IDeviceContext::SetIndexBuffer() in Direct3D11 backend. + virtual void SetIndexBuffer(IBuffer* pIndexBuffer, Uint32 ByteOffset, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; + + /// Implementation of IDeviceContext::SetViewports() in Direct3D11 backend. + virtual void SetViewports(Uint32 NumViewports, const Viewport* pViewports, Uint32 RTWidth, Uint32 RTHeight) override final; + + /// Implementation of IDeviceContext::SetScissorRects() in Direct3D11 backend. + virtual void SetScissorRects(Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight) override final; + + /// Implementation of IDeviceContext::SetRenderTargets() in Direct3D11 backend. + virtual void SetRenderTargets(Uint32 NumRenderTargets, + ITextureView* ppRenderTargets[], + ITextureView* pDepthStencil, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; + + /// Implementation of IDeviceContext::Draw() in Direct3D11 backend. + virtual void Draw(const DrawAttribs& Attribs) override final; + /// Implementation of IDeviceContext::DrawIndexed() in Direct3D11 backend. + virtual void DrawIndexed(const DrawIndexedAttribs& Attribs) override final; + /// Implementation of IDeviceContext::DrawIndirect() in Direct3D11 backend. + virtual void DrawIndirect(const DrawIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) override final; + /// Implementation of IDeviceContext::DrawIndexedIndirect() in Direct3D11 backend. + virtual void DrawIndexedIndirect(const DrawIndexedIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) override final; + + /// Implementation of IDeviceContext::DispatchCompute() in Direct3D11 backend. + virtual void DispatchCompute(const DispatchComputeAttribs& Attribs) override final; + /// Implementation of IDeviceContext::DispatchComputeIndirect() in Direct3D11 backend. + virtual void DispatchComputeIndirect(const DispatchComputeIndirectAttribs& Attribs, IBuffer* pAttribsBuffer) override final; + + /// Implementation of IDeviceContext::ClearDepthStencil() in Direct3D11 backend. + virtual void ClearDepthStencil(ITextureView* pView, + CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, + float fDepth, + Uint8 Stencil, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; + + /// Implementation of IDeviceContext::ClearRenderTarget() in Direct3D11 backend. + virtual void ClearRenderTarget(ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; + + /// Implementation of IDeviceContext::UpdateBuffer() in Direct3D11 backend. + virtual void UpdateBuffer(IBuffer* pBuffer, + Uint32 Offset, + Uint32 Size, + const void* pData, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; + + /// Implementation of IDeviceContext::CopyBuffer() in Direct3D11 backend. + virtual void CopyBuffer(IBuffer* pSrcBuffer, + Uint32 SrcOffset, + RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, + IBuffer* pDstBuffer, + Uint32 DstOffset, + Uint32 Size, + RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode) override final; + + /// Implementation of IDeviceContext::MapBuffer() in Direct3D11 backend. + virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData) override final; + + /// Implementation of IDeviceContext::UnmapBuffer() in Direct3D11 backend. + virtual void UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType) override final; + + /// Implementation of IDeviceContext::UpdateTexture() in Direct3D11 backend. + virtual void UpdateTexture(ITexture* pTexture, + Uint32 MipLevel, + Uint32 Slice, + const Box& DstBox, + const TextureSubResData& SubresData, + RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final; + + /// Implementation of IDeviceContext::CopyTexture() in Direct3D11 backend. + virtual void CopyTexture(const CopyTextureAttribs& CopyAttribs) override final; + + /// Implementation of IDeviceContext::MapTextureSubresource() in Direct3D11 backend. + virtual void MapTextureSubresource(ITexture* pTexture, + Uint32 MipLevel, + Uint32 ArraySlice, + MAP_TYPE MapType, + MAP_FLAGS MapFlags, + const Box* pMapRegion, + MappedTextureSubresource& MappedData) override final; + + /// Implementation of IDeviceContext::UnmapTextureSubresource() in Direct3D11 backend. + virtual void UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice) override final; + + /// Implementation of IDeviceContext::GenerateMips() in Direct3D11 backend. + virtual void GenerateMips(ITextureView* pTextureView) override final; + + /// Implementation of IDeviceContext::FinishFrame() in Direct3D11 backend. + virtual void FinishFrame() override final; + + /// Implementation of IDeviceContext::TransitionResourceStates() in Direct3D11 backend. + virtual void TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers) override final; + + /// Implementation of IDeviceContext::ResolveTextureSubresource() in Direct3D11 backend. + virtual void ResolveTextureSubresource(ITexture* pSrcTexture, + ITexture* pDstTexture, + const ResolveTextureSubresourceAttribs& ResolveAttribs) override final; + + /// Implementation of IDeviceContext::FinishCommandList() in Direct3D11 backend. + void FinishCommandList(class ICommandList** ppCommandList) override final; + + /// Implementation of IDeviceContext::ExecuteCommandList() in Direct3D11 backend. + virtual void ExecuteCommandList(class ICommandList* pCommandList) override final; + + /// Implementation of IDeviceContext::SignalFence() in Direct3D11 backend. + virtual void SignalFence(IFence* pFence, Uint64 Value) override final; + + /// Implementation of IDeviceContext::WaitForFence() in Direct3D11 backend. + virtual void WaitForFence(IFence* pFence, Uint64 Value, bool FlushContext) override final; + + /// Implementation of IDeviceContext::WaitForIdle() in Direct3D11 backend. + virtual void WaitForIdle() override final; + + /// Implementation of IDeviceContext::BeginQuery() in Direct3D11 backend. + virtual void BeginQuery(IQuery* pQuery) override final; + + /// Implementation of IDeviceContext::EndQuery() in Direct3D11 backend. + virtual void EndQuery(IQuery* pQuery) override final; + + /// Implementation of IDeviceContext::Flush() in Direct3D11 backend. + virtual void Flush() override final; + + /// Implementation of IDeviceContextD3D11::GetD3D11DeviceContext(). + virtual ID3D11DeviceContext* GetD3D11DeviceContext() override final { return m_pd3d11DeviceContext; } + + void CommitRenderTargets(); + + /// Clears committed shader resource cache. This function + /// is called once per frame (before present) to release all + /// outstanding objects that are only kept alive by references + /// in the cache. The function does not release cached vertex and + /// index buffers, input layout, depth-stencil, rasterizer, and blend + /// states. + void ReleaseCommittedShaderResources(); + + /// Unbinds all render targets. Used when resizing the swap chain. + virtual void ResetRenderTargets() override final; + + /// Number of different shader types (Vertex, Pixel, Geometry, Domain, Hull, Compute) + static constexpr int NumShaderTypes = 6; + +private: + /// Commits d3d11 index buffer to d3d11 device context. + void CommitD3D11IndexBuffer(VALUE_TYPE IndexType); + + /// Commits d3d11 vertex buffers to d3d11 device context. + 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[], + ID3D11Resource* pd3d11ResToUndind, + TSetD3D11View SetD3D11ViewMethods[]); + + /// Unbinds a texture from 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); + + /// Unbinds a buffer from 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); + + /// Unbinds a resource from UAV slots. + /// \note The function only unbinds the resource from d3d11 device + /// context. All shader bindings are retained. + void UnbindResourceFromUAV(IDeviceObject* pResource, ID3D11Resource* pd3d11Resource); + + /// Unbinds a texture from render target slots. + void UnbindTextureFromRenderTarget(TextureBaseD3D11* pResource); + + /// Unbinds a texture from depth-stencil. + void UnbindTextureFromDepthStencil(TextureBaseD3D11* pTexD3D11); + + /// Prepares for a draw command + __forceinline void PrepareForDraw(DRAW_FLAGS Flags); + + /// Prepares for an indexed draw command + __forceinline void PrepareForIndexedDraw(DRAW_FLAGS Flags, VALUE_TYPE IndexType); + + + template <bool TransitionResources, + bool CommitResources> + void TransitionAndCommitShaderResources(IPipelineState* pPSO, IShaderResourceBinding* pShaderResourceBinding, bool VerifyStates); + + void ClearStateCache(); + + CComPtr<ID3D11DeviceContext> m_pd3d11DeviceContext; ///< D3D11 device context + + // clang-format off + + /// An array of D3D11 constant buffers committed to D3D11 device context, + /// for each shader type. The context addref's all bound resources, so we do + /// not need to keep strong references. + ID3D11Buffer* m_CommittedD3D11CBs [NumShaderTypes][D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT] = {}; + + /// An array of D3D11 shader resource views committed to D3D11 device context, + /// for each shader type. The context addref's all bound resources, so we do + /// not need to keep strong references. + ID3D11ShaderResourceView* m_CommittedD3D11SRVs [NumShaderTypes][D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT] = {}; + + /// An array of D3D11 samplers committed to D3D11 device context, + /// for each shader type. The context addref's all bound resources, so we do + /// not need to keep strong references. + ID3D11SamplerState* m_CommittedD3D11Samplers[NumShaderTypes][D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT] = {}; + + /// An array of D3D11 UAVs committed to D3D11 device context, + /// for each shader type. The context addref's all bound resources, so we do + /// not need to keep strong references. + ID3D11UnorderedAccessView* m_CommittedD3D11UAVs [NumShaderTypes][D3D11_PS_CS_UAV_REGISTER_COUNT] = {}; + + /// An array of D3D11 resources commited as SRV to D3D11 device context, + /// for each shader type. The context addref's all bound resources, so we do + /// not need to keep strong references. + ID3D11Resource* m_CommittedD3D11SRVResources [NumShaderTypes][D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT] = {}; + + /// An array of D3D11 resources commited as UAV to D3D11 device context, + /// for each shader type. The context addref's all bound resources, so we do + /// not need to keep strong references. + ID3D11Resource* m_CommittedD3D11UAVResources [NumShaderTypes][D3D11_PS_CS_UAV_REGISTER_COUNT] = {}; + + Uint8 m_NumCommittedCBs [NumShaderTypes] = {}; + Uint8 m_NumCommittedSRVs [NumShaderTypes] = {}; + Uint8 m_NumCommittedSamplers[NumShaderTypes] = {}; + Uint8 m_NumCommittedUAVs [NumShaderTypes] = {}; + + // clang-format on + + /// An array of D3D11 vertex buffers committed to D3D device context. + /// There is no need to keep strong references because D3D11 device context + /// already does. Buffers cannot be destroyed while bound to the context. + /// We only mirror all bindings. + ID3D11Buffer* m_CommittedD3D11VertexBuffers[MAX_BUFFER_SLOTS] = {}; + /// An array of strides of committed vertex buffers + UINT m_CommittedD3D11VBStrides[MAX_BUFFER_SLOTS] = {}; + /// An array of offsets of committed vertex buffers + UINT m_CommittedD3D11VBOffsets[MAX_BUFFER_SLOTS] = {}; + /// Number committed vertex buffers + UINT m_NumCommittedD3D11VBs = 0; + /// Flag indicating if currently committed D3D11 vertex buffers are up to date + bool m_bCommittedD3D11VBsUpToDate = false; + + /// D3D11 input layout committed to device context. + /// The context keeps the layout alive, so there is no need + /// to keep strong reference. + ID3D11InputLayout* m_CommittedD3D11InputLayout = nullptr; + + /// Strong reference to D3D11 buffer committed as index buffer + /// to D3D device context. + CComPtr<ID3D11Buffer> m_CommittedD3D11IndexBuffer; + /// Format of the committed D3D11 index buffer + VALUE_TYPE m_CommittedIBFormat = VT_UNDEFINED; + /// Offset of the committed D3D11 index buffer + Uint32 m_CommittedD3D11IndexDataStartOffset = 0; + /// Flag indicating if currently committed D3D11 index buffer is up to date + bool m_bCommittedD3D11IBUpToDate = false; + + D3D11_PRIMITIVE_TOPOLOGY m_CommittedD3D11PrimTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED; + PRIMITIVE_TOPOLOGY m_CommittedPrimitiveTopology = PRIMITIVE_TOPOLOGY_UNDEFINED; + + /// Strong references to committed D3D11 shaders + CComPtr<ID3D11DeviceChild> m_CommittedD3DShaders[NumShaderTypes]; + + const Uint32 m_DebugFlags; + + FixedBlockMemoryAllocator m_CmdListAllocator; + + DisjointQueryPool m_DisjointQueryPool; + std::shared_ptr<DisjointQueryPool::DisjointQueryWrapper> m_ActiveDisjointQuery; + +#ifdef VERIFY_CONTEXT_BINDINGS + + /// Helper template function used to facilitate context verification + template <UINT MaxResources, typename TD3D11ResourceType, typename TGetD3D11ResourcesType> + void dbgVerifyCommittedResources(TD3D11ResourceType CommittedD3D11ResourcesArr[][MaxResources], + Uint8 NumCommittedResourcesArr[], + TGetD3D11ResourcesType GetD3D11ResMethods[], + 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], + ID3D11Resource* CommittedD3D11ResourcesArr[][MaxResources], + 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 D3D11 device context + void dbgVerifyCommittedSRVs(SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN); + + /// Debug function that verifies that UAVs cached in m_CommittedD3D11UAVs + /// array comply with resources actually committed to D3D11 device context + void dbgVerifyCommittedUAVs(SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN); + + /// Debug function that verifies that samplers cached in m_CommittedD3D11Samplers + /// array comply with resources actually committed to D3D11 device context + void dbgVerifyCommittedSamplers(SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN); + + /// Debug function that verifies that constant buffers cached in m_CommittedD3D11CBs + /// array comply with buffers actually committed to D3D11 device context + void dbgVerifyCommittedCBs(SHADER_TYPE ShaderType = SHADER_TYPE_UNKNOWN); + + /// Debug function that verifies that index buffer cached in + /// m_CommittedD3D11IndexBuffer is the buffer actually committed to D3D11 + /// device context + void dbgVerifyCommittedIndexBuffer(); + + /// Debug function that verifies that vertex buffers cached in + /// m_CommittedD3D11VertexBuffers are the buffers actually committed to D3D11 + /// device context + void dbgVerifyCommittedVertexBuffers(); + + /// Debug function that verifies that shaders cached in + /// m_CommittedD3DShaders are the shaders actually committed to D3D11 + /// device context + void dbgVerifyCommittedShaders(); + +#else +# define dbgVerifyRenderTargetFormats(...) +# define dbgVerifyCommittedSRVs(...) +# define dbgVerifyCommittedUAVs(...) +# define dbgVerifyCommittedSamplers(...) +# define dbgVerifyCommittedCBs(...) +# define dbgVerifyCommittedIndexBuffer(...) +# define dbgVerifyCommittedVertexBuffers(...) +# define dbgVerifyCommittedShaders(...) +#endif // VERIFY_CONTEXT_BINDINGS +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/include/DisjointQueryPool.h b/Graphics/GraphicsEngineD3D11/include/DisjointQueryPool.hpp index c9d259ab..c9d259ab 100644 --- a/Graphics/GraphicsEngineD3D11/include/DisjointQueryPool.h +++ b/Graphics/GraphicsEngineD3D11/include/DisjointQueryPool.hpp diff --git a/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.hpp index e4f923de..3b08400a 100644 --- a/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/FenceD3D11Impl.hpp @@ -33,8 +33,8 @@ #include <deque> #include "FenceD3D11.h" #include "RenderDeviceD3D11.h" -#include "FenceBase.h" -#include "RenderDeviceD3D11Impl.h" +#include "FenceBase.hpp" +#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp index 0a2c9805..59c7b0e8 100644 --- a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp @@ -32,10 +32,10 @@ #include "PipelineStateD3D11.h" #include "RenderDeviceD3D11.h" -#include "PipelineStateBase.h" -#include "ShaderD3D11Impl.h" +#include "PipelineStateBase.hpp" +#include "ShaderD3D11Impl.hpp" #include "SRBMemoryAllocator.hpp" -#include "RenderDeviceD3D11Impl.h" +#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/QueryD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/QueryD3D11Impl.hpp index c8611ec0..c95ddcd9 100644 --- a/Graphics/GraphicsEngineD3D11/include/QueryD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/QueryD3D11Impl.hpp @@ -33,9 +33,9 @@ #include <memory> #include "QueryD3D11.h" -#include "QueryBase.h" -#include "RenderDeviceD3D11Impl.h" -#include "DisjointQueryPool.h" +#include "QueryBase.hpp" +#include "RenderDeviceD3D11Impl.hpp" +#include "DisjointQueryPool.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp index 17285244..2c23841c 100644 --- a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp @@ -31,7 +31,7 @@ /// Declaration of Diligent::RenderDeviceD3D11Impl class #include "RenderDeviceD3D11.h" -#include "RenderDeviceD3DBase.h" +#include "RenderDeviceD3DBase.hpp" #include "DeviceContextD3D11.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.hpp index 6d5d8936..6ad866f0 100644 --- a/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/SamplerD3D11Impl.hpp @@ -32,8 +32,8 @@ #include "SamplerD3D11.h" #include "RenderDeviceD3D11.h" -#include "SamplerBase.h" -#include "RenderDeviceD3D11Impl.h" +#include "SamplerBase.hpp" +#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.hpp index aaaae904..214bedca 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderD3D11Impl.hpp @@ -32,13 +32,13 @@ #include "ShaderD3D11.h" #include "RenderDeviceD3D11.h" -#include "ShaderBase.h" -#include "ShaderD3DBase.h" -#include "ShaderResourceLayoutD3D11.h" -#include "ShaderResourceCacheD3D11.h" +#include "ShaderBase.hpp" +#include "ShaderD3DBase.hpp" +#include "ShaderResourceLayoutD3D11.hpp" +#include "ShaderResourceCacheD3D11.hpp" #include "EngineD3D11Defines.h" -#include "ShaderResourcesD3D11.h" -#include "RenderDeviceD3D11Impl.h" +#include "ShaderResourcesD3D11.hpp" +#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp index bc14042d..55a6ca2d 100755..100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp @@ -1,108 +1,108 @@ -/*
- * Copyright 2019-2020 Diligent Graphics LLC
- * Copyright 2015-2019 Egor Yusov
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * In no event and under no legal theory, whether in tort (including negligence),
- * contract, or otherwise, unless required by applicable law (such as deliberate
- * and grossly negligent acts) or agreed to in writing, shall any Contributor be
- * liable for any damages, including any direct, indirect, special, incidental,
- * or consequential damages of any character arising as a result of this License or
- * out of the use or inability to use the software (including but not limited to damages
- * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
- * all other commercial damages or losses), even if such Contributor has been advised
- * of the possibility of such damages.
- */
-
-#pragma once
-
-/// \file
-/// Declaration of Diligent::ShaderResourceBindingD3D11Impl class
-
-#include "ShaderResourceBindingD3D11.h"
-#include "RenderDeviceD3D11.h"
-#include "ShaderResourceBindingBase.h"
-#include "ShaderResourceCacheD3D11.h"
-#include "ShaderResourceLayoutD3D11.h"
-#include "STDAllocator.h"
-
-namespace Diligent
-{
-
-class FixedBlockMemoryAllocator;
-
-/// Implementation of shader resource binding object in Direct3D11 backend.
-class ShaderResourceBindingD3D11Impl final : public ShaderResourceBindingBase<IShaderResourceBindingD3D11>
-{
-public:
- using TBase = ShaderResourceBindingBase<IShaderResourceBindingD3D11>;
-
- ShaderResourceBindingD3D11Impl(IReferenceCounters* pRefCounters,
- class PipelineStateD3D11Impl* pPSO,
- bool IsInternal);
- ~ShaderResourceBindingD3D11Impl();
-
- virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
-
- /// Implementation of IShaderResourceBinding::BindResources() in Direct3D11 backend.
- virtual void BindResources(Uint32 ShaderFlags, IResourceMapping* pResMapping, Uint32 Flags) override final;
-
- /// Implementation of IShaderResourceBinding::GetVariableByName() in Direct3D11 backend.
- virtual IShaderResourceVariable* GetVariableByName(SHADER_TYPE ShaderType, const char* Name) override final;
-
- /// Implementation of IShaderResourceBinding::GetVariableCount() in Direct3D11 backend.
- virtual Uint32 GetVariableCount(SHADER_TYPE ShaderType) const override final;
-
- /// Implementation of IShaderResourceBinding::GetVariableByIndex() in Direct3D11 backend.
- virtual IShaderResourceVariable* GetVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) override final;
-
- /// Implementation of IShaderResourceBinding::InitializeStaticResources() in Direct3D11 backend.
- virtual void InitializeStaticResources(const IPipelineState* pPipelineState) override final;
-
- ShaderResourceCacheD3D11& GetResourceCache(Uint32 Ind)
- {
- VERIFY_EXPR(Ind < m_NumActiveShaders);
- return m_pBoundResourceCaches[Ind];
- }
-
- ShaderResourceLayoutD3D11& GetResourceLayout(Uint32 Ind)
- {
- VERIFY_EXPR(Ind < m_NumActiveShaders);
- return m_pResourceLayouts[Ind];
- }
-
- inline bool IsStaticResourcesBound() { return m_bIsStaticResourcesBound; }
-
- Uint32 GetNumActiveShaders()
- {
- return static_cast<Uint32>(m_NumActiveShaders);
- }
-
- Int32 GetActiveShaderTypeIndex(Uint32 s) { return m_ShaderTypeIndex[s]; }
-
-private:
- // The caches are indexed by the shader order in the PSO, not shader index
- ShaderResourceCacheD3D11* m_pBoundResourceCaches = nullptr;
- ShaderResourceLayoutD3D11* m_pResourceLayouts = nullptr;
-
- Int8 m_ShaderTypeIndex[6] = {};
-
- // Resource layout index in m_ResourceLayouts[] array for every shader stage
- Int8 m_ResourceLayoutIndex[6] = {-1, -1, -1, -1, -1, -1};
- Uint8 m_NumActiveShaders = 0;
-
- bool m_bIsStaticResourcesBound = false;
-};
-
-} // namespace Diligent
+/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +/// \file +/// Declaration of Diligent::ShaderResourceBindingD3D11Impl class + +#include "ShaderResourceBindingD3D11.h" +#include "RenderDeviceD3D11.h" +#include "ShaderResourceBindingBase.hpp" +#include "ShaderResourceCacheD3D11.hpp" +#include "ShaderResourceLayoutD3D11.hpp" +#include "STDAllocator.h" + +namespace Diligent +{ + +class FixedBlockMemoryAllocator; + +/// Implementation of shader resource binding object in Direct3D11 backend. +class ShaderResourceBindingD3D11Impl final : public ShaderResourceBindingBase<IShaderResourceBindingD3D11> +{ +public: + using TBase = ShaderResourceBindingBase<IShaderResourceBindingD3D11>; + + ShaderResourceBindingD3D11Impl(IReferenceCounters* pRefCounters, + class PipelineStateD3D11Impl* pPSO, + bool IsInternal); + ~ShaderResourceBindingD3D11Impl(); + + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; + + /// Implementation of IShaderResourceBinding::BindResources() in Direct3D11 backend. + virtual void BindResources(Uint32 ShaderFlags, IResourceMapping* pResMapping, Uint32 Flags) override final; + + /// Implementation of IShaderResourceBinding::GetVariableByName() in Direct3D11 backend. + virtual IShaderResourceVariable* GetVariableByName(SHADER_TYPE ShaderType, const char* Name) override final; + + /// Implementation of IShaderResourceBinding::GetVariableCount() in Direct3D11 backend. + virtual Uint32 GetVariableCount(SHADER_TYPE ShaderType) const override final; + + /// Implementation of IShaderResourceBinding::GetVariableByIndex() in Direct3D11 backend. + virtual IShaderResourceVariable* GetVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) override final; + + /// Implementation of IShaderResourceBinding::InitializeStaticResources() in Direct3D11 backend. + virtual void InitializeStaticResources(const IPipelineState* pPipelineState) override final; + + ShaderResourceCacheD3D11& GetResourceCache(Uint32 Ind) + { + VERIFY_EXPR(Ind < m_NumActiveShaders); + return m_pBoundResourceCaches[Ind]; + } + + ShaderResourceLayoutD3D11& GetResourceLayout(Uint32 Ind) + { + VERIFY_EXPR(Ind < m_NumActiveShaders); + return m_pResourceLayouts[Ind]; + } + + inline bool IsStaticResourcesBound() { return m_bIsStaticResourcesBound; } + + Uint32 GetNumActiveShaders() + { + return static_cast<Uint32>(m_NumActiveShaders); + } + + Int32 GetActiveShaderTypeIndex(Uint32 s) { return m_ShaderTypeIndex[s]; } + +private: + // The caches are indexed by the shader order in the PSO, not shader index + ShaderResourceCacheD3D11* m_pBoundResourceCaches = nullptr; + ShaderResourceLayoutD3D11* m_pResourceLayouts = nullptr; + + Int8 m_ShaderTypeIndex[6] = {}; + + // Resource layout index in m_ResourceLayouts[] array for every shader stage + Int8 m_ResourceLayoutIndex[6] = {-1, -1, -1, -1, -1, -1}; + Uint8 m_NumActiveShaders = 0; + + bool m_bIsStaticResourcesBound = false; +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.hpp index 2623b5c3..ef18f9f0 100755..100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.hpp @@ -1,334 +1,334 @@ -/*
- * Copyright 2019-2020 Diligent Graphics LLC
- * Copyright 2015-2019 Egor Yusov
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * In no event and under no legal theory, whether in tort (including negligence),
- * contract, or otherwise, unless required by applicable law (such as deliberate
- * and grossly negligent acts) or agreed to in writing, shall any Contributor be
- * liable for any damages, including any direct, indirect, special, incidental,
- * or consequential damages of any character arising as a result of this License or
- * out of the use or inability to use the software (including but not limited to damages
- * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
- * all other commercial damages or losses), even if such Contributor has been advised
- * of the possibility of such damages.
- */
-
-#pragma once
-
-/// \file
-/// Declaration of Diligent::ShaderResourceCacheD3D11 class
-
-#include "TextureBaseD3D11.h"
-#include "BufferD3D11Impl.h"
-#include "SamplerD3D11Impl.h"
-
-namespace Diligent
-{
-
-/// The class implements a cache that holds resources bound to a specific shader stage
-// All resources are stored in the continuous memory using the following layout:
-//
-// | CachedCB | ID3D11Buffer* || CachedResource | ID3D11ShaderResourceView* || CachedSampler | ID3D11SamplerState* || CachedResource | ID3D11UnorderedAccessView*||
-// |---------------------------------------------------||--------------------------|---------------------------||------------------------------|-----------------------------||-------------------------|---------------------------||
-// | 0 | 1 | ... | CBCount-1 | 0 | 1 | ...| CBCount-1 || 0 | 1 | ... | SRVCount-1 | 0 | 1 | ... | SRVCount-1 || 0 | 1 | ... | SamplerCount-1 | 0 | 1 | ...| SamplerCount-1 ||0 | 1 | ... | UAVCount-1 | 0 | 1 | ... | UAVCount-1 ||
-// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-//
-//
-// http://diligentgraphics.com/diligent-engine/architecture/d3d11/shader-resource-cache/
-class ShaderResourceCacheD3D11
-{
-public:
- ShaderResourceCacheD3D11()
- {}
-
- ~ShaderResourceCacheD3D11();
-
- // clang-format off
- ShaderResourceCacheD3D11 (const ShaderResourceCacheD3D11&) = delete;
- ShaderResourceCacheD3D11& operator = (const ShaderResourceCacheD3D11&) = delete;
- ShaderResourceCacheD3D11 (ShaderResourceCacheD3D11&&) = delete;
- ShaderResourceCacheD3D11& operator = (ShaderResourceCacheD3D11&&) = delete;
- // clang-format on
-
- /// Describes a resource associated with a cached constant buffer
- struct CachedCB
- {
- /// Strong reference to the buffer
- RefCntAutoPtr<BufferD3D11Impl> pBuff;
-
- __forceinline void Set(RefCntAutoPtr<BufferD3D11Impl>&& _pBuff)
- {
- pBuff = std::move(_pBuff);
- }
- };
-
- /// Describes a resource associated with a cached sampler
- struct CachedSampler
- {
- /// Strong reference to the sampler
- RefCntAutoPtr<class SamplerD3D11Impl> pSampler;
-
- __forceinline void Set(SamplerD3D11Impl* pSam)
- {
- pSampler = pSam;
- }
- };
-
- /// Describes a resource associated with a cached SRV or a UAV
- struct CachedResource
- {
- /// Wee keep strong reference to the view instead of the reference
- /// to the texture or buffer because this is more efficient from
- /// performance point of view: this avoids one pair of
- /// AddStrongRef()/ReleaseStrongRef(). The view holds strong reference
- /// to the texture or the buffer, so it makes no difference.
- RefCntAutoPtr<IDeviceObject> pView;
-
- TextureBaseD3D11* pTexture = nullptr;
- BufferD3D11Impl* pBuffer = nullptr;
-
- // There is no need to keep strong reference to D3D11 resource as
- // it is already kept by either pTexture or pBuffer
- ID3D11Resource* pd3d11Resource = nullptr;
-
- CachedResource() noexcept {}
-
- __forceinline void Set(RefCntAutoPtr<TextureViewD3D11Impl>&& pTexView)
- {
- pBuffer = nullptr;
- // Avoid unnecessary virtual function calls
- pTexture = pTexView ? ValidatedCast<TextureBaseD3D11>(pTexView->TextureViewD3D11Impl::GetTexture()) : nullptr;
- pView.Attach(pTexView.Detach());
- pd3d11Resource = pTexture ? pTexture->TextureBaseD3D11::GetD3D11Texture() : nullptr;
- }
-
- __forceinline void Set(RefCntAutoPtr<BufferViewD3D11Impl>&& pBufView)
- {
- pTexture = nullptr;
- // Avoid unnecessary virtual function calls
- pBuffer = pBufView ? ValidatedCast<BufferD3D11Impl>(pBufView->BufferViewD3D11Impl::GetBuffer()) : nullptr;
- pView.Attach(pBufView.Detach());
- pd3d11Resource = pBuffer ? pBuffer->BufferD3D11Impl::GetD3D11Buffer() : nullptr;
- }
- };
-
- static size_t GetRequriedMemorySize(const class ShaderResourcesD3D11& Resources);
-
- void Initialize(const class ShaderResourcesD3D11& Resources, class IMemoryAllocator& MemAllocator);
- void Initialize(Uint32 CBCount, Uint32 SRVCount, Uint32 SamplerCount, Uint32 UAVCount, class IMemoryAllocator& MemAllocator);
- void Destroy(class IMemoryAllocator& MemAllocator);
-
-
- __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);
- }
-
- __forceinline void SetTexSRV(Uint32 Slot, RefCntAutoPtr<TextureViewD3D11Impl>&& pTexView)
- {
- auto* pd3d11SRV = pTexView ? static_cast<ID3D11ShaderResourceView*>(pTexView->TextureViewD3D11Impl::GetD3D11View()) : nullptr;
- SetD3D11ResourceInternal<CachedResource>(Slot, GetSRVCount(), &ShaderResourceCacheD3D11::GetSRVArrays, std::move(pTexView), pd3d11SRV);
- }
-
- __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);
- }
-
- __forceinline void SetTexUAV(Uint32 Slot, RefCntAutoPtr<TextureViewD3D11Impl>&& pTexView)
- {
- auto* pd3d11UAV = pTexView ? static_cast<ID3D11UnorderedAccessView*>(pTexView->TextureViewD3D11Impl::GetD3D11View()) : nullptr;
- SetD3D11ResourceInternal<CachedResource>(Slot, GetUAVCount(), &ShaderResourceCacheD3D11::GetUAVArrays, std::move(pTexView), pd3d11UAV);
- }
-
- __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);
- }
-
- __forceinline void SetSampler(Uint32 Slot, SamplerD3D11Impl* pSampler)
- {
- auto* pd3d11Sampler = pSampler ? pSampler->SamplerD3D11Impl::GetD3D11SamplerState() : nullptr;
- SetD3D11ResourceInternal<CachedSampler>(Slot, GetSamplerCount(), &ShaderResourceCacheD3D11::GetSamplerArrays, pSampler, pd3d11Sampler);
- }
-
-
-
- __forceinline CachedCB& GetCB(Uint32 Slot)
- {
- VERIFY(Slot < GetCBCount(), "CB slot is out of range");
- ShaderResourceCacheD3D11::CachedCB* CBs;
- ID3D11Buffer** pd3d11CBs;
- GetCBArrays(CBs, pd3d11CBs);
- return CBs[Slot];
- }
-
- __forceinline CachedResource& GetSRV(Uint32 Slot)
- {
- VERIFY(Slot < GetSRVCount(), "SRV slot is out of range");
- ShaderResourceCacheD3D11::CachedResource* SRVResources;
- ID3D11ShaderResourceView** pd3d11SRVs;
- GetSRVArrays(SRVResources, pd3d11SRVs);
- return SRVResources[Slot];
- }
-
- __forceinline CachedResource& GetUAV(Uint32 Slot)
- {
- VERIFY(Slot < GetUAVCount(), "UAV slot is out of range");
- ShaderResourceCacheD3D11::CachedResource* UAVResources;
- ID3D11UnorderedAccessView** pd3d11UAVs;
- GetUAVArrays(UAVResources, pd3d11UAVs);
- return UAVResources[Slot];
- }
-
- __forceinline CachedSampler& GetSampler(Uint32 Slot)
- {
- VERIFY(Slot < GetSamplerCount(), "Sampler slot is out of range");
- ShaderResourceCacheD3D11::CachedSampler* Samplers;
- ID3D11SamplerState** pd3d11Samplers;
- GetSamplerArrays(Samplers, pd3d11Samplers);
- return Samplers[Slot];
- }
-
-
- __forceinline bool IsCBBound(Uint32 Slot) const
- {
- CachedCB* CBs = nullptr;
- ID3D11Buffer** d3d11CBs = nullptr;
- const_cast<ShaderResourceCacheD3D11*>(this)->GetCBArrays(CBs, d3d11CBs);
- if (Slot < GetCBCount() && d3d11CBs[Slot] != nullptr)
- {
- VERIFY(CBs[Slot].pBuff != nullptr, "No relevant buffer resource");
- return true;
- }
- return false;
- }
-
- __forceinline bool IsSRVBound(Uint32 Slot, bool dbgIsTextureView) const
- {
- CachedResource* SRVResources = nullptr;
- ID3D11ShaderResourceView** d3d11SRVs = nullptr;
- const_cast<ShaderResourceCacheD3D11*>(this)->GetSRVArrays(SRVResources, d3d11SRVs);
- if (Slot < GetSRVCount() && d3d11SRVs[Slot] != nullptr)
- {
- VERIFY((dbgIsTextureView && SRVResources[Slot].pTexture != nullptr) || (!dbgIsTextureView && SRVResources[Slot].pBuffer != nullptr),
- "No relevant resource");
- return true;
- }
- return false;
- }
-
- __forceinline bool IsUAVBound(Uint32 Slot, bool dbgIsTextureView) const
- {
- CachedResource* UAVResources = nullptr;
- ID3D11UnorderedAccessView** d3d11UAVs = nullptr;
- const_cast<ShaderResourceCacheD3D11*>(this)->GetUAVArrays(UAVResources, d3d11UAVs);
- if (Slot < GetUAVCount() && d3d11UAVs[Slot] != nullptr)
- {
- VERIFY((dbgIsTextureView && UAVResources[Slot].pTexture != nullptr) || (!dbgIsTextureView && UAVResources[Slot].pBuffer != nullptr),
- "No relevant resource");
- return true;
- }
- return false;
- }
-
- __forceinline bool IsSamplerBound(Uint32 Slot) const
- {
- CachedSampler* Samplers = nullptr;
- ID3D11SamplerState** d3d11Samplers = nullptr;
- const_cast<ShaderResourceCacheD3D11*>(this)->GetSamplerArrays(Samplers, d3d11Samplers);
- if (Slot < GetSamplerCount() && d3d11Samplers[Slot] != nullptr)
- {
- VERIFY(Samplers[Slot].pSampler != nullptr, "No relevant sampler");
- return true;
- }
- return false;
- }
-
- void dbgVerifyCacheConsistency();
-
- // clang-format off
- __forceinline Uint32 GetCBCount() const { return (m_SRVOffset - m_CBOffset) / (sizeof(CachedCB) + sizeof(ID3D11Buffer*)); }
- __forceinline Uint32 GetSRVCount() const { return (m_SamplerOffset - m_SRVOffset) / (sizeof(CachedResource) + sizeof(ID3D11ShaderResourceView*)); }
- __forceinline Uint32 GetSamplerCount() const { return (m_UAVOffset - m_SamplerOffset) / (sizeof(CachedSampler) + sizeof(ID3D11SamplerState*)); }
- __forceinline Uint32 GetUAVCount() const { return (m_MemoryEndOffset - m_UAVOffset) / (sizeof(CachedResource) + sizeof(ID3D11UnorderedAccessView*)); }
- // clang-format on
-
- __forceinline void GetCBArrays(CachedCB*& CBs, ID3D11Buffer**& pd3d11CBs)
- {
- CBs = reinterpret_cast<CachedCB*>(m_pResourceData + m_CBOffset);
- pd3d11CBs = reinterpret_cast<ID3D11Buffer**>(CBs + GetCBCount());
- }
-
- __forceinline void GetSRVArrays(CachedResource*& SRVResources, ID3D11ShaderResourceView**& d3d11SRVs)
- {
- SRVResources = reinterpret_cast<CachedResource*>(m_pResourceData + m_SRVOffset);
- d3d11SRVs = reinterpret_cast<ID3D11ShaderResourceView**>(SRVResources + GetSRVCount());
- }
-
- __forceinline void GetSamplerArrays(CachedSampler*& Samplers, ID3D11SamplerState**& pd3d11Samplers)
- {
- Samplers = reinterpret_cast<CachedSampler*>(m_pResourceData + m_SamplerOffset);
- pd3d11Samplers = reinterpret_cast<ID3D11SamplerState**>(Samplers + GetSamplerCount());
- }
-
- __forceinline void GetUAVArrays(CachedResource*& UAVResources, ID3D11UnorderedAccessView**& pd3d11UAVs)
- {
- UAVResources = reinterpret_cast<CachedResource*>(m_pResourceData + m_UAVOffset);
- pd3d11UAVs = reinterpret_cast<ID3D11UnorderedAccessView**>(UAVResources + GetUAVCount());
- }
-
- __forceinline bool IsInitialized() const
- {
- return m_MemoryEndOffset != InvalidResourceOffset;
- }
-
-private:
- template <typename TCachedResourceType, typename TGetResourceArraysFunc, typename TSrcResourceType, typename TD3D11ResourceType>
- __forceinline void SetD3D11ResourceInternal(Uint32 Slot, Uint32 Size, TGetResourceArraysFunc GetArrays, TSrcResourceType&& pResource, TD3D11ResourceType* pd3d11Resource)
- {
- VERIFY(Slot < Size, "Resource cache is not big enough");
- VERIFY(pResource != nullptr && pd3d11Resource != nullptr || pResource == nullptr && pd3d11Resource == nullptr,
- "Resource and D3D11 resource must be set/unset atomically");
- TCachedResourceType* Resources;
- TD3D11ResourceType** d3d11ResArr;
- (this->*GetArrays)(Resources, d3d11ResArr);
- Resources[Slot].Set(std::forward<TSrcResourceType>(pResource));
- d3d11ResArr[Slot] = pd3d11Resource;
- }
-
- static constexpr const Uint16 InvalidResourceOffset = 0xFFFF;
- // Resource limits in D3D11:
- // Max CB count: 14
- // Max SRV count: 128
- // Max Sampler count: 16
- // Max UAV count: 8
- static constexpr const Uint16 m_CBOffset = 0;
- Uint16 m_SRVOffset = InvalidResourceOffset;
- Uint16 m_SamplerOffset = InvalidResourceOffset;
- Uint16 m_UAVOffset = InvalidResourceOffset;
- Uint16 m_MemoryEndOffset = InvalidResourceOffset;
-
- Uint8* m_pResourceData = nullptr;
-
-#ifdef _DEBUG
- IMemoryAllocator* m_pdbgMemoryAllocator = nullptr;
-#endif
-};
-
-} // namespace Diligent
+/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +/// \file +/// Declaration of Diligent::ShaderResourceCacheD3D11 class + +#include "TextureBaseD3D11.hpp" +#include "BufferD3D11Impl.hpp" +#include "SamplerD3D11Impl.hpp" + +namespace Diligent +{ + +/// The class implements a cache that holds resources bound to a specific shader stage +// All resources are stored in the continuous memory using the following layout: +// +// | CachedCB | ID3D11Buffer* || CachedResource | ID3D11ShaderResourceView* || CachedSampler | ID3D11SamplerState* || CachedResource | ID3D11UnorderedAccessView*|| +// |---------------------------------------------------||--------------------------|---------------------------||------------------------------|-----------------------------||-------------------------|---------------------------|| +// | 0 | 1 | ... | CBCount-1 | 0 | 1 | ...| CBCount-1 || 0 | 1 | ... | SRVCount-1 | 0 | 1 | ... | SRVCount-1 || 0 | 1 | ... | SamplerCount-1 | 0 | 1 | ...| SamplerCount-1 ||0 | 1 | ... | UAVCount-1 | 0 | 1 | ... | UAVCount-1 || +// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +// +// +// http://diligentgraphics.com/diligent-engine/architecture/d3d11/shader-resource-cache/ +class ShaderResourceCacheD3D11 +{ +public: + ShaderResourceCacheD3D11() + {} + + ~ShaderResourceCacheD3D11(); + + // clang-format off + ShaderResourceCacheD3D11 (const ShaderResourceCacheD3D11&) = delete; + ShaderResourceCacheD3D11& operator = (const ShaderResourceCacheD3D11&) = delete; + ShaderResourceCacheD3D11 (ShaderResourceCacheD3D11&&) = delete; + ShaderResourceCacheD3D11& operator = (ShaderResourceCacheD3D11&&) = delete; + // clang-format on + + /// Describes a resource associated with a cached constant buffer + struct CachedCB + { + /// Strong reference to the buffer + RefCntAutoPtr<BufferD3D11Impl> pBuff; + + __forceinline void Set(RefCntAutoPtr<BufferD3D11Impl>&& _pBuff) + { + pBuff = std::move(_pBuff); + } + }; + + /// Describes a resource associated with a cached sampler + struct CachedSampler + { + /// Strong reference to the sampler + RefCntAutoPtr<class SamplerD3D11Impl> pSampler; + + __forceinline void Set(SamplerD3D11Impl* pSam) + { + pSampler = pSam; + } + }; + + /// Describes a resource associated with a cached SRV or a UAV + struct CachedResource + { + /// Wee keep strong reference to the view instead of the reference + /// to the texture or buffer because this is more efficient from + /// performance point of view: this avoids one pair of + /// AddStrongRef()/ReleaseStrongRef(). The view holds strong reference + /// to the texture or the buffer, so it makes no difference. + RefCntAutoPtr<IDeviceObject> pView; + + TextureBaseD3D11* pTexture = nullptr; + BufferD3D11Impl* pBuffer = nullptr; + + // There is no need to keep strong reference to D3D11 resource as + // it is already kept by either pTexture or pBuffer + ID3D11Resource* pd3d11Resource = nullptr; + + CachedResource() noexcept {} + + __forceinline void Set(RefCntAutoPtr<TextureViewD3D11Impl>&& pTexView) + { + pBuffer = nullptr; + // Avoid unnecessary virtual function calls + pTexture = pTexView ? ValidatedCast<TextureBaseD3D11>(pTexView->TextureViewD3D11Impl::GetTexture()) : nullptr; + pView.Attach(pTexView.Detach()); + pd3d11Resource = pTexture ? pTexture->TextureBaseD3D11::GetD3D11Texture() : nullptr; + } + + __forceinline void Set(RefCntAutoPtr<BufferViewD3D11Impl>&& pBufView) + { + pTexture = nullptr; + // Avoid unnecessary virtual function calls + pBuffer = pBufView ? ValidatedCast<BufferD3D11Impl>(pBufView->BufferViewD3D11Impl::GetBuffer()) : nullptr; + pView.Attach(pBufView.Detach()); + pd3d11Resource = pBuffer ? pBuffer->BufferD3D11Impl::GetD3D11Buffer() : nullptr; + } + }; + + static size_t GetRequriedMemorySize(const class ShaderResourcesD3D11& Resources); + + void Initialize(const class ShaderResourcesD3D11& Resources, class IMemoryAllocator& MemAllocator); + void Initialize(Uint32 CBCount, Uint32 SRVCount, Uint32 SamplerCount, Uint32 UAVCount, class IMemoryAllocator& MemAllocator); + void Destroy(class IMemoryAllocator& MemAllocator); + + + __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); + } + + __forceinline void SetTexSRV(Uint32 Slot, RefCntAutoPtr<TextureViewD3D11Impl>&& pTexView) + { + auto* pd3d11SRV = pTexView ? static_cast<ID3D11ShaderResourceView*>(pTexView->TextureViewD3D11Impl::GetD3D11View()) : nullptr; + SetD3D11ResourceInternal<CachedResource>(Slot, GetSRVCount(), &ShaderResourceCacheD3D11::GetSRVArrays, std::move(pTexView), pd3d11SRV); + } + + __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); + } + + __forceinline void SetTexUAV(Uint32 Slot, RefCntAutoPtr<TextureViewD3D11Impl>&& pTexView) + { + auto* pd3d11UAV = pTexView ? static_cast<ID3D11UnorderedAccessView*>(pTexView->TextureViewD3D11Impl::GetD3D11View()) : nullptr; + SetD3D11ResourceInternal<CachedResource>(Slot, GetUAVCount(), &ShaderResourceCacheD3D11::GetUAVArrays, std::move(pTexView), pd3d11UAV); + } + + __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); + } + + __forceinline void SetSampler(Uint32 Slot, SamplerD3D11Impl* pSampler) + { + auto* pd3d11Sampler = pSampler ? pSampler->SamplerD3D11Impl::GetD3D11SamplerState() : nullptr; + SetD3D11ResourceInternal<CachedSampler>(Slot, GetSamplerCount(), &ShaderResourceCacheD3D11::GetSamplerArrays, pSampler, pd3d11Sampler); + } + + + + __forceinline CachedCB& GetCB(Uint32 Slot) + { + VERIFY(Slot < GetCBCount(), "CB slot is out of range"); + ShaderResourceCacheD3D11::CachedCB* CBs; + ID3D11Buffer** pd3d11CBs; + GetCBArrays(CBs, pd3d11CBs); + return CBs[Slot]; + } + + __forceinline CachedResource& GetSRV(Uint32 Slot) + { + VERIFY(Slot < GetSRVCount(), "SRV slot is out of range"); + ShaderResourceCacheD3D11::CachedResource* SRVResources; + ID3D11ShaderResourceView** pd3d11SRVs; + GetSRVArrays(SRVResources, pd3d11SRVs); + return SRVResources[Slot]; + } + + __forceinline CachedResource& GetUAV(Uint32 Slot) + { + VERIFY(Slot < GetUAVCount(), "UAV slot is out of range"); + ShaderResourceCacheD3D11::CachedResource* UAVResources; + ID3D11UnorderedAccessView** pd3d11UAVs; + GetUAVArrays(UAVResources, pd3d11UAVs); + return UAVResources[Slot]; + } + + __forceinline CachedSampler& GetSampler(Uint32 Slot) + { + VERIFY(Slot < GetSamplerCount(), "Sampler slot is out of range"); + ShaderResourceCacheD3D11::CachedSampler* Samplers; + ID3D11SamplerState** pd3d11Samplers; + GetSamplerArrays(Samplers, pd3d11Samplers); + return Samplers[Slot]; + } + + + __forceinline bool IsCBBound(Uint32 Slot) const + { + CachedCB* CBs = nullptr; + ID3D11Buffer** d3d11CBs = nullptr; + const_cast<ShaderResourceCacheD3D11*>(this)->GetCBArrays(CBs, d3d11CBs); + if (Slot < GetCBCount() && d3d11CBs[Slot] != nullptr) + { + VERIFY(CBs[Slot].pBuff != nullptr, "No relevant buffer resource"); + return true; + } + return false; + } + + __forceinline bool IsSRVBound(Uint32 Slot, bool dbgIsTextureView) const + { + CachedResource* SRVResources = nullptr; + ID3D11ShaderResourceView** d3d11SRVs = nullptr; + const_cast<ShaderResourceCacheD3D11*>(this)->GetSRVArrays(SRVResources, d3d11SRVs); + if (Slot < GetSRVCount() && d3d11SRVs[Slot] != nullptr) + { + VERIFY((dbgIsTextureView && SRVResources[Slot].pTexture != nullptr) || (!dbgIsTextureView && SRVResources[Slot].pBuffer != nullptr), + "No relevant resource"); + return true; + } + return false; + } + + __forceinline bool IsUAVBound(Uint32 Slot, bool dbgIsTextureView) const + { + CachedResource* UAVResources = nullptr; + ID3D11UnorderedAccessView** d3d11UAVs = nullptr; + const_cast<ShaderResourceCacheD3D11*>(this)->GetUAVArrays(UAVResources, d3d11UAVs); + if (Slot < GetUAVCount() && d3d11UAVs[Slot] != nullptr) + { + VERIFY((dbgIsTextureView && UAVResources[Slot].pTexture != nullptr) || (!dbgIsTextureView && UAVResources[Slot].pBuffer != nullptr), + "No relevant resource"); + return true; + } + return false; + } + + __forceinline bool IsSamplerBound(Uint32 Slot) const + { + CachedSampler* Samplers = nullptr; + ID3D11SamplerState** d3d11Samplers = nullptr; + const_cast<ShaderResourceCacheD3D11*>(this)->GetSamplerArrays(Samplers, d3d11Samplers); + if (Slot < GetSamplerCount() && d3d11Samplers[Slot] != nullptr) + { + VERIFY(Samplers[Slot].pSampler != nullptr, "No relevant sampler"); + return true; + } + return false; + } + + void dbgVerifyCacheConsistency(); + + // clang-format off + __forceinline Uint32 GetCBCount() const { return (m_SRVOffset - m_CBOffset) / (sizeof(CachedCB) + sizeof(ID3D11Buffer*)); } + __forceinline Uint32 GetSRVCount() const { return (m_SamplerOffset - m_SRVOffset) / (sizeof(CachedResource) + sizeof(ID3D11ShaderResourceView*)); } + __forceinline Uint32 GetSamplerCount() const { return (m_UAVOffset - m_SamplerOffset) / (sizeof(CachedSampler) + sizeof(ID3D11SamplerState*)); } + __forceinline Uint32 GetUAVCount() const { return (m_MemoryEndOffset - m_UAVOffset) / (sizeof(CachedResource) + sizeof(ID3D11UnorderedAccessView*)); } + // clang-format on + + __forceinline void GetCBArrays(CachedCB*& CBs, ID3D11Buffer**& pd3d11CBs) + { + CBs = reinterpret_cast<CachedCB*>(m_pResourceData + m_CBOffset); + pd3d11CBs = reinterpret_cast<ID3D11Buffer**>(CBs + GetCBCount()); + } + + __forceinline void GetSRVArrays(CachedResource*& SRVResources, ID3D11ShaderResourceView**& d3d11SRVs) + { + SRVResources = reinterpret_cast<CachedResource*>(m_pResourceData + m_SRVOffset); + d3d11SRVs = reinterpret_cast<ID3D11ShaderResourceView**>(SRVResources + GetSRVCount()); + } + + __forceinline void GetSamplerArrays(CachedSampler*& Samplers, ID3D11SamplerState**& pd3d11Samplers) + { + Samplers = reinterpret_cast<CachedSampler*>(m_pResourceData + m_SamplerOffset); + pd3d11Samplers = reinterpret_cast<ID3D11SamplerState**>(Samplers + GetSamplerCount()); + } + + __forceinline void GetUAVArrays(CachedResource*& UAVResources, ID3D11UnorderedAccessView**& pd3d11UAVs) + { + UAVResources = reinterpret_cast<CachedResource*>(m_pResourceData + m_UAVOffset); + pd3d11UAVs = reinterpret_cast<ID3D11UnorderedAccessView**>(UAVResources + GetUAVCount()); + } + + __forceinline bool IsInitialized() const + { + return m_MemoryEndOffset != InvalidResourceOffset; + } + +private: + template <typename TCachedResourceType, typename TGetResourceArraysFunc, typename TSrcResourceType, typename TD3D11ResourceType> + __forceinline void SetD3D11ResourceInternal(Uint32 Slot, Uint32 Size, TGetResourceArraysFunc GetArrays, TSrcResourceType&& pResource, TD3D11ResourceType* pd3d11Resource) + { + VERIFY(Slot < Size, "Resource cache is not big enough"); + VERIFY(pResource != nullptr && pd3d11Resource != nullptr || pResource == nullptr && pd3d11Resource == nullptr, + "Resource and D3D11 resource must be set/unset atomically"); + TCachedResourceType* Resources; + TD3D11ResourceType** d3d11ResArr; + (this->*GetArrays)(Resources, d3d11ResArr); + Resources[Slot].Set(std::forward<TSrcResourceType>(pResource)); + d3d11ResArr[Slot] = pd3d11Resource; + } + + static constexpr const Uint16 InvalidResourceOffset = 0xFFFF; + // Resource limits in D3D11: + // Max CB count: 14 + // Max SRV count: 128 + // Max Sampler count: 16 + // Max UAV count: 8 + static constexpr const Uint16 m_CBOffset = 0; + Uint16 m_SRVOffset = InvalidResourceOffset; + Uint16 m_SamplerOffset = InvalidResourceOffset; + Uint16 m_UAVOffset = InvalidResourceOffset; + Uint16 m_MemoryEndOffset = InvalidResourceOffset; + + Uint8* m_pResourceData = nullptr; + +#ifdef _DEBUG + IMemoryAllocator* m_pdbgMemoryAllocator = nullptr; +#endif +}; + +} // namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.hpp index 3c42624e..9b58ea3c 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.hpp @@ -30,13 +30,13 @@ /// \file /// Declaration of Diligent::ShaderResourceLayoutD3D11 class -#include "ShaderResources.h" -#include "ShaderBase.h" -#include "ShaderResourceCacheD3D11.h" +#include "ShaderResources.hpp" +#include "ShaderBase.hpp" +#include "ShaderResourceCacheD3D11.hpp" #include "EngineD3D11Defines.h" #include "STDAllocator.h" -#include "ShaderVariableD3DBase.h" -#include "ShaderResourcesD3D11.h" +#include "ShaderVariableD3DBase.hpp" +#include "ShaderResourcesD3D11.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h b/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.hpp index 5e3ac600..6fe91203 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.hpp @@ -83,7 +83,7 @@ #include <vector> -#include "ShaderResources.h" +#include "ShaderResources.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.hpp index 3997f1c7..f40b4b9b 100644 --- a/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/SwapChainD3D11Impl.hpp @@ -31,7 +31,7 @@ /// Declaration of Diligent::SwapChainD3D11Impl class #include "SwapChainD3D11.h" -#include "SwapChainD3DBase.h" +#include "SwapChainD3DBase.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h b/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.hpp index 0be21f90..7ffcb7ba 100644 --- a/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/Texture1D_D3D11.hpp @@ -30,7 +30,7 @@ /// \file /// Declaration of Diligent::Texture1D_D3D11 class -#include "TextureBaseD3D11.h" +#include "TextureBaseD3D11.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h b/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.hpp index 6c8d41f0..5df66c0c 100644 --- a/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/Texture2D_D3D11.hpp @@ -30,7 +30,7 @@ /// \file /// Declaration of Diligent::Texture2D_D3D11 class -#include "TextureBaseD3D11.h" +#include "TextureBaseD3D11.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h b/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.hpp index 9ae638a1..b7e1710f 100644 --- a/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/Texture3D_D3D11.hpp @@ -30,7 +30,7 @@ /// \file /// Declaration of Diligent::Texture3D_D3D11 class -#include "TextureBaseD3D11.h" +#include "TextureBaseD3D11.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h b/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.hpp index ece4e088..c954f844 100644 --- a/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.h +++ b/Graphics/GraphicsEngineD3D11/include/TextureBaseD3D11.hpp @@ -32,9 +32,9 @@ #include "TextureD3D11.h" #include "RenderDeviceD3D11.h" -#include "TextureBase.h" -#include "TextureViewD3D11Impl.h" -#include "RenderDeviceD3D11Impl.h" +#include "TextureBase.hpp" +#include "TextureViewD3D11Impl.hpp" +#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.hpp index 0b104597..20c2afbf 100644 --- a/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/TextureViewD3D11Impl.hpp @@ -32,8 +32,8 @@ #include "TextureViewD3D11.h" #include "RenderDeviceD3D11.h" -#include "TextureViewBase.h" -#include "RenderDeviceD3D11Impl.h" +#include "TextureViewBase.hpp" +#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/include/pch.h b/Graphics/GraphicsEngineD3D11/include/pch.h index bbc00ae1..ea2eab2f 100644 --- a/Graphics/GraphicsEngineD3D11/include/pch.h +++ b/Graphics/GraphicsEngineD3D11/include/pch.h @@ -74,8 +74,8 @@ #include "Errors.h" #include "RefCntAutoPtr.h" #include "DebugUtilities.h" -#include "D3DErrors.h" -#include "RenderDeviceBase.h" +#include "D3DErrors.hpp" +#include "RenderDeviceBase.hpp" #include "D3D11TypeConversions.h" #include "ValidatedCast.h" #include <atlcomcli.h> diff --git a/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp index 02235237..2d2d10b5 100644 --- a/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/BufferD3D11Impl.cpp @@ -28,11 +28,11 @@ #include "pch.h" #include <atlbase.h> -#include "BufferD3D11Impl.h" -#include "RenderDeviceD3D11Impl.h" -#include "DeviceContextD3D11Impl.h" +#include "BufferD3D11Impl.hpp" +#include "RenderDeviceD3D11Impl.hpp" +#include "DeviceContextD3D11Impl.hpp" #include "D3D11TypeConversions.h" -#include "BufferViewD3D11Impl.h" +#include "BufferViewD3D11Impl.hpp" #include "GraphicsAccessories.hpp" #include "EngineMemory.h" diff --git a/Graphics/GraphicsEngineD3D11/src/BufferViewD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/BufferViewD3D11Impl.cpp index ff78e3dc..e02bd8ff 100644 --- a/Graphics/GraphicsEngineD3D11/src/BufferViewD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/BufferViewD3D11Impl.cpp @@ -26,7 +26,7 @@ */ #include "pch.h" -#include "BufferViewD3D11Impl.h" +#include "BufferViewD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp index 27981375..39eb87bd 100644 --- a/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/CommandListD3D11Impl.cpp @@ -28,7 +28,7 @@ #include "pch.h" #include <atlbase.h> -#include "CommandListD3D11Impl.h" +#include "CommandListD3D11Impl.hpp" #include "EngineMemory.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/D3D11TypeConversions.cpp b/Graphics/GraphicsEngineD3D11/src/D3D11TypeConversions.cpp index 59a937b5..0d76db58 100644 --- a/Graphics/GraphicsEngineD3D11/src/D3D11TypeConversions.cpp +++ b/Graphics/GraphicsEngineD3D11/src/D3D11TypeConversions.cpp @@ -29,8 +29,8 @@ #include "D3D11TypeConversions.h" #include "D3D11TypeDefinitions.h" -#include "D3DTypeConversionImpl.h" -#include "D3DViewDescConversionImpl.h" +#include "D3DTypeConversionImpl.hpp" +#include "D3DViewDescConversionImpl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index 78f08bf4..0c19756c 100755 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -26,22 +26,22 @@ */
#include "pch.h"
-#include "DeviceContextD3D11Impl.h"
-#include "BufferD3D11Impl.h"
-#include "ShaderD3D11Impl.h"
-#include "Texture1D_D3D11.h"
-#include "Texture2D_D3D11.h"
-#include "Texture3D_D3D11.h"
-#include "SamplerD3D11Impl.h"
+#include "DeviceContextD3D11Impl.hpp"
+#include "BufferD3D11Impl.hpp"
+#include "ShaderD3D11Impl.hpp"
+#include "Texture1D_D3D11.hpp"
+#include "Texture2D_D3D11.hpp"
+#include "Texture3D_D3D11.hpp"
+#include "SamplerD3D11Impl.hpp"
#include "D3D11TypeConversions.h"
-#include "TextureViewD3D11Impl.h"
-#include "PipelineStateD3D11Impl.h"
-#include "ShaderResourceBindingD3D11Impl.h"
+#include "TextureViewD3D11Impl.hpp"
+#include "PipelineStateD3D11Impl.hpp"
+#include "ShaderResourceBindingD3D11Impl.hpp"
#include "EngineD3D11Defines.h"
-#include "CommandListD3D11Impl.h"
-#include "RenderDeviceD3D11Impl.h"
-#include "FenceD3D11Impl.h"
-#include "QueryD3D11Impl.h"
+#include "CommandListD3D11Impl.hpp"
+#include "RenderDeviceD3D11Impl.hpp"
+#include "FenceD3D11Impl.hpp"
+#include "QueryD3D11Impl.hpp"
namespace Diligent
{
diff --git a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp index 623dde46..252697bd 100644 --- a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp @@ -30,12 +30,12 @@ #include "pch.h" #include "EngineFactoryD3D11.h" -#include "RenderDeviceD3D11Impl.h" -#include "DeviceContextD3D11Impl.h" -#include "SwapChainD3D11Impl.h" +#include "RenderDeviceD3D11Impl.hpp" +#include "DeviceContextD3D11Impl.hpp" +#include "SwapChainD3D11Impl.hpp" #include "D3D11TypeConversions.h" #include "EngineMemory.h" -#include "EngineFactoryD3DBase.h" +#include "EngineFactoryD3DBase.hpp" #include <Windows.h> #include <dxgi1_2.h> diff --git a/Graphics/GraphicsEngineD3D11/src/FenceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/FenceD3D11Impl.cpp index 9a651121..3cb1b91e 100644 --- a/Graphics/GraphicsEngineD3D11/src/FenceD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/FenceD3D11Impl.cpp @@ -28,7 +28,7 @@ #include "pch.h" #include <atlbase.h> -#include "FenceD3D11Impl.h" +#include "FenceD3D11Impl.hpp" #include "EngineMemory.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp index 7cc5313d..02f0dac8 100644 --- a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp @@ -27,11 +27,11 @@ #include "pch.h" #include <array> -#include "PipelineStateD3D11Impl.h" -#include "RenderDeviceD3D11Impl.h" -#include "ShaderResourceBindingD3D11Impl.h" +#include "PipelineStateD3D11Impl.hpp" +#include "RenderDeviceD3D11Impl.hpp" +#include "ShaderResourceBindingD3D11Impl.hpp" #include "EngineMemory.h" -#include "ShaderD3D11Impl.h" +#include "ShaderD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/src/QueryD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/QueryD3D11Impl.cpp index 751810de..bf70dfc1 100644 --- a/Graphics/GraphicsEngineD3D11/src/QueryD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/QueryD3D11Impl.cpp @@ -27,8 +27,8 @@ #include "pch.h" -#include "QueryD3D11Impl.h" -#include "DeviceContextD3D11Impl.h" +#include "QueryD3D11Impl.hpp" +#include "DeviceContextD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp index b7e7a0bc..bcd9bec6 100644 --- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp @@ -26,20 +26,20 @@ */ #include "pch.h" -#include "RenderDeviceD3D11Impl.h" -#include "DeviceContextD3D11Impl.h" -#include "BufferD3D11Impl.h" -#include "ShaderD3D11Impl.h" -#include "Texture1D_D3D11.h" -#include "Texture2D_D3D11.h" -#include "Texture3D_D3D11.h" -#include "SamplerD3D11Impl.h" +#include "RenderDeviceD3D11Impl.hpp" +#include "DeviceContextD3D11Impl.hpp" +#include "BufferD3D11Impl.hpp" +#include "ShaderD3D11Impl.hpp" +#include "Texture1D_D3D11.hpp" +#include "Texture2D_D3D11.hpp" +#include "Texture3D_D3D11.hpp" +#include "SamplerD3D11Impl.hpp" #include "D3D11TypeConversions.h" -#include "TextureViewD3D11Impl.h" -#include "PipelineStateD3D11Impl.h" -#include "ShaderResourceBindingD3D11Impl.h" -#include "FenceD3D11Impl.h" -#include "QueryD3D11Impl.h" +#include "TextureViewD3D11Impl.hpp" +#include "PipelineStateD3D11Impl.hpp" +#include "ShaderResourceBindingD3D11Impl.hpp" +#include "FenceD3D11Impl.hpp" +#include "QueryD3D11Impl.hpp" #include "EngineMemory.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp index c5166c27..6d23f951 100644 --- a/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/SamplerD3D11Impl.cpp @@ -26,8 +26,8 @@ */ #include "pch.h" -#include "SamplerD3D11Impl.h" -#include "RenderDeviceD3D11Impl.h" +#include "SamplerD3D11Impl.hpp" +#include "RenderDeviceD3D11Impl.hpp" #include "D3D11TypeConversions.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp index 8cf31521..b5b0194f 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderD3D11Impl.cpp @@ -27,8 +27,8 @@ #include "pch.h" -#include "ShaderD3D11Impl.h" -#include "RenderDeviceD3D11Impl.h" +#include "ShaderD3D11Impl.hpp" +#include "RenderDeviceD3D11Impl.hpp" #include "ResourceMapping.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp index 96acdd01..7af06af3 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp @@ -26,10 +26,10 @@ */ #include "pch.h" -#include "ShaderResourceBindingD3D11Impl.h" -#include "PipelineStateD3D11Impl.h" -#include "DeviceContextD3D11Impl.h" -#include "RenderDeviceD3D11Impl.h" +#include "ShaderResourceBindingD3D11Impl.hpp" +#include "PipelineStateD3D11Impl.hpp" +#include "DeviceContextD3D11Impl.hpp" +#include "RenderDeviceD3D11Impl.hpp" namespace Diligent { diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp index a98653eb..2286d65e 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp @@ -27,11 +27,11 @@ #include "pch.h"
-#include "ShaderResourceCacheD3D11.h"
-#include "ShaderResourceLayoutD3D11.h"
-#include "TextureBaseD3D11.h"
-#include "BufferD3D11Impl.h"
-#include "SamplerD3D11Impl.h"
+#include "ShaderResourceCacheD3D11.hpp"
+#include "ShaderResourceLayoutD3D11.hpp"
+#include "TextureBaseD3D11.hpp"
+#include "BufferD3D11Impl.hpp"
+#include "SamplerD3D11Impl.hpp"
#include "MemoryAllocator.h"
namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index c13f6fd8..741b5692 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -29,15 +29,15 @@ #include <d3dcompiler.h>
-#include "ShaderResourceLayoutD3D11.h"
-#include "ShaderResourceCacheD3D11.h"
-#include "BufferD3D11Impl.h"
-#include "BufferViewD3D11Impl.h"
-#include "TextureBaseD3D11.h"
+#include "ShaderResourceLayoutD3D11.hpp"
+#include "ShaderResourceCacheD3D11.hpp"
+#include "BufferD3D11Impl.hpp"
+#include "BufferViewD3D11Impl.hpp"
+#include "TextureBaseD3D11.hpp"
#include "TextureViewD3D11.h"
-#include "SamplerD3D11Impl.h"
-#include "ShaderD3D11Impl.h"
-#include "ShaderResourceVariableBase.h"
+#include "SamplerD3D11Impl.hpp"
+#include "ShaderD3D11Impl.hpp"
+#include "ShaderResourceVariableBase.hpp"
namespace Diligent
{
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp index 6ca61897..e39830aa 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp @@ -28,10 +28,10 @@ #include "pch.h"
#include <d3dcompiler.h>
-#include "ShaderResourcesD3D11.h"
-#include "ShaderBase.h"
-#include "ShaderResourceCacheD3D11.h"
-#include "RenderDeviceD3D11Impl.h"
+#include "ShaderResourcesD3D11.hpp"
+#include "ShaderBase.hpp"
+#include "ShaderResourceCacheD3D11.hpp"
+#include "RenderDeviceD3D11Impl.hpp"
namespace Diligent
{
diff --git a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp index 537064e5..0beb5eb8 100644 --- a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp @@ -26,9 +26,9 @@ */ #include "pch.h" -#include "SwapChainD3D11Impl.h" -#include "RenderDeviceD3D11Impl.h" -#include "DeviceContextD3D11Impl.h" +#include "SwapChainD3D11Impl.hpp" +#include "RenderDeviceD3D11Impl.hpp" +#include "DeviceContextD3D11Impl.hpp" #include <dxgi1_2.h> namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/Texture1D_D3D11.cpp b/Graphics/GraphicsEngineD3D11/src/Texture1D_D3D11.cpp index 7f7b63cc..89104a55 100644 --- a/Graphics/GraphicsEngineD3D11/src/Texture1D_D3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/Texture1D_D3D11.cpp @@ -26,8 +26,8 @@ */ #include "pch.h" -#include "Texture1D_D3D11.h" -#include "RenderDeviceD3D11Impl.h" +#include "Texture1D_D3D11.hpp" +#include "RenderDeviceD3D11Impl.hpp" #include "D3D11TypeConversions.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/Texture2D_D3D11.cpp b/Graphics/GraphicsEngineD3D11/src/Texture2D_D3D11.cpp index 2deb84cc..cc36b713 100644 --- a/Graphics/GraphicsEngineD3D11/src/Texture2D_D3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/Texture2D_D3D11.cpp @@ -26,8 +26,8 @@ */ #include "pch.h" -#include "Texture2D_D3D11.h" -#include "RenderDeviceD3D11Impl.h" +#include "Texture2D_D3D11.hpp" +#include "RenderDeviceD3D11Impl.hpp" #include "D3D11TypeConversions.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/Texture3D_D3D11.cpp b/Graphics/GraphicsEngineD3D11/src/Texture3D_D3D11.cpp index 37ad78a9..322043e8 100644 --- a/Graphics/GraphicsEngineD3D11/src/Texture3D_D3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/Texture3D_D3D11.cpp @@ -26,8 +26,8 @@ */ #include "pch.h" -#include "Texture3D_D3D11.h" -#include "RenderDeviceD3D11Impl.h" +#include "Texture3D_D3D11.hpp" +#include "RenderDeviceD3D11Impl.hpp" #include "D3D11TypeConversions.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp index add54b6b..39918856 100644 --- a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp @@ -26,11 +26,11 @@ */ #include "pch.h" -#include "TextureBaseD3D11.h" -#include "RenderDeviceD3D11Impl.h" -#include "DeviceContextD3D11Impl.h" +#include "TextureBaseD3D11.hpp" +#include "RenderDeviceD3D11Impl.hpp" +#include "DeviceContextD3D11Impl.hpp" #include "D3D11TypeConversions.h" -#include "TextureViewD3D11Impl.h" +#include "TextureViewD3D11Impl.hpp" #include "EngineMemory.h" namespace Diligent diff --git a/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp index 6dc63f6a..f6c2d982 100644 --- a/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/TextureViewD3D11Impl.cpp @@ -26,8 +26,8 @@ */ #include "pch.h" -#include "TextureViewD3D11Impl.h" -#include "DeviceContextD3D11Impl.h" +#include "TextureViewD3D11Impl.hpp" +#include "DeviceContextD3D11Impl.hpp" namespace Diligent { |
