From e4d4b58af6aedc7a0bffd821d86947f3b7c8b937 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 24 Aug 2018 21:30:56 -0700 Subject: Fixed https://github.com/DiligentGraphics/DiligentCore/issues/16 (Rework D3D12 shader resource layout to use shader variable manager) --- .../GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h | 4 ++-- Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.h | 7 +++---- Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h b/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h index 23264799..6ebea962 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h @@ -39,7 +39,7 @@ namespace Diligent class FixedBlockMemoryAllocator; /// Implementation of the Diligent::IShaderResourceBindingVk interface -// sizeof(ShaderResourceBindingVkImpl) == 80 (x64, msvc, Release) +// sizeof(ShaderResourceBindingVkImpl) == 72 (x64, msvc, Release) class ShaderResourceBindingVkImpl final : public ShaderResourceBindingBase { public: @@ -70,7 +70,7 @@ private: // Shader variable manager index in m_pShaderVarMgrs[] array for every shader stage Int8 m_ResourceLayoutIndex[6] = {-1, -1, -1, -1, -1, -1}; bool m_bStaticResourcesInitialized = false; - Uint32 m_NumShaders = 0; + Uint8 m_NumShaders = 0; }; } diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.h b/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.h index 5071b857..4681da82 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.h @@ -35,7 +35,7 @@ // // __________________________ __________________________________________________________________________ // | | | | | | -// ----| ShaderVariableManagerVk |---------------->| ShaderVariableVkImpl[0] | ShaderVariableVkImpl[1] | ... | +// .----| ShaderVariableManagerVk |---------------->| ShaderVariableVkImpl[0] | ShaderVariableVkImpl[1] | ... | // | |__________________________| |___________________________|____________________________|_________________| // | | \ | // | | Ref Ref @@ -50,13 +50,12 @@ // | \ / // | __________________________ ________V_______________________________________________________V_______ // | | | | | -// --->| ShaderResourceCacheVk |---------------->| Resources | +// '--->| ShaderResourceCacheVk |---------------->| Resources | // |__________________________| |________________________________________________________________________| // // #include -#include #include "ShaderResourceLayoutVk.h" @@ -101,7 +100,7 @@ private: IObject& m_Owner; // Variable mgr is owned by either Shader object (in which case m_pResourceLayout points to // static resource layout owned by the same shader object), or by SRB object (in which case - // m_pResourceLayout point to corresponding layout in pipeline state). Since SRB keeps strong + // m_pResourceLayout points to corresponding layout in pipeline state). Since SRB keeps strong // reference to PSO, the layout is guaranteed be alive while SRB is alive const ShaderResourceLayoutVk* m_pResourceLayout= nullptr; ShaderResourceCacheVk* m_pResourceCache = nullptr; diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp index f91eea9b..abc033e0 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp @@ -36,7 +36,7 @@ ShaderResourceBindingVkImpl::ShaderResourceBindingVkImpl( IReferenceCounters* pR m_ShaderResourceCache(ShaderResourceCacheVk::DbgCacheContentType::SRBResources) { auto* ppShaders = pPSO->GetShaders(); - m_NumShaders = pPSO->GetNumShaders(); + m_NumShaders = static_cast(pPSO->GetNumShaders()); auto* pRenderDeviceVkImpl = pPSO->GetDevice(); // This will only allocate memory and initialize descriptor sets in the resource cache -- cgit v1.2.3