mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-25 15:56:00 +03:00
[PR #3184] [MERGED] vector_alu: Improve handling of mbcnt append/consume patterns #3293
Labels
No labels
Bloodborne
bug
contributor wanted
documentation
enhancement
frontend
good first issue
help wanted
linux
pull-request
question
release
verification progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shadPS4#3293
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/shadps4-emu/shadPS4/pull/3184
Author: @raphaelthegreat
Created: 7/2/2025
Status: ✅ Merged
Merged: 7/3/2025
Merged by: @georgemoralis
Base:
main← Head:mbcnt📝 Commits (2)
28b9189vector_alu: Improve handling of mbcnt append/consume patterns753ca25vk_rasterizer: Always sync DMA buffers📊 Changes
2 files changed (+16 additions, -12 deletions)
View changed files
📝
src/shader_recompiler/frontend/translate/vector_alu.cpp(+15 -11)📝
src/video_core/renderer_vulkan/vk_rasterizer.cpp(+1 -1)📄 Description
This fixes missing grass in Driveclub (CUSA00093)
The existing implementation was written to handle a single pattern of mbcnt before the DS_APPEND instruction
In this case however the DS_APPEND is before the mbcnt pattern (but is same functionality wise as above)
The mbcnt instructions are always in pairs of hi/lo and in general are quite flexible. But they assume the subgroup size is 64 so they are not recompiled literally. Together with DS_APPEND they are used to derive a unique per thread index in a buffer (different from using thread_id as order could be random). DS_APPEND instruction works on per subgroup level, by adding number of active threads of subgroup to the GDS counter, essentially giving a multiple-of-64 base index to all threads. Then each thread executes the mbcnt pair which returns the number of active threads with id less than itself and adds it with the base.
The recompiler translates DS_APPEND into an atomic increment of a storage buffer counter, which already gives the desired unique index, so this pattern is a no-op. On main it was set to zero as per the first pattern to avoid altering the DS_APPEND result. The new handling passes through the initial value of the pattern instead, which has the same effect but works on either case.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.