[PR #2146] [MERGED] renderer: handle disabled clipping #2518

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/2146
Author: @roamic
Created: 1/14/2025
Status: Merged
Merged: 1/18/2025
Merged by: @roamic

Base: mainHead: fix-disabled-viewport


📝 Commits (4)

  • 50bbfc4 renderer: handle disabled clip space
  • 092db68 make the feature optional, add error log, remove window offset
  • b6f2ce3 disable clipping for rect lists, apply vport transform
  • 172308a account for max viewport limit, add todo for ViewportIndex

📊 Changes

11 files changed (+149 additions, -35 deletions)

View changed files

📝 src/shader_recompiler/backend/spirv/emit_spirv_special.cpp (+38 -0)
📝 src/shader_recompiler/backend/spirv/spirv_emit_context.cpp (+23 -14)
📝 src/shader_recompiler/info.h (+8 -0)
📝 src/shader_recompiler/profile.h (+2 -0)
📝 src/shader_recompiler/runtime_info.h (+3 -1)
📝 src/video_core/renderer_vulkan/vk_graphics_pipeline.h (+6 -1)
📝 src/video_core/renderer_vulkan/vk_instance.cpp (+6 -0)
📝 src/video_core/renderer_vulkan/vk_instance.h (+8 -0)
📝 src/video_core/renderer_vulkan/vk_pipeline_cache.cpp (+5 -0)
📝 src/video_core/renderer_vulkan/vk_rasterizer.cpp (+49 -18)
📝 src/video_core/renderer_vulkan/vk_rasterizer.h (+1 -1)

📄 Description

Adds handling to the disabled clipping by creating a vertex shader permutation that converts vertex coordinates from clip space to screen space and fits them inside a huge ([0..16383, 0..16383]) viewport. One shortcoming of this method is that it does not support multiple different viewport transformations but nothing can be done about this without hardware and API support.

Also implicitly disables clipping for the RECTLIST primitive because this primitive should not be clipped, rather it should be culled.

Other minor changes:

  • Added primitiveTopologyPatchListRestart if it is supported by the device to silence the validation errors.
  • Changed empty viewport to one outside of the render space.

🔄 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/2146 **Author:** [@roamic](https://github.com/roamic) **Created:** 1/14/2025 **Status:** ✅ Merged **Merged:** 1/18/2025 **Merged by:** [@roamic](https://github.com/roamic) **Base:** `main` ← **Head:** `fix-disabled-viewport` --- ### 📝 Commits (4) - [`50bbfc4`](https://github.com/shadps4-emu/shadPS4/commit/50bbfc4f86996d6879a6c13a0d5e6cc51567fe2f) renderer: handle disabled clip space - [`092db68`](https://github.com/shadps4-emu/shadPS4/commit/092db6829f363776a5d6153def1b2961fa2c0d40) make the feature optional, add error log, remove window offset - [`b6f2ce3`](https://github.com/shadps4-emu/shadPS4/commit/b6f2ce34e0399e6e21abe6ae48c45d5ff8e5a3c0) disable clipping for rect lists, apply vport transform - [`172308a`](https://github.com/shadps4-emu/shadPS4/commit/172308aab4bc2ef6a7ae750225c0a7720a9dd725) account for max viewport limit, add todo for ViewportIndex ### 📊 Changes **11 files changed** (+149 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `src/shader_recompiler/backend/spirv/emit_spirv_special.cpp` (+38 -0) 📝 `src/shader_recompiler/backend/spirv/spirv_emit_context.cpp` (+23 -14) 📝 `src/shader_recompiler/info.h` (+8 -0) 📝 `src/shader_recompiler/profile.h` (+2 -0) 📝 `src/shader_recompiler/runtime_info.h` (+3 -1) 📝 `src/video_core/renderer_vulkan/vk_graphics_pipeline.h` (+6 -1) 📝 `src/video_core/renderer_vulkan/vk_instance.cpp` (+6 -0) 📝 `src/video_core/renderer_vulkan/vk_instance.h` (+8 -0) 📝 `src/video_core/renderer_vulkan/vk_pipeline_cache.cpp` (+5 -0) 📝 `src/video_core/renderer_vulkan/vk_rasterizer.cpp` (+49 -18) 📝 `src/video_core/renderer_vulkan/vk_rasterizer.h` (+1 -1) </details> ### 📄 Description Adds handling to the disabled clipping by creating a vertex shader permutation that converts vertex coordinates from clip space to screen space and fits them inside a huge (`[0..16383, 0..16383]`) viewport. One shortcoming of this method is that it does not support multiple different viewport transformations but nothing can be done about this without hardware and API support. Also implicitly disables clipping for the `RECTLIST` primitive because this primitive should not be clipped, rather it should be culled. Other minor changes: * Added `primitiveTopologyPatchListRestart` if it is supported by the device to silence the validation errors. * Changed empty viewport to one outside of the render space. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:00:14 +03:00
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#2518
No description provided.