[PR #1763] [MERGED] graphics: Improve handling of color buffer and storage image swizzles #2286

Closed
opened 2026-02-27 21:15:54 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/1763
Author: @raphaelthegreat
Created: 12/13/2024
Status: Merged
Merged: 12/13/2024
Merged by: @raphaelthegreat

Base: mainHead: better-swizzle


📝 Commits (4)

  • 08ed66f liverpool_to_vk: Remove wrong component swap formats
  • eba2549 shader_recompiler: Handle storage and buffer format swizzles
  • 3963ad9 shader_recompiler: Skip unsupported depth export
  • 7d7352c image_view: Remove image format swizzle

📊 Changes

6 files changed (+66 additions, -49 deletions)

View changed files

📝 src/shader_recompiler/frontend/translate/export.cpp (+5 -0)
📝 src/shader_recompiler/ir/passes/resource_tracking_pass.cpp (+42 -0)
📝 src/shader_recompiler/specialization.h (+10 -1)
📝 src/video_core/amdgpu/resource.h (+9 -0)
📝 src/video_core/renderer_vulkan/liverpool_to_vk.cpp (+0 -9)
📝 src/video_core/texture_cache/image_view.cpp (+0 -39)

📄 Description

  • Removed some color buffer component swaps that were wrong since eR8G8B8A8Unorm and eA8B8G8R8UnormPack32 are technically the same format for little-endian GPUs, which both AMD and NVIDIA are. This lets the shader specialization mechanism handle it instead.

  • Handle swizzles for storage image writes by swizzling incoming texel in the shader, as well as format buffer swizzles since BUFFER_LOAD_FORMAT and BUFFER_STORE_FORMAT use dst_sel from the sharp. For storage images specifically we only perform manual swizzling if the format isn't 8_8_8_8 since those can be swizzled with image view and is already mostly handled

  • Ignore mrtz stencil exports since those are unsupported for now


🔄 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/1763 **Author:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Created:** 12/13/2024 **Status:** ✅ Merged **Merged:** 12/13/2024 **Merged by:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Base:** `main` ← **Head:** `better-swizzle` --- ### 📝 Commits (4) - [`08ed66f`](https://github.com/shadps4-emu/shadPS4/commit/08ed66f9001997a3c139d359c8ae43304501a0d2) liverpool_to_vk: Remove wrong component swap formats - [`eba2549`](https://github.com/shadps4-emu/shadPS4/commit/eba2549d3a694aafd73e7793d3ed895da252fc75) shader_recompiler: Handle storage and buffer format swizzles - [`3963ad9`](https://github.com/shadps4-emu/shadPS4/commit/3963ad93b169a2d038b944788be2ab5add1e1597) shader_recompiler: Skip unsupported depth export - [`7d7352c`](https://github.com/shadps4-emu/shadPS4/commit/7d7352c1f20fd79e79ae9db415833a30cdd2d313) image_view: Remove image format swizzle ### 📊 Changes **6 files changed** (+66 additions, -49 deletions) <details> <summary>View changed files</summary> 📝 `src/shader_recompiler/frontend/translate/export.cpp` (+5 -0) 📝 `src/shader_recompiler/ir/passes/resource_tracking_pass.cpp` (+42 -0) 📝 `src/shader_recompiler/specialization.h` (+10 -1) 📝 `src/video_core/amdgpu/resource.h` (+9 -0) 📝 `src/video_core/renderer_vulkan/liverpool_to_vk.cpp` (+0 -9) 📝 `src/video_core/texture_cache/image_view.cpp` (+0 -39) </details> ### 📄 Description * Removed some color buffer component swaps that were wrong since eR8G8B8A8Unorm and eA8B8G8R8UnormPack32 are technically the same format for little-endian GPUs, which both AMD and NVIDIA are. This lets the shader specialization mechanism handle it instead. * Handle swizzles for storage image writes by swizzling incoming texel in the shader, as well as format buffer swizzles since BUFFER_LOAD_FORMAT and BUFFER_STORE_FORMAT use dst_sel from the sharp. ~For storage images specifically we only perform manual swizzling if the format isn't 8_8_8_8 since those can be swizzled with image view and is already mostly handled~ * Ignore mrtz stencil exports since those are unsupported for now --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:15:54 +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#2286
No description provided.