[PR #1029] [CLOSED] Remove dead vs inputs in spir-v, and don't bind corresponding vbo #1890

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/1029
Author: @baggins183
Created: 9/22/2024
Status: Closed

Base: mainHead: dead-vs-inputs


📝 Commits (2)

  • 5c5f956 Remove dead vs inputs in spir-v, and don't bind corresponding vbo
  • 946a94c remove warning

📊 Changes

2 files changed (+16 additions, -8 deletions)

View changed files

📝 src/shader_recompiler/backend/spirv/spirv_emit_context.cpp (+4 -0)
📝 src/video_core/buffer_cache/buffer_cache.cpp (+12 -8)

📄 Description

Fixes a validation error about vkCmdSetVertexInputEXT(). If the V#
corresponding to an input semantic has size 0, BindVertexBuffers() won't
bind any buffer and wont add vulkan BindingInfo/AttributeInfo for that semantic.
Detect and remove dead vs inputs from the vs spirv so there aren't spirv Input vars without vertex input info.

Ideally when the buffer is empty, the spirv attribute should be dead.
Seen this happen because of empty V#s with dst_sel == 0001

example
[Render.Vulkan] [thread GPU_CommandProc, tid=456257] vk_platform.cpp:DebugUtilsCallback:68: VUID-vkCmdDrawIndexed-Input-07939: Validation Error: [ VUID-vkCmdDrawIndexed-Input-07939 ] Object 0: handle = 0xe5f5e400000015b9, name = vs_0x9e267629561c22fe_0, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x8d9172cc | vkCmdDrawIndexed(): Vertex shader uses input at location 4, but it was not provided with vkCmdSetVertexInputEXT(). The Vulkan spec states: If there is a shader object bound to the VK_SHADER_STAGE_VERTEX_BIT stage or the bound graphics pipeline state was created with the VK_DYNAMIC_STATE_VERTEX_INPUT_EXT dynamic state enabled then all variables with the Input storage class decorated with Location in the Vertex Execution Model OpEntryPoint must contain a location in VkVertexInputAttributeDescription2EXT::location (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDrawIndexed-Input-07939)


🔄 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/1029 **Author:** [@baggins183](https://github.com/baggins183) **Created:** 9/22/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `dead-vs-inputs` --- ### 📝 Commits (2) - [`5c5f956`](https://github.com/shadps4-emu/shadPS4/commit/5c5f956a901732821159370885dd671491b1cef0) Remove dead vs inputs in spir-v, and don't bind corresponding vbo - [`946a94c`](https://github.com/shadps4-emu/shadPS4/commit/946a94c4bfd658385031fb4a0ebe27e457bcec50) remove warning ### 📊 Changes **2 files changed** (+16 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/shader_recompiler/backend/spirv/spirv_emit_context.cpp` (+4 -0) 📝 `src/video_core/buffer_cache/buffer_cache.cpp` (+12 -8) </details> ### 📄 Description Fixes a validation error about vkCmdSetVertexInputEXT(). If the V# corresponding to an input semantic has size 0, BindVertexBuffers() won't bind any buffer and wont add vulkan BindingInfo/AttributeInfo for that semantic. Detect and remove dead vs inputs from the vs spirv so there aren't spirv Input vars without vertex input info. Ideally when the buffer is empty, the spirv attribute should be dead. Seen this happen because of empty V#s with dst_sel == 0001 example [Render.Vulkan] <Error> [thread GPU_CommandProc, tid=456257] vk_platform.cpp:DebugUtilsCallback:68: VUID-vkCmdDrawIndexed-Input-07939: Validation Error: [ VUID-vkCmdDrawIndexed-Input-07939 ] Object 0: handle = 0xe5f5e400000015b9, name = vs_0x9e267629561c22fe_0, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x8d9172cc | vkCmdDrawIndexed(): Vertex shader uses input at location 4, but it was not provided with vkCmdSetVertexInputEXT(). The Vulkan spec states: If there is a shader object bound to the VK_SHADER_STAGE_VERTEX_BIT stage or the bound graphics pipeline state was created with the VK_DYNAMIC_STATE_VERTEX_INPUT_EXT dynamic state enabled then all variables with the Input storage class decorated with Location in the Vertex Execution Model OpEntryPoint must contain a location in VkVertexInputAttributeDescription2EXT::location (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDrawIndexed-Input-07939) --- <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:20 +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#1890
No description provided.