summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorazhirnov <zh1dron@gmail.com>2021-01-30 13:21:53 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-02-04 04:58:27 +0000
commit3948fc345b99465f2d792114d06d0e374465ce3d (patch)
tree7e6846c123c4680498457a561b8e5f1c92bc9aa7 /Graphics
parentSome refactoring of DXBCUtils (diff)
downloadDiligentCore-3948fc345b99465f2d792114d06d0e374465ce3d.tar.gz
DiligentCore-3948fc345b99465f2d792114d06d0e374465ce3d.zip
update for vulkan PRS
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp28
-rw-r--r--Graphics/GraphicsEngineVulkan/include/PipelineLayoutVk.hpp10
2 files changed, 36 insertions, 2 deletions
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<Uint32, Uint32>{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<Uint16, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES + 1> 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
diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineLayoutVk.hpp b/Graphics/GraphicsEngineVulkan/include/PipelineLayoutVk.hpp
index 72b6f6ef..eed3507d 100644
--- a/Graphics/GraphicsEngineVulkan/include/PipelineLayoutVk.hpp
+++ b/Graphics/GraphicsEngineVulkan/include/PipelineLayoutVk.hpp
@@ -61,10 +61,16 @@ public:
}
// Returns the index of the first descriptor set used by the given resource signature
- Uint32 GetFirstDescrSetIndex(const IPipelineResourceSignature* pPRS) const
+ Uint32 GetFirstDescrSetIndex(const PipelineResourceSignatureVkImpl* pPRS) const
{
+ VERIFY_EXPR(pPRS != nullptr);
Uint32 Index = pPRS->GetDesc().BindingIndex;
- return Index < m_SignatureCount ? m_FirstDescrSetIndex[Index] : ~0u;
+
+ VERIFY_EXPR(Index < m_SignatureCount);
+ VERIFY_EXPR(m_Signatures[Index] != nullptr);
+ VERIFY_EXPR(!m_Signatures[Index]->IsIncompatibleWith(*pPRS));
+
+ return m_FirstDescrSetIndex[Index];
}
struct ResourceInfo