Move push constant related code from KRPipelnie::bind to its own function, KRPipeline::updatePushConstants
This commit is contained in:
@@ -651,11 +651,8 @@ void KRPipeline::updateDescriptorBinding()
|
|||||||
// Vulkan Refactoring
|
// Vulkan Refactoring
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KRPipeline::bind(KRNode::RenderInfo& ri, const Matrix4& matModel)
|
void KRPipeline::updatePushConstants(KRNode::RenderInfo& ri, const Matrix4& matModel)
|
||||||
{
|
{
|
||||||
updateDescriptorBinding();
|
|
||||||
updateDescriptorSets();
|
|
||||||
bindDescriptorSets(ri.commandBuffer);
|
|
||||||
setPushConstant(PushConstant::absolute_time, getContext().getAbsoluteTime());
|
setPushConstant(PushConstant::absolute_time, getContext().getAbsoluteTime());
|
||||||
|
|
||||||
int light_directional_count = 0;
|
int light_directional_count = 0;
|
||||||
@@ -841,6 +838,14 @@ bool KRPipeline::bind(KRNode::RenderInfo& ri, const Matrix4& matModel)
|
|||||||
vkCmdPushConstants(ri.commandBuffer, pushConstants.layout, VK_SHADER_STAGE_VERTEX_BIT, 0, pushConstants.bufferSize, pushConstants.buffer);
|
vkCmdPushConstants(ri.commandBuffer, pushConstants.layout, VK_SHADER_STAGE_VERTEX_BIT, 0, pushConstants.bufferSize, pushConstants.buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KRPipeline::bind(KRNode::RenderInfo& ri, const Matrix4& matModel)
|
||||||
|
{
|
||||||
|
updateDescriptorBinding();
|
||||||
|
updateDescriptorSets();
|
||||||
|
bindDescriptorSets(ri.commandBuffer);
|
||||||
|
updatePushConstants(ri, matModel);
|
||||||
|
|
||||||
if (ri.pipeline != this) {
|
if (ri.pipeline != this) {
|
||||||
vkCmdBindPipeline(ri.commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphicsPipeline);
|
vkCmdBindPipeline(ri.commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphicsPipeline);
|
||||||
|
|||||||
@@ -306,11 +306,12 @@ public:
|
|||||||
void setImageBinding(const std::string& name, KRTexture* texture, KRSampler* sampler);
|
void setImageBinding(const std::string& name, KRTexture* texture, KRSampler* sampler);
|
||||||
|
|
||||||
VkPipeline& getPipeline();
|
VkPipeline& getPipeline();
|
||||||
void updateDescriptorBinding();
|
|
||||||
void updateDescriptorSets();
|
|
||||||
void bindDescriptorSets(VkCommandBuffer& commandBuffer);
|
void bindDescriptorSets(VkCommandBuffer& commandBuffer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateDescriptorBinding();
|
||||||
|
void updateDescriptorSets();
|
||||||
|
void updatePushConstants(KRNode::RenderInfo& ri, const hydra::Matrix4& matModel);
|
||||||
static const char* KRENGINE_PUSH_CONSTANT_NAMES[];
|
static const char* KRENGINE_PUSH_CONSTANT_NAMES[];
|
||||||
|
|
||||||
struct PushConstantInfo
|
struct PushConstantInfo
|
||||||
|
|||||||
Reference in New Issue
Block a user