From 3948fc345b99465f2d792114d06d0e374465ce3d Mon Sep 17 00:00:00 2001 From: azhirnov Date: Sat, 30 Jan 2021 16:21:53 +0300 Subject: update for vulkan PRS --- .../include/PipelineResourceSignatureBase.hpp | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp index f1634fed..ceb70688 100644 --- a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp @@ -39,6 +39,7 @@ #include "DeviceObjectBase.hpp" #include "RenderDeviceBase.hpp" #include "FixedLinearAllocator.hpp" +#include "BasicMath.hpp" namespace Diligent { @@ -100,6 +101,27 @@ public: return std::pair{m_ResourceOffsets[VarType], m_ResourceOffsets[VarType + 1]}; } + // Returns the number of shader stages that have resources. + Uint32 GetNumActiveShaderStages() const { return m_NumShaderStages; } + + // Returns the type of the active shader stage with the given index. + SHADER_TYPE GetActiveShaderStageType(Uint32 StageIndex) const + { + VERIFY_EXPR(StageIndex < m_NumShaderStages); + + SHADER_TYPE Stages = m_ShaderStages; + for (Uint32 Index = 0; Stages != SHADER_TYPE_UNKNOWN; ++Index) + { + auto StageBit = ExtractLSB(Stages); + + if (Index == StageIndex) + return StageBit; + } + + UNEXPECTED("Index is out of range"); + return SHADER_TYPE_UNKNOWN; + } + protected: void ReserveSpaceForDescription(FixedLinearAllocator& Allocator, const PipelineResourceSignatureDesc& Desc) const noexcept(false) { @@ -252,10 +274,16 @@ protected: protected: size_t m_Hash = 0; + // Shader stages that have resources. + SHADER_TYPE m_ShaderStages = SHADER_TYPE_UNKNOWN; + std::array m_ResourceOffsets = {}; PIPELINE_TYPE m_PipelineType = PIPELINE_TYPE_INVALID; + // The number of shader stages that have resources. + Uint8 m_NumShaderStages = 0; // AZ TODO: remove ? + #ifdef DILIGENT_DEBUG bool m_IsDestructed = false; #endif -- cgit v1.2.3