[vk] Fix dynamic vertex input state handling
All checks were successful
eden-license / license-header (pull_request) Successful in 19s

Previously, UpdateVertexInput() was always called when
has_dynamic_vertex_input was true, even if the current graphics pipeline
was not created with VK_DYNAMIC_STATE_VERTEX_INPUT_EXT. This could lead
to unnecessary or invalid state updates.

This change:
- Adds GraphicsPipeline::HasDynamicVertexInput() to check whether the
  pipeline was created with dynamic vertex input enabled.
- Calls UpdateVertexInput() only when the current pipeline supports
  VK_DYNAMIC_STATE_VERTEX_INPUT_EXT.

This ensures vertex input state updates are applied only when valid,
improving correctness and preventing redundant updates.
This commit is contained in:
Shinmegumi 2025-08-21 21:45:37 +02:00
parent 52379c383d
commit 7571a36993
2 changed files with 6 additions and 2 deletions

View file

@ -80,7 +80,8 @@ public:
PipelineStatistics* pipeline_statistics, RenderPassCache& render_pass_cache,
const GraphicsPipelineCacheKey& key, std::array<vk::ShaderModule, NUM_STAGES> stages,
const std::array<const Shader::Info*, NUM_STAGES>& infos);
// True if this pipeline was created with VK_DYNAMIC_STATE_VERTEX_INPUT_EXT
bool HasDynamicVertexInput() const noexcept { return key.state.dynamic_vertex_input; }
GraphicsPipeline& operator=(GraphicsPipeline&&) noexcept = delete;
GraphicsPipeline(GraphicsPipeline&&) noexcept = delete;

View file

@ -1002,9 +1002,12 @@ void RasterizerVulkan::UpdateDynamicStates() {
}
}
if (features.has_dynamic_vertex_input) {
if (auto* gp = pipeline_cache.CurrentGraphicsPipeline();
gp && gp->HasDynamicVertexInput()) {
UpdateVertexInput(regs);
}
}
}
void RasterizerVulkan::HandleTransformFeedback() {
static std::once_flag warn_unsupported;