[PR #3263] buffer_cache: Minor DMA optimizations #3347

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3263
Author: @raphaelthegreat
Created: 7/17/2025
Status: 🔄 Open

Base: mainHead: dma-opts


📝 Commits (4)

  • 6cbb304 buffer_cache: Remove per-draw memory barrier
  • 34ce272 buffer_cache: Remove useless fillBuffer, remove some barriers on fault buffer process
  • a5e8aa9 spirv_emit_context: Use atomic for fault buffer
  • 6131db1 Merge branch 'main' into dma-opts

📊 Changes

5 files changed (+40 additions, -95 deletions)

View changed files

📝 src/shader_recompiler/backend/spirv/spirv_emit_context.cpp (+22 -24)
📝 src/video_core/buffer_cache/buffer_cache.cpp (+17 -64)
📝 src/video_core/buffer_cache/buffer_cache.h (+0 -3)
📝 src/video_core/host_shaders/fault_buffer_process.comp (+1 -3)
📝 src/video_core/renderer_vulkan/vk_rasterizer.cpp (+0 -1)

📄 Description

  • Removed per-draw memory barrier. Cache already emits a post barrier on every buffer upload and shader cannot write to DMA buffers so don't see any point
  • Removed fillBuffer commands on buffer creation and fault buffer processing. In first case, the buffer is going to get fully copied into anyway, so it just wastes GPU resources to zero fill it
  • Switched fault buffer marking to atomic operation. It is very possible for waves of the same draw/dispatch to race accessing the same word and even pipelined draws/dispatches as there is no per-draw fault buffer barrier. Using atomic ensures proper synchronization in both cases

tagging @LNDF to review this


🔄 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/3263 **Author:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Created:** 7/17/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `dma-opts` --- ### 📝 Commits (4) - [`6cbb304`](https://github.com/shadps4-emu/shadPS4/commit/6cbb304afc8301846c9d42dd1db84cb0c392846c) buffer_cache: Remove per-draw memory barrier - [`34ce272`](https://github.com/shadps4-emu/shadPS4/commit/34ce2723f8c3719f71beb28fcdc27e91e132d848) buffer_cache: Remove useless fillBuffer, remove some barriers on fault buffer process - [`a5e8aa9`](https://github.com/shadps4-emu/shadPS4/commit/a5e8aa960df32a23c6cda270a0b083f824931582) spirv_emit_context: Use atomic for fault buffer - [`6131db1`](https://github.com/shadps4-emu/shadPS4/commit/6131db1c464ae6e45842e2723d257d134bb9051f) Merge branch 'main' into dma-opts ### 📊 Changes **5 files changed** (+40 additions, -95 deletions) <details> <summary>View changed files</summary> 📝 `src/shader_recompiler/backend/spirv/spirv_emit_context.cpp` (+22 -24) 📝 `src/video_core/buffer_cache/buffer_cache.cpp` (+17 -64) 📝 `src/video_core/buffer_cache/buffer_cache.h` (+0 -3) 📝 `src/video_core/host_shaders/fault_buffer_process.comp` (+1 -3) 📝 `src/video_core/renderer_vulkan/vk_rasterizer.cpp` (+0 -1) </details> ### 📄 Description * Removed per-draw memory barrier. Cache already emits a post barrier on every buffer upload and shader cannot write to DMA buffers so don't see any point * Removed fillBuffer commands on buffer creation and fault buffer processing. In first case, the buffer is going to get fully copied into anyway, so it just wastes GPU resources to zero fill it * Switched fault buffer marking to atomic operation. It is very possible for waves of the same draw/dispatch to race accessing the same word and even pipelined draws/dispatches as there is no per-draw fault buffer barrier. Using atomic ensures proper synchronization in both cases tagging @LNDF to review this --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#3347
No description provided.