mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-26 00:05:58 +03:00
[PR #2448] [MERGED] shader_recompiler: Implement AMD buffer bounds checking behavior. #2741
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#2741
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/2448
Author: @squidbus
Created: 2/15/2025
Status: ✅ Merged
Merged: 2/17/2025
Merged by: @raphaelthegreat
Base:
main← Head:buffer-bounds📝 Commits (5)
c35bcadshader_recompiler: Implement AMD buffer bounds checking behavior.7c3c018shader_recompiler: Use SRT flatbuf for bounds check size.e7906f6shader_recompiler: Fix buffer atomic bounds check.15a47d1buffer_cache: Prevent false image-to-buffer sync.a66adebAddress review comments.📊 Changes
19 files changed (+377 additions, -159 deletions)
View changed files
📝
src/shader_recompiler/backend/spirv/emit_spirv_atomic.cpp(+25 -1)📝
src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp(+133 -52)📝
src/shader_recompiler/backend/spirv/emit_spirv_special.cpp(+1 -1)📝
src/shader_recompiler/backend/spirv/spirv_emit_context.cpp(+73 -28)📝
src/shader_recompiler/backend/spirv/spirv_emit_context.h(+6 -1)📝
src/shader_recompiler/frontend/fetch_shader.cpp(+7 -2)📝
src/shader_recompiler/frontend/fetch_shader.h(+2 -0)📝
src/shader_recompiler/frontend/translate/translate.cpp(+58 -32)📝
src/shader_recompiler/frontend/translate/translate.h(+2 -0)📝
src/shader_recompiler/frontend/translate/vector_memory.cpp(+4 -0)📝
src/shader_recompiler/info.h(+18 -12)📝
src/shader_recompiler/ir/reg.h(+1 -0)📝
src/shader_recompiler/profile.h(+1 -0)📝
src/video_core/buffer_cache/buffer_cache.cpp(+5 -1)📝
src/video_core/renderer_vulkan/vk_instance.cpp(+22 -17)📝
src/video_core/renderer_vulkan/vk_instance.h(+13 -5)📝
src/video_core/renderer_vulkan/vk_pipeline_cache.cpp(+1 -0)📝
src/video_core/renderer_vulkan/vk_rasterizer.cpp(+0 -1)📝
src/video_core/renderer_vulkan/vk_rasterizer.h(+5 -6)📄 Description
Implements AMD buffer bounds checking behavior, in one of two ways:
robustBufferAccess2Vulkan feature where supported. This should provide equivalent buffer bounds checking behavior on its own. Have also added some logs for the presence of extension features we consider optional.I have found at least one game that needs this behavior, CUSA16404, in order to draw some 2D UI effects, particles, and flat geometry. It seems the game has a bug where it does an instanced draw with vertex buffers sized to the number of instances, and for some reason a single one of the vertex attributes is indexed by vertex ID instead of instance ID like the others. This may not have been caught in development as the value is usually zero, so with bounds checking it works.
This may also help reduce some device losses and other weird GPU corruption behavior on macOS, as previously there was no buffer robustness at all, allowing misbehaving games to trash things and cause faults.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.