[PR #1643] [CLOSED] shader: Specialize on vertex input number types if needed. #2217

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/1643
Author: @squidbus
Created: 12/1/2024
Status: Closed

Base: mainHead: vs_in_type


📝 Commits (2)

  • 30b292a shader: Specialize on vertex input number types if needed.
  • b9b488f shader_recompiler: Use number format helpers more

📊 Changes

10 files changed (+84 additions, -33 deletions)

View changed files

📝 src/shader_recompiler/backend/spirv/spirv_emit_context.cpp (+10 -24)
📝 src/shader_recompiler/info.h (+4 -0)
📝 src/shader_recompiler/profile.h (+1 -0)
📝 src/shader_recompiler/specialization.h (+32 -2)
📝 src/video_core/amdgpu/pixel_format.h (+17 -0)
📝 src/video_core/buffer_cache/buffer_cache.cpp (+1 -1)
📝 src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp (+1 -2)
📝 src/video_core/renderer_vulkan/vk_instance.cpp (+7 -0)
📝 src/video_core/renderer_vulkan/vk_instance.h (+7 -0)
📝 src/video_core/renderer_vulkan/vk_pipeline_cache.cpp (+4 -4)

📄 Description

According to Vulkan spec the vertex inputs should have number type classes (float, uint, int) matching those in the shader. This adds specialization to match that.

For drivers with VK_EXT_legacy_vertex_attributes support, this can be skipped, as it allows mismatched types:

  • Windows: NVIDIA with Proprietary 552.61.0.0+
  • Linux: AMD/NVIDIA/Intel with Mesa 24.2.0+, NVIDIA with Proprietary 550.40.63.0+

Fixes validation errors like:

VUID-vkCmdDrawIndexed-Input-08734: Validation Error: [ VUID-vkCmdDrawIndexed-Input-08734 ] Object 0: handle = 0xc1fcef000000854c, name = vs_0xee67e28b10b611ad_0, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x1c98f0b9 | vkCmdDrawIndexed():  vkCmdSetVertexInputEXT set pVertexAttributeDescriptions[5] (binding 5, location 5) with format VK_FORMAT_R16G16B16A16_SINT but the vertex shader input is numeric type vec4 of float32.

🔄 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/1643 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 12/1/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `vs_in_type` --- ### 📝 Commits (2) - [`30b292a`](https://github.com/shadps4-emu/shadPS4/commit/30b292a787f282d4fd494dfdf3a7a1f4aaa2fc5d) shader: Specialize on vertex input number types if needed. - [`b9b488f`](https://github.com/shadps4-emu/shadPS4/commit/b9b488fbc9aa2b04efef48f84e867faaab50b357) shader_recompiler: Use number format helpers more ### 📊 Changes **10 files changed** (+84 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `src/shader_recompiler/backend/spirv/spirv_emit_context.cpp` (+10 -24) 📝 `src/shader_recompiler/info.h` (+4 -0) 📝 `src/shader_recompiler/profile.h` (+1 -0) 📝 `src/shader_recompiler/specialization.h` (+32 -2) 📝 `src/video_core/amdgpu/pixel_format.h` (+17 -0) 📝 `src/video_core/buffer_cache/buffer_cache.cpp` (+1 -1) 📝 `src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp` (+1 -2) 📝 `src/video_core/renderer_vulkan/vk_instance.cpp` (+7 -0) 📝 `src/video_core/renderer_vulkan/vk_instance.h` (+7 -0) 📝 `src/video_core/renderer_vulkan/vk_pipeline_cache.cpp` (+4 -4) </details> ### 📄 Description According to Vulkan spec the vertex inputs should have number type classes (float, uint, int) matching those in the shader. This adds specialization to match that. For drivers with `VK_EXT_legacy_vertex_attributes` support, this can be skipped, as it allows mismatched types: * Windows: NVIDIA with Proprietary 552.61.0.0+ * Linux: AMD/NVIDIA/Intel with Mesa 24.2.0+, NVIDIA with Proprietary 550.40.63.0+ Fixes validation errors like: ``` VUID-vkCmdDrawIndexed-Input-08734: Validation Error: [ VUID-vkCmdDrawIndexed-Input-08734 ] Object 0: handle = 0xc1fcef000000854c, name = vs_0xee67e28b10b611ad_0, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x1c98f0b9 | vkCmdDrawIndexed(): vkCmdSetVertexInputEXT set pVertexAttributeDescriptions[5] (binding 5, location 5) with format VK_FORMAT_R16G16B16A16_SINT but the vertex shader input is numeric type vec4 of float32. ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:15: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#2217
No description provided.