Eliminate redundant vkCmdBindPipeline calls

This commit is contained in:
2025-07-09 00:23:17 -07:00
parent 9db005c55c
commit 2fc46ece57
2 changed files with 6 additions and 1 deletions

View File

@@ -842,7 +842,10 @@ bool KRPipeline::bind(KRNode::RenderInfo& ri, const Matrix4& matModel)
} }
} }
vkCmdBindPipeline(ri.commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphicsPipeline); if (ri.pipeline != this) {
vkCmdBindPipeline(ri.commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphicsPipeline);
ri.pipeline = this;
}
return true; return true;
} }

View File

@@ -56,6 +56,7 @@ class KRPointLight;
class KRSpotLight; class KRSpotLight;
class KRDirectionalLight; class KRDirectionalLight;
class KRRenderPass; class KRRenderPass;
class KRPipeline;
namespace tinyxml2 { namespace tinyxml2 {
class XMLNode; class XMLNode;
class XMLAttribute; class XMLAttribute;
@@ -92,6 +93,7 @@ public:
std::vector<KRSpotLight*> spot_lights; std::vector<KRSpotLight*> spot_lights;
KRViewport* viewport; KRViewport* viewport;
KRRenderPass* renderPass; KRRenderPass* renderPass;
KRPipeline* pipeline;
}; };
static void InitNodeInfo(KrNodeInfo* nodeInfo); static void InitNodeInfo(KrNodeInfo* nodeInfo);