Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

[vk] Fix dynamic vertex input state handling (#295)

Shinmegumieb72a358e3d8
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h
index 7e9dbb583a..650c8e07ed 100644
--- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.h
+++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.h
@@ -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;
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 9ce5ea60a4..2d12fc658f 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -1002,7 +1002,10 @@ void RasterizerVulkan::UpdateDynamicStates() {
}
}
if (features.has_dynamic_vertex_input) {
- UpdateVertexInput(regs);
+ if (auto* gp = pipeline_cache.CurrentGraphicsPipeline();
+ gp && gp->HasDynamicVertexInput()) {
+ UpdateVertexInput(regs);
+ }
}
}