[PR #1164] [MERGED] vulkan: Use dynamic vertex buffer strides when dynamic bindings unavailable. #1962

Closed
opened 2026-02-27 21:14:38 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/1164
Author: @squidbus
Created: 9/30/2024
Status: Merged
Merged: 10/1/2024
Merged by: @georgemoralis

Base: mainHead: fix-vertex


📝 Commits (1)

  • 7af9cb6 vulkan: Use dynamic vertex buffer strides when dynamic bindings unavailable.

📊 Changes

7 files changed (+65 additions, -26 deletions)

View changed files

📝 CMakeLists.txt (+1 -1)
📝 README.md (+1 -1)
📝 src/video_core/buffer_cache/buffer_cache.cpp (+10 -1)
📝 src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp (+30 -22)
📝 src/video_core/renderer_vulkan/vk_graphics_pipeline.h (+1 -0)
📝 src/video_core/renderer_vulkan/vk_instance.cpp (+1 -0)
📝 src/video_core/renderer_vulkan/vk_pipeline_cache.cpp (+21 -1)

📄 Description

Currently when VK_EXT_vertex_input_dynamic_state is unsupported, the fallback fixed vertex bindings in the pipeline are not updated when user data affects the definition of the buffer by changing the stride or format. This is the root cause of a lot of vertex explosions and corrupted graphics on drivers like MoltenVK, across many games.

Instead, we can take a two-part approach:

  • For changing stride, use dynamic vertex input stride from VK_EXT_extended_dynamic_state, which is supported on MoltenVK and any Vulkan 1.3 driver.
  • For changing format, add the binding formats into the graphics key to create new pipelines.

This necessitates a minimum macOS version bump to 14, as dynamic vertex binding stride is not supported before Metal 3.1, which was introduced with macOS 14. Apple Silicon Macs already require 15, so this just affects some older Intel Macs that cannot upgrade to 14. I'm not sure how well this worked on those older models to begin with as I have never tested them, but guaranteeing higher Metal version support will make things a lot easier in general.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/1164 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 9/30/2024 **Status:** ✅ Merged **Merged:** 10/1/2024 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `fix-vertex` --- ### 📝 Commits (1) - [`7af9cb6`](https://github.com/shadps4-emu/shadPS4/commit/7af9cb60c19ecc539c2b152523525e6b9b340933) vulkan: Use dynamic vertex buffer strides when dynamic bindings unavailable. ### 📊 Changes **7 files changed** (+65 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+1 -1) 📝 `README.md` (+1 -1) 📝 `src/video_core/buffer_cache/buffer_cache.cpp` (+10 -1) 📝 `src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp` (+30 -22) 📝 `src/video_core/renderer_vulkan/vk_graphics_pipeline.h` (+1 -0) 📝 `src/video_core/renderer_vulkan/vk_instance.cpp` (+1 -0) 📝 `src/video_core/renderer_vulkan/vk_pipeline_cache.cpp` (+21 -1) </details> ### 📄 Description Currently when `VK_EXT_vertex_input_dynamic_state` is unsupported, the fallback fixed vertex bindings in the pipeline are not updated when user data affects the definition of the buffer by changing the stride or format. This is the root cause of a lot of vertex explosions and corrupted graphics on drivers like MoltenVK, across many games. Instead, we can take a two-part approach: * For changing stride, use dynamic vertex input stride from `VK_EXT_extended_dynamic_state`, which is supported on MoltenVK and any Vulkan 1.3 driver. * For changing format, add the binding formats into the graphics key to create new pipelines. This necessitates a minimum macOS version bump to 14, as dynamic vertex binding stride is not supported before Metal 3.1, which was introduced with macOS 14. Apple Silicon Macs already require 15, so this just affects some older Intel Macs that cannot upgrade to 14. I'm not sure how well this worked on those older models to begin with as I have never tested them, but guaranteeing higher Metal version support will make things a lot easier in general. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:14:38 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#1962
No description provided.