mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-26 08:15:59 +03:00
[PR #2403] [MERGED] shader_recompiler: Lower non-compute shared memory into spare VGPRs. #2705
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#2705
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/2403
Author: @squidbus
Created: 2/12/2025
Status: ✅ Merged
Merged: 2/13/2025
Merged by: @squidbus
Base:
main← Head:shared-to-priv📝 Commits (1)
4cb379ashader_recompiler: Lower non-compute shared memory into spare VGPRs.📊 Changes
12 files changed (+85 additions, -94 deletions)
View changed files
📝
src/shader_recompiler/backend/spirv/emit_spirv_instructions.h(+0 -2)📝
src/shader_recompiler/backend/spirv/emit_spirv_shared_memory.cpp(+0 -34)📝
src/shader_recompiler/backend/spirv/spirv_emit_context.cpp(+2 -0)📝
src/shader_recompiler/info.h(+2 -1)📝
src/shader_recompiler/ir/ir_emitter.cpp(+0 -5)📝
src/shader_recompiler/ir/microinstruction.cpp(+0 -1)📝
src/shader_recompiler/ir/opcodes.inc(+0 -2)📝
src/shader_recompiler/ir/passes/hull_shader_transform.cpp(+10 -23)📝
src/shader_recompiler/ir/passes/ir_passes.h(+1 -1)📝
src/shader_recompiler/ir/passes/lower_shared_mem_to_registers.cpp(+65 -22)📝
src/shader_recompiler/recompiler.cpp(+4 -3)📝
src/video_core/renderer_vulkan/vk_rasterizer.cpp(+1 -0)📄 Description
Improves the shared memory lowering pass for non-compute by lowering into spare VGPRs instead of directly referencing the value source. This allows it to work with branching shared memory logic. The previous implementation would ignore control flow and just take the last write instruction in order before the read, but by replacing with VGPR load/store instead, we can preserve control flow.
Fixes some fragment shaders in CUSA28193 that use branching logic for writing to shared memory then read the values back later. A few shaders that would emit a validation error about non-dominating variable access are now valid.
I also fixed a few issues in the shared memory buffer binding that I spotted, with it not being accounted for in
Info::AddBindingsor incrementing the buffer count inRasterizer::BindBuffers.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.