Added KRPipeline::StageInfo to hold cached SPV reflection information used for dynamic descriptor set and push constant binding.
This commit is contained in:
@@ -42,6 +42,8 @@
|
|||||||
class KRShader;
|
class KRShader;
|
||||||
class KRSurface;
|
class KRSurface;
|
||||||
class KRRenderPass;
|
class KRRenderPass;
|
||||||
|
class KRUniformBuffer;
|
||||||
|
class KRTexture;
|
||||||
|
|
||||||
enum class ModelFormat : __uint8_t;
|
enum class ModelFormat : __uint8_t;
|
||||||
struct SpvReflectShaderModule;
|
struct SpvReflectShaderModule;
|
||||||
@@ -307,7 +309,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
static const char* KRENGINE_PUSH_CONSTANT_NAMES[];
|
static const char* KRENGINE_PUSH_CONSTANT_NAMES[];
|
||||||
|
|
||||||
struct PushConstantStageInfo
|
struct PushConstantInfo
|
||||||
{
|
{
|
||||||
int offset[kPushConstantCount];
|
int offset[kPushConstantCount];
|
||||||
__uint8_t size[kPushConstantCount];
|
__uint8_t size[kPushConstantCount];
|
||||||
@@ -315,7 +317,26 @@ private:
|
|||||||
int bufferSize;
|
int bufferSize;
|
||||||
VkPipelineLayout layout;
|
VkPipelineLayout layout;
|
||||||
};
|
};
|
||||||
PushConstantStageInfo m_pushConstants[static_cast<size_t>(ShaderStage::ShaderStageCount)];
|
|
||||||
|
typedef std::vector<std::pair<VkDescriptorType, std::string>> DescriptorSetQuery;
|
||||||
|
typedef std::vector<std::variant<KRTexture*, KRUniformBuffer*>> DescriptorSetBinding;
|
||||||
|
|
||||||
|
struct DescriptorSetInfo
|
||||||
|
{
|
||||||
|
DescriptorSetQuery query;
|
||||||
|
DescriptorSetBinding bindings;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct StageInfo
|
||||||
|
{
|
||||||
|
StageInfo()
|
||||||
|
: pushConstants{}
|
||||||
|
{}
|
||||||
|
PushConstantInfo pushConstants;
|
||||||
|
std::vector<DescriptorSetInfo> descriptorSets;
|
||||||
|
};
|
||||||
|
|
||||||
|
StageInfo m_stages[static_cast<size_t>(ShaderStage::ShaderStageCount)];
|
||||||
|
|
||||||
char m_szKey[256];
|
char m_szKey[256];
|
||||||
|
|
||||||
@@ -324,4 +345,5 @@ private:
|
|||||||
VkPipeline m_graphicsPipeline;
|
VkPipeline m_graphicsPipeline;
|
||||||
|
|
||||||
void initPushConstantStage(ShaderStage stage, const SpvReflectShaderModule* reflection);
|
void initPushConstantStage(ShaderStage stage, const SpvReflectShaderModule* reflection);
|
||||||
|
void initDescriptorSetStage(ShaderStage stage, const SpvReflectShaderModule* reflection);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user