Browse Source

[vk] Fix dynamic vertex input state handling

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.
pull/295/head
Shinmegumi 7 months ago
committed by crueter
parent
commit
a54ccec6f7
  1. 3
      src/video_core/renderer_vulkan/vk_graphics_pipeline.h
  2. 5
      src/video_core/renderer_vulkan/vk_rasterizer.cpp

3
src/video_core/renderer_vulkan/vk_graphics_pipeline.h

@ -80,7 +80,8 @@ public:
PipelineStatistics* pipeline_statistics, RenderPassCache& render_pass_cache, PipelineStatistics* pipeline_statistics, RenderPassCache& render_pass_cache,
const GraphicsPipelineCacheKey& key, std::array<vk::ShaderModule, NUM_STAGES> stages, const GraphicsPipelineCacheKey& key, std::array<vk::ShaderModule, NUM_STAGES> stages,
const std::array<const Shader::Info*, NUM_STAGES>& infos); 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& operator=(GraphicsPipeline&&) noexcept = delete;
GraphicsPipeline(GraphicsPipeline&&) noexcept = delete; GraphicsPipeline(GraphicsPipeline&&) noexcept = delete;

5
src/video_core/renderer_vulkan/vk_rasterizer.cpp

@ -1002,7 +1002,10 @@ void RasterizerVulkan::UpdateDynamicStates() {
} }
} }
if (features.has_dynamic_vertex_input) { if (features.has_dynamic_vertex_input) {
UpdateVertexInput(regs);
if (auto* gp = pipeline_cache.CurrentGraphicsPipeline();
gp && gp->HasDynamicVertexInput()) {
UpdateVertexInput(regs);
}
} }
} }

Loading…
Cancel
Save