From 183f7057e2efac654b2e9684245de8e0edfdcb77 Mon Sep 17 00:00:00 2001 From: kearwood Date: Thu, 15 Sep 2022 20:10:25 -0700 Subject: [PATCH] Added KRPipeline::StageInfo to hold cached SPV reflection information used for dynamic descriptor set and push constant binding. --- kraken/KRPipeline.h | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/kraken/KRPipeline.h b/kraken/KRPipeline.h index 64ddb16..37d55ee 100644 --- a/kraken/KRPipeline.h +++ b/kraken/KRPipeline.h @@ -42,6 +42,8 @@ class KRShader; class KRSurface; class KRRenderPass; +class KRUniformBuffer; +class KRTexture; enum class ModelFormat : __uint8_t; struct SpvReflectShaderModule; @@ -307,7 +309,7 @@ public: private: static const char* KRENGINE_PUSH_CONSTANT_NAMES[]; - struct PushConstantStageInfo + struct PushConstantInfo { int offset[kPushConstantCount]; __uint8_t size[kPushConstantCount]; @@ -315,7 +317,26 @@ private: int bufferSize; VkPipelineLayout layout; }; - PushConstantStageInfo m_pushConstants[static_cast(ShaderStage::ShaderStageCount)]; + + typedef std::vector> DescriptorSetQuery; + typedef std::vector> DescriptorSetBinding; + + struct DescriptorSetInfo + { + DescriptorSetQuery query; + DescriptorSetBinding bindings; + }; + + struct StageInfo + { + StageInfo() + : pushConstants{} + {} + PushConstantInfo pushConstants; + std::vector descriptorSets; + }; + + StageInfo m_stages[static_cast(ShaderStage::ShaderStageCount)]; char m_szKey[256]; @@ -324,4 +345,5 @@ private: VkPipeline m_graphicsPipeline; void initPushConstantStage(ShaderStage stage, const SpvReflectShaderModule* reflection); + void initDescriptorSetStage(ShaderStage stage, const SpvReflectShaderModule* reflection); };