mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-25 15:56:00 +03:00
[PR #1857] [MERGED] renderer_vulkan: Implement rectlist emulation with tessellation #2351
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#2351
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/1857
Author: @raphaelthegreat
Created: 12/23/2024
Status: ✅ Merged
Merged: 12/24/2024
Merged by: @raphaelthegreat
Base:
main← Head:rectlist-tess📝 Commits (8)
3485a30renderer_vulkan: Implement rectlist emulation with tessellation0925d58clang formatcff8124renderer_vulkan: Use tessellation for quad primitive as well7366c9avk_rasterizer: Handle viewport enable flagsdf4613areview9a183f4shader_recompiler: Fix quad/rect list FS passthrough semantics.a00d077spirv: Bump to 1.55699888remove pragma📊 Changes
15 files changed (+426 additions, -123 deletions)
View changed files
📝
CMakeLists.txt(+2 -0)📝
src/common/io_file.h(+1 -1)📝
src/shader_recompiler/backend/spirv/emit_spirv.cpp(+1 -0)➕
src/shader_recompiler/backend/spirv/emit_spirv_quad_rect.cpp(+329 -0)➕
src/shader_recompiler/backend/spirv/emit_spirv_quad_rect.h(+24 -0)📝
src/shader_recompiler/runtime_info.h(+1 -1)📝
src/video_core/buffer_cache/buffer_cache.cpp(+2 -45)📝
src/video_core/renderer_vulkan/liverpool_to_vk.cpp(+2 -2)📝
src/video_core/renderer_vulkan/liverpool_to_vk.h(+0 -28)📝
src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp(+34 -17)📝
src/video_core/renderer_vulkan/vk_graphics_pipeline.h(+2 -6)📝
src/video_core/renderer_vulkan/vk_pipeline_cache.cpp(+6 -5)📝
src/video_core/renderer_vulkan/vk_pipeline_cache.h(+2 -1)📝
src/video_core/renderer_vulkan/vk_rasterizer.cpp(+16 -17)📝
src/video_core/renderer_vulkan/vk_shader_util.cpp(+4 -0)📄 Description
RectLists are a primitive types that renders a quad, given only 3 vertices, by interpolating the fourth one. There is no similar primitive provided by the vulkan API, so we have to emulate it. On main this is a bit of a hack, where we change it to either TriangleStrip/TriangleFan and adjust the number of drawn vertices.
For this to work however, several assumptions must be true. The shader must auto-generate the vertices (no vertex buffer bound), it must also generate a proper fourth vertex to form a quad and only draw 1 quad. These requirements often are true, but not always. And even if they are, sometimes it still doesn't render properly due to changes in ordering.
In this PR we remove the hacks and implement RectList primitive using auxiliary tessellation shaders. The interpolation method is referenced from GRVK:
github.com/libcg/grvk@03d43a5a/src/amdilc/amdilc_rect_gs_compiler.c (L141)Most existing implementations use a geometry shader for this, but we opted not to for several reasons. Firstly macos doesn't support geoshaders and thus would not be able to benefit, while tessellation shaders should be supported. Also tessellation shaders will work in all cases of RectList usage without interfering with pipeline. It is possible for guest to configure RectLists together with a guest geometry shaders, which would break if we had to insert our own geometry shader. Using tessellation requires patch primitive type instead, so this problem doesn't exist.
Should fix cases of poking triangles in the screen.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.