mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-25 07:46:01 +03:00
[PR #1683] [MERGED] renderer_vulkan: Introduce shader HLE system with copy shader implementation. #2245
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#2245
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/1683
Author: @squidbus
Created: 12/7/2024
Status: ✅ Merged
Merged: 12/10/2024
Merged by: @raphaelthegreat
Base:
main← Head:copy-shader-hle📝 Commits (3)
84e8168renderer_vulkan: Introduce shader HLE system with copy shader implementation.cc0c498buffer_cache: Handle obtaining buffer views partially within buffers.363c6c1vk_shader_hle: Make more efficient📊 Changes
9 files changed (+195 additions, -5 deletions)
View changed files
📝
CMakeLists.txt(+2 -0)📝
src/video_core/buffer_cache/buffer_cache.cpp(+9 -1)📝
src/video_core/buffer_cache/buffer_cache.h(+2 -1)📝
src/video_core/renderer_vulkan/vk_rasterizer.cpp(+6 -0)📝
src/video_core/renderer_vulkan/vk_rasterizer.h(+8 -0)📝
src/video_core/renderer_vulkan/vk_scheduler.h(+4 -0)➕
src/video_core/renderer_vulkan/vk_shader_hle.cpp(+139 -0)➕
src/video_core/renderer_vulkan/vk_shader_hle.h(+20 -0)📝
src/video_core/texture_cache/texture_cache.cpp(+5 -3)📄 Description
Introduces a system for implementing more efficient HLE macros for simple shaders.
In this case, implements a macro for a copy shader used by Bloodborne to copy arbitrary blocks of memory from one buffer to another. Currently this shader is responsible for big spikes in memory usage from mapping 2GB+ buffers of memory space to arbitrarily copy between. On a real console this would not be an issue since it just provides a window into the memory range, but for us this results in buffer memory allocations to cover the entire range.
By implementing this shader in HLE we can avoid these giant buffer allocations, instead only mapping much smaller areas where the copy actually occurs. This should eliminate memory spikes, reduce overall VRAM usage, and be generally more performant. We hope to have a more low-level solution for this problem in the future, but pending that this is a good way to keep memory usage under control and improve performance.
This also allows Bloodborne to go in-game on macOS (if compiled using the latest dev build of MoltenVK) since this shader was the main blocker for that. Still needs some more improvements to be fully stable.
Thanks to @raphaelthegreat for implementing the algorithm to batch the copies together.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.