[PR #231] [MERGED] shader_recompiler: Implement most integer image atomics, workgroup barriers and shared memory load/store #1413

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/231
Author: @raphaelthegreat
Created: 7/1/2024
Status: Merged
Merged: 7/4/2024
Merged by: @raphaelthegreat

Base: mainHead: shared_mem


📝 Commits (10+)

  • 91aed76 shader_recompiler: Add LDEXP
  • 668f767 shader_recompiler: Add most image integer atomic ops
  • e8a2cb7 shader_recompiler: Implement shared memory load/store
  • 61f1854 shader_recompiler: More image atomics
  • 0fcc1ce externals: Update sirit
  • 0999b9e clang format
  • d939c58 cmake: Add missing files
  • b4e1eeb shader_recompiler: Fix some atomic bugs
  • 8103dde shader_recompiler: Vs outputs
  • f212f43 shader_recompiler: Shared mem has side-effects, fix format component order

📊 Changes

69 files changed (+1597 additions, -310 deletions)

View changed files

📝 CMakeLists.txt (+3 -0)
📝 externals/sirit (+1 -1)
src/common/div_ceil.h (+25 -0)
📝 src/common/string_util.cpp (+6 -0)
📝 src/common/string_util.h (+3 -0)
📝 src/core/address_space.h (+1 -1)
📝 src/core/file_sys/fs.cpp (+19 -4)
📝 src/core/libraries/gnmdriver/gnmdriver.cpp (+4 -4)
📝 src/core/libraries/gnmdriver/gnmdriver.h (+1 -1)
📝 src/core/libraries/kernel/memory_management.cpp (+0 -1)
📝 src/core/libraries/kernel/thread_management.cpp (+26 -20)
📝 src/core/libraries/kernel/threads/semaphore.cpp (+5 -1)
📝 src/core/libraries/save_data/savedata.cpp (+6 -2)
📝 src/shader_recompiler/backend/spirv/emit_spirv.cpp (+25 -12)
src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp (+70 -0)
src/shader_recompiler/backend/spirv/emit_spirv_barriers.cpp (+37 -0)
📝 src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp (+2 -2)
📝 src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp (+60 -11)
📝 src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp (+5 -5)
📝 src/shader_recompiler/backend/spirv/emit_spirv_floating_point.cpp (+27 -10)

...and 49 more files

📄 Description

Couldn't resist not testing this since it showed intro screens lol. These allow Red Dead Redemption to not crash during shader compilation. The game also uses inline constant buffers but those should be for a different PR.

For shared memory emulation we use VK_KHR_workgroup_memory_explicit_layout to allow aliasing of the shared region with different access types, which makes reads/writes with granularity less than a dword easy.

Also fixed intro text by allowing render target refresh in texture cache. This is not ideal as it will upload from host memory each time but it works. Will need a proper guest buffer manager to make it fast


🔄 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/231 **Author:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Created:** 7/1/2024 **Status:** ✅ Merged **Merged:** 7/4/2024 **Merged by:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Base:** `main` ← **Head:** `shared_mem` --- ### 📝 Commits (10+) - [`91aed76`](https://github.com/shadps4-emu/shadPS4/commit/91aed769205e2d73dffa27aa852a31250e36df84) shader_recompiler: Add LDEXP - [`668f767`](https://github.com/shadps4-emu/shadPS4/commit/668f7673d95422eb61be747889e522a3c3b9ca47) shader_recompiler: Add most image integer atomic ops - [`e8a2cb7`](https://github.com/shadps4-emu/shadPS4/commit/e8a2cb74749760f39ba3d7a2780e11e13cc60371) shader_recompiler: Implement shared memory load/store - [`61f1854`](https://github.com/shadps4-emu/shadPS4/commit/61f18544c78c1efdc6f544ddb03a739f423cb91d) shader_recompiler: More image atomics - [`0fcc1ce`](https://github.com/shadps4-emu/shadPS4/commit/0fcc1cebdcf93f954a92c62ad592aab6880ecde8) externals: Update sirit - [`0999b9e`](https://github.com/shadps4-emu/shadPS4/commit/0999b9e360d95c6de1adbfe116a9b0debbd41d73) clang format - [`d939c58`](https://github.com/shadps4-emu/shadPS4/commit/d939c58ea2903cddbbad72180937e9e61bf0f8e1) cmake: Add missing files - [`b4e1eeb`](https://github.com/shadps4-emu/shadPS4/commit/b4e1eebcddcd349c7ee26b320234fe6886c5eab7) shader_recompiler: Fix some atomic bugs - [`8103dde`](https://github.com/shadps4-emu/shadPS4/commit/8103dde915665f3bdbf71c67ab9e7301bb6c6d05) shader_recompiler: Vs outputs - [`f212f43`](https://github.com/shadps4-emu/shadPS4/commit/f212f43e181abda2212204ff3f02b7114441b6f0) shader_recompiler: Shared mem has side-effects, fix format component order ### 📊 Changes **69 files changed** (+1597 additions, -310 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+3 -0) 📝 `externals/sirit` (+1 -1) ➕ `src/common/div_ceil.h` (+25 -0) 📝 `src/common/string_util.cpp` (+6 -0) 📝 `src/common/string_util.h` (+3 -0) 📝 `src/core/address_space.h` (+1 -1) 📝 `src/core/file_sys/fs.cpp` (+19 -4) 📝 `src/core/libraries/gnmdriver/gnmdriver.cpp` (+4 -4) 📝 `src/core/libraries/gnmdriver/gnmdriver.h` (+1 -1) 📝 `src/core/libraries/kernel/memory_management.cpp` (+0 -1) 📝 `src/core/libraries/kernel/thread_management.cpp` (+26 -20) 📝 `src/core/libraries/kernel/threads/semaphore.cpp` (+5 -1) 📝 `src/core/libraries/save_data/savedata.cpp` (+6 -2) 📝 `src/shader_recompiler/backend/spirv/emit_spirv.cpp` (+25 -12) ➕ `src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp` (+70 -0) ➕ `src/shader_recompiler/backend/spirv/emit_spirv_barriers.cpp` (+37 -0) 📝 `src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp` (+2 -2) 📝 `src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp` (+60 -11) 📝 `src/shader_recompiler/backend/spirv/emit_spirv_convert.cpp` (+5 -5) 📝 `src/shader_recompiler/backend/spirv/emit_spirv_floating_point.cpp` (+27 -10) _...and 49 more files_ </details> ### 📄 Description Couldn't resist not testing this since it showed intro screens lol. These allow Red Dead Redemption to not crash during shader compilation. The game also uses inline constant buffers but those should be for a different PR. For shared memory emulation we use VK_KHR_workgroup_memory_explicit_layout to allow aliasing of the shared region with different access types, which makes reads/writes with granularity less than a dword easy. Also fixed intro text by allowing render target refresh in texture cache. This is not ideal as it will upload from host memory each time but it works. Will need a proper guest buffer manager to make it fast --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:12:26 +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#1413
No description provided.