[PR #3064] [MERGED] shader_recompiler: Better handling of geometry shader scenario G #3190

Closed
opened 2026-02-27 22:02:46 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3064
Author: @raphaelthegreat
Created: 6/8/2025
Status: Merged
Merged: 6/9/2025
Merged by: @squidbus

Base: mainHead: gs-scenario


📝 Commits (1)

  • 3068a48 shader_recompiler: Better handling of geometry shader scenario G

📊 Changes

8 files changed (+33 additions, -4 deletions)

View changed files

📝 src/shader_recompiler/frontend/copy_shader.cpp (+3 -0)
📝 src/shader_recompiler/frontend/copy_shader.h (+3 -2)
📝 src/shader_recompiler/frontend/translate/translate.h (+1 -0)
📝 src/shader_recompiler/ir/passes/readlane_elimination_pass.cpp (+1 -0)
📝 src/shader_recompiler/ir/passes/ring_access_elimination.cpp (+14 -1)
📝 src/shader_recompiler/runtime_info.h (+1 -0)
📝 src/video_core/amdgpu/liverpool.h (+9 -1)
📝 src/video_core/renderer_vulkan/vk_pipeline_cache.cpp (+1 -0)

📄 Description

The sea islands register reference mentions 2 different behaviors for VGT_GS_MAX_VERT_OUT. For Scenario C it represents the actual amount of output vertices a GS will make. For Scenario G on the other hand it represents the maximum, so it can't always be used for mapping offset to attribute, as the actual component stride might be smaller.

This fixes a crash when compiling a geometry shader in Driveclub (CUSA00093) which "lies" about the number of vertices it outputs. While the actual number is 4, the register reports a much larger number (44). Instead attempt to compute the output vertices from the copy shader and if they mismatch do some validation checks and use that instead. I've also added a warning in case this regresses any other geoshaders, so it can be seen easily

Oops wrong branch


🔄 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/3064 **Author:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Created:** 6/8/2025 **Status:** ✅ Merged **Merged:** 6/9/2025 **Merged by:** [@squidbus](https://github.com/squidbus) **Base:** `main` ← **Head:** `gs-scenario` --- ### 📝 Commits (1) - [`3068a48`](https://github.com/shadps4-emu/shadPS4/commit/3068a483ef0fca859266f3eea22df443f910502e) shader_recompiler: Better handling of geometry shader scenario G ### 📊 Changes **8 files changed** (+33 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/shader_recompiler/frontend/copy_shader.cpp` (+3 -0) 📝 `src/shader_recompiler/frontend/copy_shader.h` (+3 -2) 📝 `src/shader_recompiler/frontend/translate/translate.h` (+1 -0) 📝 `src/shader_recompiler/ir/passes/readlane_elimination_pass.cpp` (+1 -0) 📝 `src/shader_recompiler/ir/passes/ring_access_elimination.cpp` (+14 -1) 📝 `src/shader_recompiler/runtime_info.h` (+1 -0) 📝 `src/video_core/amdgpu/liverpool.h` (+9 -1) 📝 `src/video_core/renderer_vulkan/vk_pipeline_cache.cpp` (+1 -0) </details> ### 📄 Description The sea islands register reference mentions 2 different behaviors for VGT_GS_MAX_VERT_OUT. For Scenario C it represents the actual amount of output vertices a GS will make. For Scenario G on the other hand it represents the maximum, so it can't always be used for mapping offset to attribute, as the actual component stride might be smaller. This fixes a crash when compiling a geometry shader in Driveclub (CUSA00093) which "lies" about the number of vertices it outputs. While the actual number is 4, the register reports a much larger number (44). Instead attempt to compute the output vertices from the copy shader and if they mismatch do some validation checks and use that instead. I've also added a warning in case this regresses any other geoshaders, so it can be seen easily ~~Oops wrong branch~~ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:02:46 +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#3190
No description provided.