graphics: fall back to base-level remap when VK_EXT_image_view_min_lod is missing #1314

Closed
github-bot wants to merge 3 commits from gh-pr/1314/head into gh-pr/1314/base
Owner

@⁠wuboo on GitHub · 2026-10-09 16:07 UTC · original
wuboo:pr/texture-min-lod-fallback → main · +405 −11 · 16 files · 3 commits · closed without merging

Problem

f38d738e ("Honor PS5 texture minimum LOD for streamed mip chains") hands the T# MinLod to the image view through
VK_EXT_image_view_min_lod, and vulkanWindow.cpp rejects every device that lacks the extension. MoltenVK (macOS)
does not expose it. Where the clamp cannot reach the view, a streamed texture whose T# says MinLod = 1024 (the first
four mips are not resident yet) is sampled from mips 0..3, i.e. from memory the game never filled. On the sand level
this shows up as confetti and yellow patches on the terrain.

Change

  • The extension and its feature are queried instead of required. GraphicContext::has_view_min_lod says whether the
    clamp can go to the view natively (then nothing changes); min_lod_remap is its negation.
  • Without the extension, a sampled, non-Dynamic image view starts at base_level + ceil(MinLod / 256) (never past
    the last level) with the level count reduced accordingly (MapMinLodToBaseLevel in minLodView.h; the shift is
    MinLodShift in graphics/shader/minLodShift.h). Storage and Dynamic-mip images are left alone (Dynamic applies
    MinLod in the shader).
  • RESINFO: hardware answers image_get_resinfo from the T# (extent at BASE_LEVEL, LAST_LEVEL - BASE_LEVEL + 1
    levels) whatever MinLod says, while a shifted view reports a smaller extent and fewer levels. When the host remaps,
    the shader specialisation carries MinLodResinfo (computed from the T# with the same shift) and QueryDimensions
    emits those constants instead of OpImageQueryLevels / the view size. Programs without a size query and images
    without MinLod are not affected (no new permutations).

Tests

  • min_lod_view (CPU): shift table (0 / 256 / 1024 / 1100 / cap), host mapping == recompiler shift, RESINFO for
    base 0 / last 11 / MinLod 1024 on 2048x2048 -> 2048x2048, 12 levels.
  • Mutants (WILL_FAIL; each exits 1 with the fix reverted): min_lod_view_mutant_floor (floors the fraction),
    _no_cap (no cap at the last level), _resinfo (reports what the shifted view reports: 128x128 / 8 levels).
  • shader_cfg / TestMinLodResinfoCorrection: compiles image_get_resinfo with MinLod 1024, 2048x2048, 11 levels;
    without the remap the SPIR-V queries the view (OpImageQueryLevels), with it the query is gone and 2048 / 11 are
    constants; MinLod 0 is untouched.
  • Full ctest, macOS Release x86_64, same environment for both trees, KYTY_VS_LANE_FROM_INDEX=0 for the run:
    origin/main (4c8fc53a) 35 pass / 19 skipped (no Vulkan loader or hidden Vulkan window in the test environment) /
    0 fail; this branch 39 pass / 19 skipped / 0 fail. The only difference is the four new min_lod_view* tests.

In-game results (macOS / MoltenVK 1.4.2, sand level)

Measured on a bench build with temporary counters and an on/off switch (neither is part of this diff).

  • The terrain texture has T# MinLod = 1024 (4 mips). Without the fix: 1 824 512 binds dropped the clamp, 0 remapped.
    With it: 0 dropped, 1 720 939 remapped (a second run: 1 683 560 / 1 758 173).
  • Image: before the fix, confetti of random colours and yellow patches on the dune surface and dark slopes; after it,
    smooth sand, dunes, and the stack with the "!" marker and the ship as in the reference frame for that level.
    In the space/tunnel scene the moon was missing a quarter of its texture early on without the fix (same cause);
    with it the scene is otherwise unchanged apart from asteroid positions. Menu frames are identical.
  • Speed: frame rate stays within noise. Two runs with the fix differ by 1.3 % between themselves (4.58 vs 4.64
    frames/s); the ratio to the run without it is 0.989 and 1.002.

Limitations

  • A fractional MinLod is rounded up to a whole level, since a view cannot express a fraction; the sampler may start at
    most one level blurrier than the hardware's clamped trilinear blend. MinLod was integral (1024) in all observed
    content, so the image is exact there.
  • The RESINFO correction is covered by CPU tests only; the game never executed it (the resinfo counter stayed 0).
  • RESINFO correction covers sampled, non-Dynamic images; image_get_lod still returns the LOD relative to the new base.
  • The SPIR-V backend ignores the clamp component of image_sample_*_cl (separate, unrelated).
**@⁠wuboo** on GitHub · 2026-10-09 16:07 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314) `wuboo:pr/texture-min-lod-fallback` → `main` · +405 −11 · 16 files · 3 commits · closed without merging ## Problem f38d738e ("Honor PS5 texture minimum LOD for streamed mip chains") hands the T# MinLod to the image view through `VK_EXT_image_view_min_lod`, and `vulkanWindow.cpp` rejects every device that lacks the extension. MoltenVK (macOS) does not expose it. Where the clamp cannot reach the view, a streamed texture whose T# says MinLod = 1024 (the first four mips are not resident yet) is sampled from mips 0..3, i.e. from memory the game never filled. On the sand level this shows up as confetti and yellow patches on the terrain. ## Change - The extension and its feature are queried instead of required. `GraphicContext::has_view_min_lod` says whether the clamp can go to the view natively (then nothing changes); `min_lod_remap` is its negation. - Without the extension, a sampled, non-Dynamic image view starts at `base_level + ceil(MinLod / 256)` (never past the last level) with the level count reduced accordingly (`MapMinLodToBaseLevel` in `minLodView.h`; the shift is `MinLodShift` in `graphics/shader/minLodShift.h`). Storage and Dynamic-mip images are left alone (Dynamic applies MinLod in the shader). - RESINFO: hardware answers `image_get_resinfo` from the T# (extent at BASE_LEVEL, LAST_LEVEL - BASE_LEVEL + 1 levels) whatever MinLod says, while a shifted view reports a smaller extent and fewer levels. When the host remaps, the shader specialisation carries `MinLodResinfo` (computed from the T# with the same shift) and `QueryDimensions` emits those constants instead of `OpImageQueryLevels` / the view size. Programs without a size query and images without MinLod are not affected (no new permutations). ## Tests - `min_lod_view` (CPU): shift table (0 / 256 / 1024 / 1100 / cap), host mapping == recompiler shift, RESINFO for base 0 / last 11 / MinLod 1024 on 2048x2048 -> 2048x2048, 12 levels. - Mutants (WILL_FAIL; each exits 1 with the fix reverted): `min_lod_view_mutant_floor` (floors the fraction), `_no_cap` (no cap at the last level), `_resinfo` (reports what the shifted view reports: 128x128 / 8 levels). - `shader_cfg` / `TestMinLodResinfoCorrection`: compiles `image_get_resinfo` with MinLod 1024, 2048x2048, 11 levels; without the remap the SPIR-V queries the view (`OpImageQueryLevels`), with it the query is gone and 2048 / 11 are constants; MinLod 0 is untouched. - Full `ctest`, macOS Release x86_64, same environment for both trees, `KYTY_VS_LANE_FROM_INDEX=0` for the run: origin/main (4c8fc53a) 35 pass / 19 skipped (no Vulkan loader or hidden Vulkan window in the test environment) / 0 fail; this branch 39 pass / 19 skipped / 0 fail. The only difference is the four new `min_lod_view*` tests. ## In-game results (macOS / MoltenVK 1.4.2, sand level) Measured on a bench build with temporary counters and an on/off switch (neither is part of this diff). - The terrain texture has T# MinLod = 1024 (4 mips). Without the fix: 1 824 512 binds dropped the clamp, 0 remapped. With it: 0 dropped, 1 720 939 remapped (a second run: 1 683 560 / 1 758 173). - Image: before the fix, confetti of random colours and yellow patches on the dune surface and dark slopes; after it, smooth sand, dunes, and the stack with the "!" marker and the ship as in the reference frame for that level. In the space/tunnel scene the moon was missing a quarter of its texture early on without the fix (same cause); with it the scene is otherwise unchanged apart from asteroid positions. Menu frames are identical. - Speed: frame rate stays within noise. Two runs with the fix differ by 1.3 % between themselves (4.58 vs 4.64 frames/s); the ratio to the run without it is 0.989 and 1.002. ## Limitations - A fractional MinLod is rounded up to a whole level, since a view cannot express a fraction; the sampler may start at most one level blurrier than the hardware's clamped trilinear blend. MinLod was integral (1024) in all observed content, so the image is exact there. - The RESINFO correction is covered by CPU tests only; the game never executed it (the resinfo counter stayed 0). - RESINFO correction covers sampled, non-Dynamic images; `image_get_lod` still returns the LOD relative to the new base. - The SPIR-V backend ignores the clamp component of `image_sample_*_cl` (separate, unrelated).
Devices without the extension (MoltenVK) ignored the T# MinLod clamp, so the
sampler read mips the texture never loaded. Query the feature instead of
requiring it; when it is missing, fold MinLod into a higher view base level
(rounded up to a whole level) for sampled, non-Dynamic images.
The hardware answers image_get_resinfo from the T# whatever MinLod says. With
the clamp folded into a higher view base level the view reports a smaller size
and fewer levels, so specialise the query on the T# (extent at BASE_LEVEL and
LAST_LEVEL - BASE_LEVEL + 1) when the host remaps.
OpImageQuerySizeLod is undefined when the guest LOD exceeds the levels of the
MinLod-shifted view. The remap replaced the spatial components but kept the
layer count from that query; for arrays take it from a LOD 0 query instead.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:52:51 +00:00
github-bot closed this pull request 2026-11-26 09:52:54 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 16:16 UTC · original · edited 2026-10-19 09:32 UTC

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

  • Last reviewed commit: 04bfddeea665ef831fe23537eb2b3208b2f96eef
  • Latest commit, not reviewed: 79dd078ada

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Vulkan device setup now treats native image-view MinLod support as optional. When the feature is unavailable, sampled non-dynamic image views can map MinLod into their base level. The remapping state flows into shader resource specialization, which supplies RESINFO metadata to dimension queries. Tests cover MinLod mapping, RESINFO correction, generated SPIR-V, and mutant variants.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: 🔵 Low · up to 04bfd

The MinLod fallback is a bounded change for devices without the native extension. The array-texture size-query edge case and its weak test coverage should be addressed before or soon after merge.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 41.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 14 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: using a base-level remap when VK_EXT_image_view_min_lod is unavailable.
Description check Passed The description directly explains the problem, implementation, limitations, tests, and reported results for the MinLod fallback change.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 41.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 14 files. (1 skipped: 1 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 16:16 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314#issuecomment-6084782087) · edited 2026-10-19 09:32 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1314?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- This is an auto-generated comment: review paused by coderabbit.ai --> > [!NOTE] > ## Reviews paused > > It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the `reviews.auto_review.auto_pause_after_reviewed_commits` setting. > > - Last reviewed commit: 04bfddeea665ef831fe23537eb2b3208b2f96eef > - Latest commit, not reviewed: 79dd078ada76fb5f59e0fd1bf852ba0d9c1803b0 > > Use the following commands to manage reviews: > - `@coderabbitai resume` to resume automatic reviews. > - `@coderabbitai review` to trigger a single review. > > Use the checkboxes below for quick actions: > - [ ] <!-- {"checkboxId":"7f6cc2e2-2e4e-497a-8c31-c9e4573e93d1"} --> ▶️ Resume reviews > - [ ] <!-- {"checkboxId":"e9bb8d72-00e8-4f67-9cb2-caf3b22574fe"} --> 🔍 Trigger review <!-- end of auto-generated comment: review paused by coderabbit.ai --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> Vulkan device setup now treats native image-view MinLod support as optional. When the feature is unavailable, sampled non-dynamic image views can map MinLod into their base level. The remapping state flows into shader resource specialization, which supplies RESINFO metadata to dimension queries. Tests cover MinLod mapping, RESINFO correction, generated SPIR-V, and mutant variants. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"04bfddeea665ef831fe23537eb2b3208b2f96eef" --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>🔵 Low</strong> · up to <code>04bfd</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🔵 Low** · up to `04bfd` --> <!-- final_review_risk_coverage:{"sourceCommitId":"04bfddeea665ef831fe23537eb2b3208b2f96eef","coveredCommitId":"04bfddeea665ef831fe23537eb2b3208b2f96eef","kind":"reviewed"} --> The MinLod fallback is a bounded change for devices without the native extension. The array-texture size-query edge case and its weak test coverage should be addressed before or soon after merge. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-inconclusive-14-v2.svg" width="14" height="14" align="middle" alt="Inconclusive" title="Inconclusive"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 inconclusive</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Inconclusive](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-inconclusive.svg) | Docstring coverage is 41.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 14 files. (1 skipped:… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely describes the main change: using a base-level remap when VK_EXT_image_view_min_lod is unavailable. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the problem, implementation, limitations, tests, and reported results for the MinLod fallback change. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 41.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 14 files. (1 skipped: 1 too large.) **Resolution** Write docstrings for the functions missing them to satisfy the coverage threshold. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1314)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 16:16 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d8c04f40-0f6f-4b56-9b6f-1a2bebde46d1
📥 Commits

Reviewing files that changed from the base of the PR and between 4c8fc53a85 and ed104a3efc6aa681348529fd3bcfb154d001e05d.

📒 Files selected for processing (16)
  • CMakeLists.txt
  • src/graphics/host_gpu/graphicContext.h
  • src/graphics/host_gpu/renderer/image/imageView.cpp
  • src/graphics/host_gpu/renderer/image/minLodView.h
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
  • src/graphics/presentation/window/vulkanWindow.cpp
  • src/graphics/shader/minLodShift.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.h
  • src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp
  • src/graphics/shader/recompiler/ir/passes/SrtWalker.h
  • tests/MinLodViewTests.cpp
  • tests/shaderCfgTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 16:16 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314#pullrequestreview-5472607453) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `d8c04f40-0f6f-4b56-9b6f-1a2bebde46d1` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 4c8fc53a8582543200caa697acad2a9f09937cec and ed104a3efc6aa681348529fd3bcfb154d001e05d. </details> <details> <summary>📒 Files selected for processing (16)</summary> * `CMakeLists.txt` * `src/graphics/host_gpu/graphicContext.h` * `src/graphics/host_gpu/renderer/image/imageView.cpp` * `src/graphics/host_gpu/renderer/image/minLodView.h` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` * `src/graphics/presentation/window/vulkanWindow.cpp` * `src/graphics/shader/minLodShift.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp` * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.h` * `src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp` * `src/graphics/shader/recompiler/ir/passes/SrtWalker.h` * `tests/MinLodViewTests.cpp` * `tests/shaderCfgTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=fa7ec69a-b72d-4352-9512-1db0ec7d8b80 attempt=28b330a1-1f79-49a2-bcc5-b852e81fc76f batch=1/1 -->
@ -316,1 +316,3 @@
if (info.multisampled == 0u) {
// T# MinLod folded into the view base level: the view answers for the shifted base, RESINFO must not.
const auto& resinfo = ctx.state.program.info.images.at(mem.resource).min_lod_resinfo;
if (info.multisampled == 0u && resinfo.Active()) {
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 16:16 UTC · original · edited 2026-10-10 03:42 UTC

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Query a valid view level for array layer counts.

When resinfo.Active() and a guest LOD exceeds the remapped view’s level_count, the earlier OpImageQuerySizeLod has an undefined result. This branch replaces the spatial components but retains the queried array layer count. Query level zero for the array layer count on this path; keep the guest LOD for the corrected spatial extents. (docs.vulkan.org)

✅ Confirmed as addressed by @⁠wuboo

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 16:16 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314#discussion_r4232203928) · edited 2026-10-10 03:42 UTC **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Query a valid view level for array layer counts.** When `resinfo.Active()` and a guest LOD exceeds the remapped view’s `level_count`, the earlier `OpImageQuerySizeLod` has an undefined result. This branch replaces the spatial components but retains the queried array layer count. Query level zero for the array layer count on this path; keep the guest LOD for the corrected spatial extents. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/images.html?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:940b80f055c107b8095e3434 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠wuboo <!-- This is an auto-generated comment by CodeRabbit -->
@ -316,1 +316,3 @@
if (info.multisampled == 0u) {
// T# MinLod folded into the view base level: the view answers for the shifted base, RESINFO must not.
const auto& resinfo = ctx.state.program.info.images.at(mem.resource).min_lod_resinfo;
if (info.multisampled == 0u && resinfo.Active()) {
Author
Owner

@⁠wuboo on GitHub · 2026-10-10 03:42 UTC · original

Good catch. For array views the layer count in RESINFO no longer comes from the OpImageQuerySizeLod at the guest LOD (undefined when that LOD exceeds the shifted view's levels); it is now taken from a separate LOD 0 query, while the spatial extents still come from the T#. Fixed in 5febbdb7 (new commit, with a 2D-array regression test), and the branch is rebased onto the current main.

**@⁠wuboo** on GitHub · 2026-10-10 03:42 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314#discussion_r4236254999) Good catch. For array views the layer count in RESINFO no longer comes from the OpImageQuerySizeLod at the guest LOD (undefined when that LOD exceeds the shifted view's levels); it is now taken from a separate LOD 0 query, while the spatial extents still come from the T#. Fixed in 5febbdb7 (new commit, with a 2D-array regression test), and the branch is rebased onto the current main.
@ -316,1 +316,3 @@
if (info.multisampled == 0u) {
// T# MinLod folded into the view base level: the view answers for the shifted base, RESINFO must not.
const auto& resinfo = ctx.state.program.info.images.at(mem.resource).min_lod_resinfo;
if (info.multisampled == 0u && resinfo.Active()) {
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-10 03:42 UTC · original

@wuboo Thanks for the fix. The separate LOD 0 query provides the array layer count without using the undefined guest-LOD result. The spatial extents still use the T# metadata.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-10 03:42 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314#discussion_r4236255693) `@wuboo` Thanks for the fix. The separate LOD 0 query provides the array layer count without using the undefined guest-LOD result. The spatial extents still use the T# metadata. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Array%20views%20can%20return%20undefined%20layer%20counts%20when%20querying%20an%20out-of-range%20LOD.%20Query%20layers%20at%20LOD%200%3B%20keep%20guest%20LOD%20for%20spatial%20extents.%20Try%20%40coderabbitai%20for%20sharp%20code%20reviews!%20%F0%9F%90%87%F0%9F%8E%AF&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1314%23discussion_r4232203928)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠theantipopau on GitHub · 2026-10-18 23:01 UTC · original

@⁠wuboo I ran a trial merge of this branch (60a320fc, base d7974dc7) into current upstream/main to map the conflicts blocking this PR, since my #1547 waits on it. Good news: out of 16 touched files, everything auto-merges except a single hunk in src/graphics/presentation/window/vulkanWindow.cpp (~line 510).

Both sides append one conditional feature struct to the support-query pNext chain at the same spot (after the image-atomic-int64 link, before getFeatures2): this branch adds supported_min_lod, main has since added supported_barycentric (from #1590). The resolution is to keep both blocks:

	if (min_lod_extension) {
		supported_min_lod.pNext   = supported_features2.pNext;
		supported_features2.pNext = &supported_min_lod;
	}
	const bool barycentric_extension =
	    HasExtension(device_extensions, VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME);
	vk::PhysicalDeviceFragmentShaderBarycentricFeaturesKHR supported_barycentric {};
	if (barycentric_extension) {
		supported_barycentric.pNext = supported_features2.pNext;
		supported_features2.pNext   = &supported_barycentric;
	}

(Order between the two links is irrelevant; each just prepends.) The remaining auto-merged files most worth a second look after rebasing are descriptors.cpp, imageView.cpp, and the vulkanWindow regions around the request chain, since main moved nearby code. Happy to re-test my #1547 on top once this lands.

**@⁠theantipopau** on GitHub · 2026-10-18 23:01 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314#issuecomment-6256253672) @⁠wuboo I ran a trial merge of this branch (60a320fc, base d7974dc7) into current upstream/main to map the conflicts blocking this PR, since my #1547 waits on it. Good news: out of 16 touched files, everything auto-merges except a single hunk in src/graphics/presentation/window/vulkanWindow.cpp (~line 510). Both sides append one conditional feature struct to the support-query pNext chain at the same spot (after the image-atomic-int64 link, before getFeatures2): this branch adds supported_min_lod, main has since added supported_barycentric (from #1590). The resolution is to keep both blocks: ```cpp if (min_lod_extension) { supported_min_lod.pNext = supported_features2.pNext; supported_features2.pNext = &supported_min_lod; } const bool barycentric_extension = HasExtension(device_extensions, VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME); vk::PhysicalDeviceFragmentShaderBarycentricFeaturesKHR supported_barycentric {}; if (barycentric_extension) { supported_barycentric.pNext = supported_features2.pNext; supported_features2.pNext = &supported_barycentric; } ``` (Order between the two links is irrelevant; each just prepends.) The remaining auto-merged files most worth a second look after rebasing are descriptors.cpp, imageView.cpp, and the vulkanWindow regions around the request chain, since main moved nearby code. Happy to re-test my #1547 on top once this lands.
Author
Owner

@⁠wuboo on GitHub · 2026-10-19 00:48 UTC · original

@⁠theantipopau thanks for mapping that, it saved time. Rebased onto current main (099de8de) and resolved the vulkanWindow.cpp hunk exactly as you suggested, keeping both the min_lod and barycentric links in the query chain. I also re-checked descriptors.cpp, imageView.cpp and the device feature chain: no double pNext links, no use-before-declaration, and the remap only applies to non-storage, non-dynamic views. The build is clean and ctest shows no new failures against main. MinLodViewTests passes and its mutants are caught. Feel free to re-test #1547 on top.

**@⁠wuboo** on GitHub · 2026-10-19 00:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314#issuecomment-6257301561) @⁠theantipopau thanks for mapping that, it saved time. Rebased onto current main (099de8de) and resolved the vulkanWindow.cpp hunk exactly as you suggested, keeping both the min_lod and barycentric links in the query chain. I also re-checked descriptors.cpp, imageView.cpp and the device feature chain: no double pNext links, no use-before-declaration, and the remap only applies to non-storage, non-dynamic views. The build is clean and ctest shows no new failures against main. MinLodViewTests passes and its mutants are caught. Feel free to re-test #1547 on top.
@ -15380,0 +15413,4 @@
const auto make_shader = [](uint32_t dim) {
return std::array<uint32_t, 7>{
EncodeMimg0(0x0e, 0x9, false, dim),
EncodeMimg1(5, 0, 0, 1), // image_get_resinfo v5 (width, mip count)
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-19 00:55 UTC · original

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Set a LOD beyond the shifted view’s level count.

The query reads its LOD from v1, but this shader never sets v1. The array case therefore does not establish the past-the-view-levels condition described at Line 15405. Set v1 to a guest LOD that is valid in the 11-level T# and beyond the shifted view’s levels. Then check that the additional size query uses LOD 0, rather than checking only the number of queries.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-19 00:55 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314#discussion_r4309517272) **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Set a LOD beyond the shifted view’s level count.** The query reads its LOD from `v1`, but this shader never sets `v1`. The array case therefore does not establish the past-the-view-levels condition described at Line 15405. Set `v1` to a guest LOD that is valid in the 11-level T# and beyond the shifted view’s levels. Then check that the additional size query uses LOD 0, rather than checking only the number of queries. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:b55f4984f2da258517438631 --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -15380,0 +15422,4 @@
};
};
const auto shader_2d = make_shader(1u);
const auto shader_2d_array = make_shader(3u);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-19 00:55 UTC · original

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Encode the 2D-array instruction dimension.

make_shader(3u) encodes a cube dimension. The existing TestNewShaderRecompilerImageViewDimensions fixture uses 5u for a 2D-array MIMG instruction. Use 5u here so the array assertion tests the intended instruction, even if descriptor specialization selects an array view.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-19 00:55 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314#discussion_r4309517276) **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Encode the 2D-array instruction dimension.** `make_shader(3u)` encodes a cube dimension. The existing `TestNewShaderRecompilerImageViewDimensions` fixture uses `5u` for a 2D-array MIMG instruction. Use `5u` here so the array assertion tests the intended instruction, even if descriptor specialization selects an array view. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:a81843fc5a3fd2ae588b01ad --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-19 00:55 UTC · original · reviewed

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8d895d1f-823e-4e17-bc77-3d262d9b53e7
📥 Commits

Reviewing files that changed from the base of the PR and between 60a320fc2f3c0091c0b63b7d692d1b689a52b6b2 and 04bfddeea665ef831fe23537eb2b3208b2f96eef.

📒 Files selected for processing: 9
  • src/graphics/host_gpu/graphicContext.h
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
  • src/graphics/presentation/window/vulkanWindow.cpp
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.h
  • src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp
  • tests/shaderCfgTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-19 00:55 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1314#pullrequestreview-5565936615) · **reviewed** **Actionable comments posted: 2** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `8d895d1f-823e-4e17-bc77-3d262d9b53e7` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 60a320fc2f3c0091c0b63b7d692d1b689a52b6b2 and 04bfddeea665ef831fe23537eb2b3208b2f96eef. </details> <details> <summary>📒 Files selected for processing: 9</summary> * `src/graphics/host_gpu/graphicContext.h` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` * `src/graphics/presentation/window/vulkanWindow.cpp` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp` * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.h` * `src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp` * `tests/shaderCfgTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=2e1f08ec-4216-4485-b15e-e32e88243c2b attempt=09323668-a905-4b04-9221-a34c792f0bb4 batch=1/1 -->

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.