shadPS4/src
TheTurtle 48460d1cbe
vector_alu: Improve handling of mbcnt append/consume patterns (#3184)
* vector_alu: Improve handling of mbcnt append/consume patterns

The existing implementation was written to handle a single pattern of mbcnt before the DS_APPEND instruction

v_mbcnt_hi_u32_b32 vX, exec_hi, 0
v_mbcnt_lo_u32_b32 vX, exec_lo, vX
ds_append       vY offset:4 gds
v_add_i32       vX, vcc, vY, vX

In this case however the DS_APPEND is before the mbcnt pattern

ds_append       vX gds
v_mbcnt_hi_u32_b32 vY, exec_hi, vX
v_mbcnt_lo_u32_b32 vZ, exec_lo, vY

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 the 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.

* vk_rasterizer: Always sync DMA buffers
2025-07-03 13:19:38 +03:00
..
common Use shared_first_mutex (#3179) 2025-07-02 16:54:14 +03:00
core Readbacks proof of concept rebased (#3178) 2025-07-01 23:41:00 +03:00
images Favorites in the game list (#2649) (#3071) 2025-06-22 12:53:47 +03:00
imgui devtools: persist fsr configs (#2852) 2025-04-27 13:32:29 -03:00
input Remove accidentally left in debug logging from touchpad input emulation 2025-06-30 21:53:45 +02:00
qt_gui New Crowdin updates (#3165) 2025-06-29 11:48:44 +03:00
shader_recompiler vector_alu: Improve handling of mbcnt append/consume patterns (#3184) 2025-07-03 13:19:38 +03:00
video_core vector_alu: Improve handling of mbcnt append/consume patterns (#3184) 2025-07-03 13:19:38 +03:00
.clang-format chore: Make shadps4 REUSE compliant 2024-02-23 23:33:43 +02:00
emulator.cpp Readbacks proof of concept rebased (#3178) 2025-07-01 23:41:00 +03:00
emulator.h Add support for game folder and fail early if eboot.bin is missing or corrupt (#3027) 2025-06-03 13:34:29 +03:00
main.cpp qt: save gui settings to separate file (#2984) 2025-06-12 13:27:52 +03:00
sdl_window.cpp Controller Remapping GUI v2 (#3144) 2025-06-27 15:55:52 +02:00
sdl_window.h Gui: Adding Pause button working, full screen button and labels to buttons on main window gui (#2634) 2025-03-26 23:50:52 +02:00
shadps4.qrc Favorites in the game list (#2649) (#3071) 2025-06-22 12:53:47 +03:00
shadps4.rc [Windows] Adding Properties to the Executable (#2789) 2025-04-17 09:43:14 +03:00