shader: specialize cube image descriptors #134

Manually merged
github merged 2 commits from gh-pr/134/head into gh-pr/134/base 2026-11-26 09:11:39 +00:00
Owner

@⁠nikosszzz on GitHub · 2026-07-30 12:48 UTC · original
nikosszzz:main → main · +155 −56 · 5 files · 2 commits · merged 2026-07-31 01:59 UTC

This PR adds cube image awareness to shader resource specialization and SPIR-V image sampling.

Image descriptors are now specialized with cube map information, validated against the runtime descriptor, and propagated into the IR. During SPIR-V emission, cube images that are represented as 2D array images have their sampling coordinates adjusted to match the expected coordinate space.

Changes

  • Added cube map detection from image descriptors (DescriptorIsCube).
  • Extended resource specialization to:
    • Store whether an image resource is a cube map.
    • Validate cube state during specialization.
    • Propagate cube information into patched IR instructions.
  • Added cube/image_cube fields to ImageResource and MemoryInfo.
  • Updated SPIR-V image coordinate emission to apply the required coordinate offset for cube images emitted as Dim2DArray.

Why

Previously, specialization only tracked the image dimension. Cube maps were treated the same as ordinary 2D array images, preventing the SPIR-V backend from distinguishing them when generating image sampling instructions.

By preserving cube information throughout specialization, the SPIR-V emitter can correctly handle cube image sampling while leaving the behavior of non-cube image resources unchanged.

Testing

  • The Minecraft Panorama on the Main Menu was suffering from this issue, now it works.
  • Tested Dreaming Sarah, Subnautica and The Pathless to make sure my changes didn't break another game.
**@⁠nikosszzz** on GitHub · 2026-07-30 12:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/134) `nikosszzz:main` → `main` · +155 −56 · 5 files · 2 commits · merged 2026-07-31 01:59 UTC This PR adds cube image awareness to shader resource specialization and SPIR-V image sampling. Image descriptors are now specialized with cube map information, validated against the runtime descriptor, and propagated into the IR. During SPIR-V emission, cube images that are represented as 2D array images have their sampling coordinates adjusted to match the expected coordinate space. ## Changes - Added cube map detection from image descriptors (`DescriptorIsCube`). - Extended resource specialization to: - Store whether an image resource is a cube map. - Validate cube state during specialization. - Propagate cube information into patched IR instructions. - Added `cube`/`image_cube` fields to `ImageResource` and `MemoryInfo`. - Updated SPIR-V image coordinate emission to apply the required coordinate offset for cube images emitted as `Dim2DArray`. ## Why Previously, specialization only tracked the image dimension. Cube maps were treated the same as ordinary 2D array images, preventing the SPIR-V backend from distinguishing them when generating image sampling instructions. By preserving cube information throughout specialization, the SPIR-V emitter can correctly handle cube image sampling while leaving the behavior of non-cube image resources unchanged. ## Testing - The Minecraft Panorama on the Main Menu was suffering from this issue, now it works. - Tested Dreaming Sarah, Subnautica and The Pathless to make sure my changes didn't break another game.
Track whether image descriptors refer to cube maps during resource specialization, and apply the coordinate offset conversion when sampling cube maps as 2D image arrays in SPIR-V emission.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:11:38 +00:00
github manually merged commit ac055070dd into gh-pr/134/base 2026-11-26 09:11:39 +00:00
Author
Owner

@⁠Nmzik on GitHub · 2026-07-31 01:59 UTC · original

@⁠nikosszzz Thanks for finding the root cause. Accepted!

**@⁠Nmzik** on GitHub · 2026-07-31 01:59 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/134#issuecomment-5138365198) @⁠nikosszzz Thanks for finding the root cause. Accepted!
This discussion has been locked. Commenting is limited to contributors.
No description provided.