graphics: clamp host mip levels and gate layered block views #717

Open
github-bot wants to merge 6 commits from github-bot/gh-717 into main AGit
Owner

@⁠YuhiAida on GitHub · 2026-09-19 14:46 UTC · original
YuhiAida:vulkan-shared-validations-dq7-issues → main · +225 −42 · 8 files · 6 commits · open

Summary

Running Dragon Quest VII Reimagined (PPSA17942) with VK_LAYER_KHRONOS_validation enabled takes
the emulator down twice during early gameplay, with a fatal validation error each time:

  • VUID-VkImageCreateInfo-mipLevels-00958 — the guest can declare a mip tail deeper than the
    host image's mip chain allows, so vkCreateImage is rejected.
  • VUID-VkImageViewCreateInfo-image-09487 — a block-format (BC) view with layerCount > 1 is
    only legal with the maintenance6 blockTexelViewCompatibleMultipleLayers capability.

Both abort through EXIT, so they are fatal, not cosmetic. This PR removes both and keeps the
information needed to see where guest mip tails get mapped.

What changed

  • image.{h,cpp}: ImageOps::HostMipChainLength (bit_width(max(w,h,depth))) and
    ImageOps::HostMipLevels (min(guest levels, chain)); the host image is created with the
    clamped count. Barriers, resolves, copies and image-to-image transfers map a phantom guest
    range onto the deepest host level instead of referencing a level that does not exist.
  • ImageOps::ReportMipClamp logs one line per site (capped at 32 prints) when a range is
    clamped: address, type, format, extent, guest/host level counts, range, layers, samples,
    pitch, tile mode. Source and destination ranges are reported independently, so an out-of-chain
    source cannot hide behind a valid destination range.
  • textureCache.cpp: uploads drop regions above the host chain, ClearImage clamps to the
    deepest host level and derives full_image from the backing count, and
    SynchronizeBufferFromImage declines volume mip tails rather than reading levels the host
    image does not have.
  • imageView.cpp: view mip ranges are clamped the same way. A multi-layer uncompressed view of
    a block-compressed image is rejected before creation when the device lacks the capability,
    since the layer count cannot be legalised without maintenance6 and the driver would reject or
    misread the view.
  • vulkanWindow.cpp / graphicContext.h: VK_KHR_maintenance6 is enabled and
    VkPhysicalDeviceMaintenance6Properties::blockTexelViewCompatibleMultipleLayers is queried
    at device creation, with the result logged.

Nothing changes for images whose guest mip count already fits the host chain — HostMipLevels
returns the guest count in that case.

Evidence

With Vulkan validation, SPIR-V validation and GPU-AV enabled:

before after
result aborts with VUID-VkImageCreateInfo-mipLevels-00958 at guest 00:00:25.158 900 s run, guest 00:12:09, still presenting
validation errors 1 fatal (plus the follow-up) 0
clamp diagnostics – 2 create / 15 view / 15 barrier reports, all inside guest 00:00:24.69–25.24

The clamp reports land in exactly the window where the unfixed build died, and the post-fix run
carries none of the previous [Vulkan][E] output. The capability line reports
Vulkan block texel view multiple layers support: true on the development GPU, so the layered
block view is created natively there; the rejection path covers devices that report false.

A later 120 s run of the current head with validation enabled and no vk_layer_settings.txt
present (no VUID muting) reports 0 errors and only the pre-existing out_mrt_0 draw warning
(10 lines, the layer's duplicate-message limit), so the result does not depend on muting any
VUID.

Gameplay reaches and passes the second stop on hardware — that is the only confirmation for the
09487 site, since the pre-fix abort makes an automated A/B of that exact content point
impractical.

Tests

  • kyty_tests builds.
  • Host-side (GPU present): image_page_table, gpu_tiler, texture_cache_layered_image,
    host_image_allocation, texture_cache_image_views, texture_cache_storage_sampled,
    texture_cache_depth_readback, compute_meta_clear_classification, buffer_cache_dirty_gc
    all pass. (The graphics tests need a real device — they abort with ErrorIncompatibleDriver
    in the build container.)
  • CLI tests (emulator_user_name_cli, emulator_user_name_too_long,
    emulator_present_mode_cli, emulator_present_mode_invalid) pass in the container.

Notes for reviewers

  • Phantom guest levels are mapped, not emulated: no data is stored for a mip level the host
    chain does not have, and transfers that would need it are skipped or declined (volume mip
    tails), with a report line. If a title is later found to genuinely depend on reading such a
    level, that case needs a real fix in the guest mip layout handling rather than this clamp.
  • ImageOps::ReportMipClamp is a diagnostic; it is intentionally not gated behind a config
    flag, but is capped at 32 lines per site so it cannot flood the log.
**@⁠YuhiAida** on GitHub · 2026-09-19 14:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/717) `YuhiAida:vulkan-shared-validations-dq7-issues` → `main` · +225 −42 · 8 files · 6 commits · open ## Summary Running Dragon Quest VII Reimagined (PPSA17942) with `VK_LAYER_KHRONOS_validation` enabled takes the emulator down twice during early gameplay, with a fatal validation error each time: - `VUID-VkImageCreateInfo-mipLevels-00958` — the guest can declare a mip tail deeper than the host image's mip chain allows, so `vkCreateImage` is rejected. - `VUID-VkImageViewCreateInfo-image-09487` — a block-format (BC) view with `layerCount > 1` is only legal with the maintenance6 `blockTexelViewCompatibleMultipleLayers` capability. Both abort through `EXIT`, so they are fatal, not cosmetic. This PR removes both and keeps the information needed to see where guest mip tails get mapped. ## What changed - `image.{h,cpp}`: `ImageOps::HostMipChainLength` (`bit_width(max(w,h,depth))`) and `ImageOps::HostMipLevels` (`min(guest levels, chain)`); the host image is created with the clamped count. Barriers, resolves, copies and image-to-image transfers map a phantom guest range onto the deepest host level instead of referencing a level that does not exist. - `ImageOps::ReportMipClamp` logs one line per site (capped at 32 prints) when a range is clamped: address, type, format, extent, guest/host level counts, range, layers, samples, pitch, tile mode. Source and destination ranges are reported independently, so an out-of-chain source cannot hide behind a valid destination range. - `textureCache.cpp`: uploads drop regions above the host chain, `ClearImage` clamps to the deepest host level and derives `full_image` from the backing count, and `SynchronizeBufferFromImage` declines volume mip tails rather than reading levels the host image does not have. - `imageView.cpp`: view mip ranges are clamped the same way. A multi-layer uncompressed view of a block-compressed image is rejected before creation when the device lacks the capability, since the layer count cannot be legalised without maintenance6 and the driver would reject or misread the view. - `vulkanWindow.cpp` / `graphicContext.h`: `VK_KHR_maintenance6` is enabled and `VkPhysicalDeviceMaintenance6Properties::blockTexelViewCompatibleMultipleLayers` is queried at device creation, with the result logged. Nothing changes for images whose guest mip count already fits the host chain — `HostMipLevels` returns the guest count in that case. ## Evidence With Vulkan validation, SPIR-V validation and GPU-AV enabled: | | before | after | |---|---|---| | result | aborts with `VUID-VkImageCreateInfo-mipLevels-00958` at guest `00:00:25.158` | 900 s run, guest `00:12:09`, still presenting | | validation errors | 1 fatal (plus the follow-up) | 0 | | clamp diagnostics | – | 2 create / 15 view / 15 barrier reports, all inside guest `00:00:24.69–25.24` | The clamp reports land in exactly the window where the unfixed build died, and the post-fix run carries none of the previous `[Vulkan][E]` output. The capability line reports `Vulkan block texel view multiple layers support: true` on the development GPU, so the layered block view is created natively there; the rejection path covers devices that report `false`. A later 120 s run of the current head with validation enabled and no `vk_layer_settings.txt` present (no VUID muting) reports 0 errors and only the pre-existing `out_mrt_0` draw warning (10 lines, the layer's duplicate-message limit), so the result does not depend on muting any VUID. Gameplay reaches and passes the second stop on hardware — that is the only confirmation for the `09487` site, since the pre-fix abort makes an automated A/B of that exact content point impractical. ## Tests - `kyty_tests` builds. - Host-side (GPU present): `image_page_table`, `gpu_tiler`, `texture_cache_layered_image`, `host_image_allocation`, `texture_cache_image_views`, `texture_cache_storage_sampled`, `texture_cache_depth_readback`, `compute_meta_clear_classification`, `buffer_cache_dirty_gc` all pass. (The graphics tests need a real device — they abort with `ErrorIncompatibleDriver` in the build container.) - CLI tests (`emulator_user_name_cli`, `emulator_user_name_too_long`, `emulator_present_mode_cli`, `emulator_present_mode_invalid`) pass in the container. ## Notes for reviewers - Phantom guest levels are *mapped*, not emulated: no data is stored for a mip level the host chain does not have, and transfers that would need it are skipped or declined (volume mip tails), with a report line. If a title is later found to genuinely depend on reading such a level, that case needs a real fix in the guest mip layout handling rather than this clamp. - `ImageOps::ReportMipClamp` is a diagnostic; it is intentionally not gated behind a config flag, but is capped at 32 lines per site so it cannot flood the log.
Guest textures may declare more mip levels than the host image chain allows,
so vkCreateImage tripped VUID-VkImageCreateInfo-mipLevels-00958, and block
formats could build views with layerCount > 1 without the maintenance6
capability, tripping VUID-VkImageViewCreateInfo-image-09487. Both were fatal
and aborted the emulator during early gameplay.

- Derive the host mip count from min(guest levels, mip chain length) and bound
  every consumer (barriers, resolve, copy, clear, transfers, buffer sync) to
  the host chain.
- Report mapped ranges once per site via ImageOps::ReportMipClamp so clamped
  guest mip tails are visible in logs.
- Enable VK_KHR_maintenance6, query blockTexelViewCompatibleMultipleLayers and
  warn once when a layered block view is created without support.

Verified with the validation layers enabled: the fatal error at guest ~25s is
gone, a 900s run logs no validation errors, and gameplay proceeds past the
point that previously crashed.

Co-authored-by: Copilot <[email protected]>
Report source and destination mip overflows separately in Image::Resolve: an
out-of-chain source range used to be reported against the destination range, so
that report was suppressed and the overflow stayed invisible.

Reject multi-layer uncompressed views of block-compressed images before view
creation when VK_KHR_maintenance6 is unavailable instead of logging and issuing
an invalid view whose layer count the driver would reject or misread.

Co-authored-by: Copilot <[email protected]>
Image::CopyMip and Image::Resolve silently return when the guest mip
level is beyond the host mip chain, but TextureCache::CopyImageMip marked
the destination GPU-modified regardless and ResolveColorTargets marked the
render target written before the resolve ran. Either case leaves the host
side claiming ownership of contents that were never transferred, so a
later write-back could treat stale pixels as authoritative.

Return bool from both and only claim ownership on a recorded transfer.

Also give ReportMipClamp a per-site report budget instead of one shared
cap of 32, which view/barriers reports were saturating and hiding the
other sites' counts.
Bring the mip clamp and block view gating onto main's clear/stencil and
device property code.

Conflict resolution:
- src/graphics/host_gpu/renderer/cache/textureCache.cpp: kept 717's
  raw_range clamp onto the host mip chain and main's full_subresources,
  and derived full_image from the clamped host range.
- src/graphics/presentation/window/vulkanWindow.cpp: chained
  PhysicalDeviceMaintenance6Properties after main's FloatControls
  properties so both structs are still queried.
Bring the mip clamp and block view gating onto main's current tree.

Conflict resolution:
- src/graphics/host_gpu/renderer/image/image.cpp: kept both include
  sets (bit/cinttypes/string_view for the clamp reporting helpers,
  atomic/fmt for main's code).
- src/graphics/presentation/window/vulkanWindow.cpp: kept both
  VK_KHR_MAINTENANCE_6 (block texel view gating) and
  VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT (main) in the enabled
  extension list.
- src/graphics/host_gpu/renderer/cache/textureCache.cpp: kept 717's
  raw_range clamp onto the host mip chain together with main's
  full_subresources, and derived full_image from the clamped range.
Image::CopyMip returns false when the destination has no host level for the
requested mip, which is now reachable because the host chain is clamped to
min(guest levels, mip chain length). TextureCache::CopyImageMip returned early
on it, but both callers freed the source unconditionally, so FreeImage cleared
the GPU-modified mark and deleted pixels that the destination cannot hold and
the guest address space no longer has.

Return bool from CopyImageMip and free the source through a new FreeCopySource
only once the transfer happened or the source is not GPU-modified. A retained
source keeps its mark, so the garbage collector reclaims it by downloading it
first, which is the same rule the GC already applies to every other
GPU-modified image.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:30:35 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-19 15:00 UTC · original · edited 2026-09-29 20:26 UTC

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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.

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

Walkthrough

Image creation now caps mip levels to the host-supported chain. Image operations, texture transfers, clears, and buffer synchronization account for guest mip ranges beyond that chain. Resolve and copy operations return status, and callers use that status when updating GPU-written state and freeing copy sources. Vulkan setup records Maintenance 6 support for multi-layer block-texel views. Image-view creation clamps mip ranges and stops when the required capability is unavailable.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: 🔵 Low · up to b79a3

A narrow unremapped-volume case can make a buffer copy use stale contents instead of GPU-written image data. Prevent the copy when synchronization fails; the impact is bounded but should be addressed.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to b79a3

A guest-declared volume mip tail can now prevent an image-to-buffer update while a later buffer copy continues. That may produce stale data. The review found no demonstrated escape beyond the emulator’s graphics data flow.

Retained concerns

  • Medium · reliability · inferred: A volume image with guest mip levels beyond its host chain is refused for GPU-to-buffer synchronization, but the buffer-copy path proceeds without observing that failure. It can consume buffer contents that were not refreshed from the GPU-written image; the available evidence does not establish disclosure across an isolation boundary.
Security review details

Security Blast Radius

  • inferred — The evidenced failure path concerns GPU-written image data used by buffer operations in the same renderer. Its effects beyond that graphics-data flow, including any isolation-boundary exposure, are not established.

Trust Boundaries and Controls

  • observed — Host mip bounds prevent transfers to nonexistent host levels, while failed mip copies preserve GPU-modified source ownership. Buffer acquisition does not enforce the corresponding image-to-buffer synchronization result.

Resilience and Maintainability Implications

  • inferred — Retaining a GPU-modified source contains loss after a skipped mip copy, but the newly rejected volume download leaves later buffer use without a proven fresh-data owner.

Hardening Proposals

  • proposed — Propagate an image-to-buffer synchronization failure to operations requiring fresh GPU-written data, or provide a bounded volume-download path before allowing those operations to proceed.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 32 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: clamping host mip levels and gating layered block views.
Description check ✅ Passed The description directly explains the Vulkan validation failures, the implemented mip-level and layered-view fixes, diagnostics, and test results.
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.

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-09-19 15:00 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/717#issuecomment-5742875580) · edited 2026-09-29 20:26 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/717?cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> Navigate logical layers of code changes, visualize relationships, and explore their blast radius. <!-- 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. > > 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>📝 Walkthrough</summary> ## Walkthrough Image creation now caps mip levels to the host-supported chain. Image operations, texture transfers, clears, and buffer synchronization account for guest mip ranges beyond that chain. Resolve and copy operations return status, and callers use that status when updating GPU-written state and freeing copy sources. Vulkan setup records Maintenance 6 support for multi-layer block-texel views. Image-view creation clamps mip ranges and stops when the required capability is unavailable. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"b79a361af2bf28598554d71916b338ecd6686879" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _🔵 Low_ · up to `b79a3` <!-- final_review_risk_coverage:{"sourceCommitId":"b79a361af2bf28598554d71916b338ecd6686879","coveredCommitId":"b79a361af2bf28598554d71916b338ecd6686879","kind":"reviewed"} --> A narrow unremapped-volume case can make a buffer copy use stale contents instead of GPU-written image data. Prevent the copy when synchronization fails; the impact is bounded but should be addressed. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Security Architecture Review **Security architecture risk:** _🟡 Moderate_ · up to `b79a3` A guest-declared volume mip tail can now prevent an image-to-buffer update while a later buffer copy continues. That may produce stale data. The review found no demonstrated escape beyond the emulator’s graphics data flow. **Retained concerns** - **Medium · reliability · inferred:** A volume image with guest mip levels beyond its host chain is refused for GPU-to-buffer synchronization, but the buffer-copy path proceeds without observing that failure. It can consume buffer contents that were not refreshed from the GPU-written image; the available evidence does not establish disclosure across an isolation boundary. <details> <summary>Security review details</summary> **Security Blast Radius** - _inferred_ — The evidenced failure path concerns GPU-written image data used by buffer operations in the same renderer. Its effects beyond that graphics-data flow, including any isolation-boundary exposure, are not established. **Trust Boundaries and Controls** - _observed_ — Host mip bounds prevent transfers to nonexistent host levels, while failed mip copies preserve GPU-modified source ownership. Buffer acquisition does not enforce the corresponding image-to-buffer synchronization result. **Resilience and Maintainability Implications** - _inferred_ — Retaining a GPU-modified source contains loss after a skipped mip copy, but the newly rejected volume download leaves later buffer use without a proven fresh-data owner. **Hardening Proposals** - _proposed_ — Propagate an image-to-buffer synchronization failure to operations requiring fresh GPU-written data, or provide a bounded volume-download path before allowing those operations to proceed. </details> <!-- architecture_review_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 9.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 32 functions across 8 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly summarizes the main changes: clamping host mip levels and gating layered block views. | | Description check | ✅ Passed | The description directly explains the Vulkan validation failures, the implemented mip-level and layered-view fixes, diagnostics, and test results. | | 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. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=717)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [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) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Do not mark the destination GPU-modified when no copy occurs. · textureCache.cpp:697-700

src/graphics/host_gpu/renderer/cache/textureCache.cpp:697-700
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not mark the destination GPU-modified when no copy occurs.

When mip >= destination.backing.mip_levels, Image::CopyMip returns without copying. Both ResolveDepthOverlap and ExpandImage can pass a guest mip beyond the host mip chain, and neither caller checks this condition. TextureCache::CopyImageMip then marks the unchanged destination GPU-modified. A later download can treat its stale host-backed pixels as authoritative guest data.

Make CopyMip report whether it copied, and mark the destination only on success. Alternatively, check the destination mip bounds in TextureCache::CopyImageMip before updating ownership.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 0cf252c6-0f35-4985-b98b-57088cac11bb

📥 Commits

Reviewing files that changed from the base of the PR and between f100f785da and 2d5e6cde23.

📒 Files selected for processing (6)
  • src/graphics/host_gpu/graphicContext.h
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/image/image.cpp
  • src/graphics/host_gpu/renderer/image/image.h
  • src/graphics/host_gpu/renderer/image/imageView.cpp
  • src/graphics/presentation/window/vulkanWindow.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-19 15:00 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/717#pullrequestreview-5256096037) · **reviewed** **Actionable comments posted: 2** > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to GitHub limitations. > > **⚠️ Outside diff range comments (1)** > > <details> > <summary><em>🟠 Major</em> · Do not mark the destination GPU-modified when no copy occurs. · <code>textureCache.cpp:697-700</code></summary><blockquote> > > `src/graphics/host_gpu/renderer/cache/textureCache.cpp:697-700` > _🗄️ Data Integrity & Integration_ | _🟠 Major_ | _⚡ Quick win_ > > **Do not mark the destination GPU-modified when no copy occurs.** > > When `mip >= destination.backing.mip_levels`, `Image::CopyMip` returns without copying. Both `ResolveDepthOverlap` and `ExpandImage` can pass a guest mip beyond the host mip chain, and neither caller checks this condition. `TextureCache::CopyImageMip` then marks the unchanged destination GPU-modified. A later download can treat its stale host-backed pixels as authoritative guest data. > > Make `CopyMip` report whether it copied, and mark the destination only on success. Alternatively, check the destination mip bounds in `TextureCache::CopyImageMip` before updating ownership. > > <!-- cr-comment:v1:334714b53dfdf40fc478514a --> > > </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `0cf252c6-0f35-4985-b98b-57088cac11bb` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between f100f785dafa108bbf5b40ea8e425e08236f981a and 2d5e6cde238127dd104c6fb84711a535c9dc40a5. </details> <details> <summary>📒 Files selected for processing (6)</summary> * `src/graphics/host_gpu/graphicContext.h` * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/image/image.cpp` * `src/graphics/host_gpu/renderer/image/image.h` * `src/graphics/host_gpu/renderer/image/imageView.cpp` * `src/graphics/presentation/window/vulkanWindow.cpp` </details> **Included review availability:** Your plan provides up to 10 included reviews per hour; 9 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-19 15:00 UTC · original · edited 2026-09-19 15:16 UTC
On src/graphics/host_gpu/renderer/image/image.cpp line 385 (outdated):

@@ -370,11 +378,15 @@ void Image::CopyImage(Image& source) {
 
 void Image::Resolve(Image& source, const ImageSubresourceRange& source_range,
                     const ImageSubresourceRange& destination_range) {
+	if (source_range.base_level >= source.backing.mip_levels ||
+	    destination_range.base_level >= backing.mip_levels) {
+		ImageOps::ReportMipClamp("resolve", info, destination_range.base_level,
+		                         destination_range.level_count);
+		return;

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '350,410p' src/graphics/host_gpu/renderer/image/image.cpp
sed -n '650,705p' src/graphics/host_gpu/renderer/image/image.cpp

Repository: KytyPS5/KytyPS5

Length of output: 5655


🏁 Script executed:

sed -n '370,425p' src/graphics/host_gpu/renderer/image/image.cpp
rg -n -C 4 'ReportMipClamp' src/graphics/host_gpu/renderer/image/image.cpp

Repository: KytyPS5/KytyPS5

Length of output: 5815


Report source and destination mip overflows separately.

When only source_range.base_level is unavailable, the current call reports the valid destination range against info. ReportMipClamp can return without logging, so the source overflow is suppressed. Report source_range against source.info when the source check fails, and report destination_range against info when the destination check fails.

✅ Addressed in commit 35de8b9

**@⁠coderabbitai[bot]** on GitHub · 2026-09-19 15:00 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/717#discussion_r4053524494) · edited 2026-09-19 15:16 UTC On `src/graphics/host_gpu/renderer/image/image.cpp` line 385 (outdated): ```diff @@ -370,11 +378,15 @@ void Image::CopyImage(Image& source) { void Image::Resolve(Image& source, const ImageSubresourceRange& source_range, const ImageSubresourceRange& destination_range) { + if (source_range.base_level >= source.backing.mip_levels || + destination_range.base_level >= backing.mip_levels) { + ImageOps::ReportMipClamp("resolve", info, destination_range.base_level, + destination_range.level_count); + return; ``` _🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '350,410p' src/graphics/host_gpu/renderer/image/image.cpp sed -n '650,705p' src/graphics/host_gpu/renderer/image/image.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 5655 --- 🏁 Script executed: ```bash sed -n '370,425p' src/graphics/host_gpu/renderer/image/image.cpp rg -n -C 4 'ReportMipClamp' src/graphics/host_gpu/renderer/image/image.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 5815 --- </details> **Report source and destination mip overflows separately.** When only `source_range.base_level` is unavailable, the current call reports the valid destination range against `info`. `ReportMipClamp` can return without logging, so the source overflow is suppressed. Report `source_range` against `source.info` when the source check fails, and report `destination_range` against `info` when the destination check fails. <!-- fingerprinting:phantom:medusa:quokka --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:ff12963fe865d375d0e84a6c --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 35de8b9
@ -360,0 +371,4 @@
if (static_cast<bool>(image.flags & vk::ImageCreateFlagBits::eBlockTexelViewCompatible) &&
normalized.layer_count > 1 &&
(ImageViewOps::FormatClass(normalized.format) & ImageViewOps::BlockFormatClasses) == 0 &&
!m_graphics.supports_block_texel_view_multiple_layers) {
Author
Owner

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '300,430p' src/graphics/host_gpu/renderer/image/imageView.cpp
rg -n 'supports_block_texel_view_multiple_layers|blockTexelViewCompatibleMultipleLayers|09487|createImageView' src

Repository: KytyPS5/KytyPS5

Length of output: 7238


🌐 Web query:

site:registry.khronos.org/vulkan/specs/latest/html VK_KHR_maintenance6 blockTexelViewCompatibleMultipleLayers uncompressed layerCount image view

💡 Result:

<search_synthesis>
The requested feature blockTexelViewCompatibleMultipleLayers is not present in the current Vulkan specification documentation provided. Based on the available search results, there is no information confirming the existence or definition of a feature by that name within the VK_KHR_maintenance6 extension or the broader Vulkan specification [1].
</search_synthesis>

<source_evidence>

https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html * 12.3 ... * 12.4. Image Layouts * 12.5. Image Views * 12.6. Acceleration Structures ... * Appendix C: Compressed Image Formats * Block-Compressed Image Formats * ETC Compressed Image Formats * ASTC Compressed Image Formats * PVRTC Compressed Image Formats

Citations:


🌐 Web query:

Vulkan specification VK_KHR_maintenance6 blockTexelViewCompatibleMultipleLayers layerCount uncompressed format VUID

💡 Result:

<search_synthesis>
The Vulkan extension VK_KHR_maintenance6 (now part of Vulkan 1.4) introduced the blockTexelViewCompatibleMultipleLayers property to address restrictions on creating image views with the VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag [1][2][3]. Prior to this extension, the Vulkan specification required that if an image was created with the VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag, the levelCount and layerCount members of the subresourceRange had to be exactly 1 [4]. This restriction was enforced by validation layers, often associated with VUID-VkImageViewCreateInfo-image-01584 [4]. The blockTexelViewCompatibleMultipleLayers property, found in the VkPhysicalDeviceMaintenance6Properties structure, allows an implementation to indicate whether it supports creating such image views with a layerCount greater than 1 [2][3]. If this property is VK_TRUE, the restriction requiring a layerCount of 1 is lifted for that implementation [2][3]. If an application attempts to create an image view with a layerCount greater than 1 while using the VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag on an implementation where blockTexelViewCompatibleMultipleLayers is VK_FALSE, it will trigger a validation error [4][2]. Applications should query this property via vkGetPhysicalDeviceProperties2 before attempting to create multi-layer views with block-compressed formats [2][5].
</search_synthesis>

<source_evidence>

https://docs.vulkan.org/features/latest/features/proposals/VK_KHR_maintenance6.html Creating image views with`VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT` and multiple layers is supported by all modern hardware, so this should be exposed by the API. ... ``` typedef struct VkPhysicalDeviceMaintenance6PropertiesKHR { VkStructureType sType; void* pNext; VkBool32 blockTexelViewCompatibleMultipleLayers; uint32_t maxCombinedImageSamplerDescriptorCount; VkBool32 fragmentShadingRateClampCombinerInputs; } VkPhysicalDeviceMaintenance6PropertiesKHR; ... The`blockTexelViewCompatibleMultipleLayers` property indicates whether a`VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT` can be used with a`layerCount` of greater than`1`. ... The`maxCombinedImageSamplerDescriptorCount` property indicates the maximum number of descriptors needed for any of the multi-planar formats supported by the implementation that require`YCbCr` conversion . https://docs.vulkan.org/refpages/latest/refpages/source/VkPhysicalDeviceMaintenance6Properties.html VkPhysicalDeviceMaintenance6Properties(3) :: Vulkan Documentation Project # VkPhysicalDeviceMaintenance6Properties(3) ## Name VkPhysicalDeviceMaintenance6Properties - Structure describing various implementation-defined properties introduced with VK_KHR_maintenance6 ## C Specification The`VkPhysicalDeviceMaintenance6Properties` structure is defined as: ``` // Provided by VK_VERSION_1_4 typedef struct VkPhysicalDeviceMaintenance6Properties { VkStructureType sType; void* pNext; VkBool32 blockTexelViewCompatibleMultipleLayers; uint32_t maxCombinedImageSamplerDescriptorCount; VkBool32 fragmentShadingRateClampCombinerInputs; } VkPhysicalDeviceMaintenance6Properties; ``` c Copied! ``` // Provided by VK_KHR_maintenance6 // Equivalent to VkPhysicalDeviceMaintenance6Properties typedef VkPhysicalDeviceMaintenance6Properties VkPhysicalDeviceMaintenance6PropertiesKHR; ``` c Copied! ## Members `sType` is a VkStructureType value identifying this structure. `pNext` is`NULL` or a pointer to a structure extending this structure. ## Description `blockTexelViewCompatibleMultipleLayers` is a boolean value indicating that an implementation supports creating image views with VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT where the`layerCount` member of`subresourceRange` is greater than`1`. `maxCombinedImageSamplerDescriptorCount` is the maximum number of combined image sampler descriptors that the implementation uses to access any of the formats that require a sampler Y′CBCR conversion supported by the implementation. `fragmentShadingRateClampCombinerInputs` is a boolean value indicating that an implementation clamps the inputs to combiner operations. If the`VkPhysicalDeviceMaintenance6Properties` structure is included in the`pNext` chain of the VkPhysicalDeviceProperties2 structure passed to vkGetPhysicalDeviceProperties2, it is filled in with each corresponding implementation-dependent property. Valid Usage (Implicit) VUID-VkPhysicalDeviceMaintenance6Properties-sType-sType`sType` must be VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_6_PROPERTIES Structure Chaining ## See Also VK_KHR_maintenance6, VK_VERSION_1_4,`VkBool32`, VkStructureType ## Document Notes For more information, see the Vulkan Specification. This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly. https://vulkan.lunarg.com/doc/view/1.4.335.0/linux/antora/refpages/latest/refpages/source/VkPhysicalDeviceMaintenance6Properties.html VkPhysicalDeviceMaintenance6Properties(3) :: Vulkan Documentation Project # VkPhysicalDeviceMaintenance6Properties(3) ## Name VkPhysicalDeviceMaintenance6Properties - Structure describing various implementation-defined properties introduced with VK_KHR_maintenance6 ## C Specification The`VkPhysicalDeviceMaintenance6Properties` structure is defined as: ``` // Provided by VK_VERSION_1_4 typedef struct VkPhysicalDeviceMaintenance6Properties { VkStructureType sType; void* pNext; VkBool32 blockTexelViewCompatibleMultipleLayers; uint32_t maxCombinedImageSamplerDescriptorCount; VkBool32 fragmentShadingRateClampCombinerInputs; } VkPhysicalDeviceMaintenance6Properties; ``` ``` // Provided by VK_KHR_maintenance6 // Equivalent to VkPhysicalDeviceMaintenance6Properties typedef VkPhysicalDeviceMaintenance6Properties VkPhysicalDeviceMaintenance6PropertiesKHR; ``` ## Members `sType` is a VkStructureType value identifying this structure. `pNext` is`NULL` or a pointer to a structure extending this structure. ## Description `blockTexelViewCompatibleMultipleLayers` is a boolean value indicating that an implementation supports creating image views with`VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT` where the`layerCount` member of`subresourceRange` is greater than`1`. `maxCombinedImageSamplerDescriptorCount` is the maximum number of combined image sampler descriptors that the implementation uses to access any of the formats that require a sampler Y′CBCR conversion supported by the implementation. `fragmentShadingRateClampCombinerInputs` is a boolean value indicating that an implementation clamps the inputs to combiner operations. If the`VkPhysicalDeviceMaintenance6Properties` structure is included in the`pNext` chain of the VkPhysicalDeviceProperties2 structure passed to vkGetPhysicalDeviceProperties2, it is filled in with each corresponding implementation-dependent property. Valid Usage (Implicit) VUID-VkPhysicalDeviceMaintenance6Properties-sType-sType`sType` must be`VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_6_PROPERTIES` ## See Also VK_KHR_maintenance6, VK_VERSION_1_4,`VkBool32`, VkStructureType ## Document Notes For more information, see the Vulkan Specification. This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly. GitHub issue 1495 in KhronosGroup/Vulkan-ValidationLayers (link omitted to avoid creating a cross-reference) `vkCreateImageView(): pCreateInfo->format with tiling VK_IMAGE_TILING_OPTIMAL does not support usage that includes VK_IMAGE_USAGE_STORAGE_BIT. The Vulkan spec states: If usage contains VK_IMAGE_USAGE_STORAGE_BIT, then the image view&`#39`;s format features must contain VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT. (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkImageViewCreateInfo-usage-02275)` ... This is made possible by two flags introduced in [vk_khr_maintenance2](https://github.com/KhronosGroup/Vulkan-Docs/blob/master/appendices/VK_KHR_maintenance2.txt). ... VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag allows to create an image view with an uncompressed format of an image with a compressed format. ... VK_IMAGE_CREATE_EXTENDED_USAGE_BIT allows to create images with incompatible format/usages. This is necessary because compressed formats doesn&`#39`;t allow the storage bit. Which means it would be impossible to create the image, but it would also be impossible to create an image view with the same format as the compressed image, used only for reading. ... This problem is referenced by ... 96. Assuming the above example is correct according to ... specs, there is no way ... validation layers to detect ... . VK_IMAGE_CREATE_EXTENDED_USAGE_BIT should only ... used in order ... , so shouldn&`#39`;t validation ... > ``` > VUID-VkImageCreateInfo-flags-01572 > If flags contains VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT, then format must be a > block-compressed image format, an ETC compressed image format, or an ASTC > compressed image format. ... > • VUID-VkImageCreateInfo-flags-01573 > If flags contains VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT, then flags must also > contain VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT. ... > • VUID-VkImageViewCreateInfo-image-01583 > If image was created with the VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag, > format must be compatible with, or must be an uncompressed format that is sizecompatible with, the format used to create image. > • VUID-VkImageViewCreateInfo-image-01584 > If image was created with the VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag, the > levelCount and layerCount members of subresourceRange must both be 1. > ``` ... > Sorry, I bumped this one towards the back of the wagon so many times it eventually _fell off_ ... wagon. > > I&`#39`;m not sure the original VUID (02275) can be reproduced, at least not without hitting `02251` first. I&`#39`;ve put up a change (`#3662`) that addresses the CTS error, and I _think_ it should resolve the one `@danginsburg` is seeing as well, but I&`#39`;m having hardware issues at the moment trying to get the original replay to work. I&`#39`;m not 100% sure my change is correct, though; I think it is, but the worry is that by using `VK_IMAGE_CREATE_EXTENDED_USAGE_BIT` one could create an image view later on that fails in the driver without triggering a validation message. I need to do some more testing on my part to try and verify that is working correctly. ... > EDIT: Sorry, I realize there is a `VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT` being used, so a "size-compatible uncompressed" format can be used which can support the format feature flag I guess > > --- > > So I was able to run `dEQP-VK.image.sample_texture.128_bit_compressed_format` and get the `VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251` error because it doesn&`#39`;t support the `VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT` bit > > > VK_IMAGE_CREATE_EXTENDED_USAGE_BIT allows to create images with incompatible format/usages. This is necessary because compressed formats doesn&`#39`;t allow the storage bit. Which means it would be impossible to create the image, but it would also be impossible to create an image view with the same format as the compressed image, used only for reading. > > I guess I don&`#39`;t see this as a Validation Layer…[truncated] https://vkdoc.net/man/VkPhysicalDeviceMaintenance6Features VkPhysicalDeviceMaintenance6Features - VulkanHub # VkPhysicalDeviceMaintenance6Features Structure describing whether the implementation supports maintenance6 functionality The `VkPhysicalDeviceMaintenance6Features` structure is defined as: C Rust ```c typedef struct VkPhysicalDeviceMaintenance6Features { VkStructureType sType; void* pNext; VkBool32 maintenance6; } VkPhysicalDeviceMaintenance6Features; ``` ```rs pub struct PhysicalDeviceMaintenance6Features { s_type: vk::StructureType, p_next: *mut c_void, maintenance6: vk::Bool32, } ``` ```c typedef VkPhysicalDeviceMaintenance6Features VkPhysicalDeviceMaintenance6FeaturesKHR; ``` ```rs type PhysicalDeviceMaintenance6FeaturesKHR = vk::PhysicalDeviceMaintenance6Features; ``` This structure describes the following feature: - `sType` is a VkStructureType value identifying this structure. - `pNext` is `NULL` or a pointer to a structure extending this structure. - EXTENSION FEATURES MAINTENANCE6 `maintenance6` indicates that the implementation supports the following: - VK_NULL_HANDLE can be used when binding an index buffer - VkBindMemoryStatus can be included in the `pNext` chain of the VkBindBufferMemoryInfo and VkBindImageMemoryInfo structures, enabling applications to retrieve VkResult values for individual memory binding operations. - VkPhysicalDeviceMaintenance6Properties::`blockTexelViewCompatibleMultipleLayers` property to indicate that the implementation supports creating image views with `VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT` where the `layerCount` member of `subresourceRange` is greater than `1`. - VkPhysicalDeviceMaintenance6Properties::`maxCombinedImageSamplerDescriptorCount` property which indicates the maximum descriptor size required for any format that requires a sampler Y′C B C R conversion supported by the implementation. - A VkPhysicalDeviceMaintenance6Properties::`fragmentShadingRateClampCombinerInputs` property which indicates whether the implementation clamps the inputs to fragment shading rate combiner operations. If the `VkPhysicalDeviceMaintenance6Features` structure is included in the `pNext` chain of the VkPhysicalDeviceFeatures2 structure passed to vkGetPhysicalDeviceFeatures2, it is filled in to indicate whether each corresponding feature is supported. If the application wishes to use a VkDevice with any features described by `VkPhysicalDeviceMaintenance6Features`, it must add an instance of the structure, with the desired feature members set to `VK_TRUE`, to the `pNext` chain of VkDeviceCreateInfo when creating the VkDevice. #### VUID-VkPhysicalDeviceMaintenance6Features-sType-sType `sType` must be `VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_6_FEATURES` Parent VK_VERSION_1_4 Type Structures Extends

Citations:


🌐 Web query:

site:registry.khronos.org/vulkan/specs/latest/html "blockTexelViewCompatibleMultipleLayers" "layerCount"

💡 Result:

<search_synthesis>
The requested term blockTexelViewCompatibleMultipleLayers does not appear in the provided search results from the Vulkan 1.4.362 specification. Consequently, there is no information available in the provided sources regarding its relationship with layerCount.
</search_synthesis>

<source_evidence>

https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html 45.1. Instance and Device Functionality * 45.2. Core Versions * 45.3. Layers * 45.4. Extensions * 45.5. Extension Dependencies * 45.6. Compatibility Guarantees (Informative) ... * Appendix E: Layers & Extensions (Informative) * Extension Dependencies

Citations:


🏁 Script executed:

python3 - <<'PY'
import urllib.request
url = "https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html"
try:
    data = urllib.request.urlopen(url, timeout=10).read().decode("utf-8", "replace")
    needle = "blockTexelViewCompatibleMultipleLayers"
    pos = data.find(needle)
    print("found", pos)
    print(data[max(0, pos-3000):pos+5000] if pos >= 0 else "not found")
except Exception as e:
    print(type(e).__name__, e)
PY

Repository: KytyPS5/KytyPS5

Length of output: 297


Reject unsupported multi-layer block-texel views before createImageView.

When supports_block_texel_view_multiple_layers is false, this branch only logs the unsupported request. createImageView then receives the unchanged multi-layer normalized.layer_count. Vulkan validation can report this invalid usage, and the implementation can reject image-view creation. This function calls EXIT when creation fails.

Reject the view before creation, or implement a per-layer fallback. Do not clamp layer_count.

Proposed guard
 	if (static_cast<bool>(image.flags & vk::ImageCreateFlagBits::eBlockTexelViewCompatible) &&
 	    normalized.layer_count > 1 &&
 	    (ImageViewOps::FormatClass(normalized.format) & ImageViewOps::BlockFormatClasses) == 0 &&
 	    !m_graphics.supports_block_texel_view_multiple_layers) {
+		EXIT("multi-layer block texel view requires VK_KHR_maintenance6\n");
 		static bool logged = false;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

	if (static_cast<bool>(image.flags & vk::ImageCreateFlagBits::eBlockTexelViewCompatible) &&
	    normalized.layer_count > 1 &&
	    (ImageViewOps::FormatClass(normalized.format) & ImageViewOps::BlockFormatClasses) == 0 &&
	    !m_graphics.supports_block_texel_view_multiple_layers) {
		EXIT("multi-layer block texel view requires VK_KHR_maintenance6\n");

✅ Addressed in commit 35de8b9

**@⁠coderabbitai[bot]** on GitHub · 2026-09-19 15:00 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/717#discussion_r4053524498) · edited 2026-09-19 15:16 UTC _🩺 Stability & Availability_ | _🟠 Major_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '300,430p' src/graphics/host_gpu/renderer/image/imageView.cpp rg -n 'supports_block_texel_view_multiple_layers|blockTexelViewCompatibleMultipleLayers|09487|createImageView' src ``` Repository: KytyPS5/KytyPS5 Length of output: 7238 --- 🌐 Web query: `site:registry.khronos.org/vulkan/specs/latest/html VK_KHR_maintenance6 blockTexelViewCompatibleMultipleLayers uncompressed layerCount image view` 💡 Result: <search_synthesis> The requested feature blockTexelViewCompatibleMultipleLayers is not present in the current Vulkan specification documentation provided. Based on the available search results, there is no information confirming the existence or definition of a feature by that name within the VK_KHR_maintenance6 extension or the broader Vulkan specification [1]. </search_synthesis> <source_evidence> <source> <title>Vulkan ® 1.4.308 - A Specification (with all registered extensions)</title> <location>https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html</location> <excerpt>* 12.3 ... * 12.4. Image Layouts * 12.5. Image Views * 12.6. Acceleration Structures ... * Appendix C: Compressed Image Formats * Block-Compressed Image Formats * ETC Compressed Image Formats * ASTC Compressed Image Formats * PVRTC Compressed Image Formats</excerpt> </source> </source_evidence> Citations: - 1: https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html --- 🌐 Web query: `Vulkan specification VK_KHR_maintenance6 blockTexelViewCompatibleMultipleLayers layerCount uncompressed format VUID` 💡 Result: <search_synthesis> The Vulkan extension VK_KHR_maintenance6 (now part of Vulkan 1.4) introduced the blockTexelViewCompatibleMultipleLayers property to address restrictions on creating image views with the VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag [1][2][3]. Prior to this extension, the Vulkan specification required that if an image was created with the VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag, the levelCount and layerCount members of the subresourceRange had to be exactly 1 [4]. This restriction was enforced by validation layers, often associated with VUID-VkImageViewCreateInfo-image-01584 [4]. The blockTexelViewCompatibleMultipleLayers property, found in the VkPhysicalDeviceMaintenance6Properties structure, allows an implementation to indicate whether it supports creating such image views with a layerCount greater than 1 [2][3]. If this property is VK_TRUE, the restriction requiring a layerCount of 1 is lifted for that implementation [2][3]. If an application attempts to create an image view with a layerCount greater than 1 while using the VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag on an implementation where blockTexelViewCompatibleMultipleLayers is VK_FALSE, it will trigger a validation error [4][2]. Applications should query this property via vkGetPhysicalDeviceProperties2 before attempting to create multi-layer views with block-compressed formats [2][5]. </search_synthesis> <source_evidence> <source> <title>VK_KHR_maintenance6 :: Vulkan Documentation Project</title> <location>https://docs.vulkan.org/features/latest/features/proposals/VK_KHR_maintenance6.html</location> <excerpt>Creating image views with`VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT` and multiple layers is supported by all modern hardware, so this should be exposed by the API. ... ``` typedef struct VkPhysicalDeviceMaintenance6PropertiesKHR { VkStructureType sType; void* pNext; VkBool32 blockTexelViewCompatibleMultipleLayers; uint32_t maxCombinedImageSamplerDescriptorCount; VkBool32 fragmentShadingRateClampCombinerInputs; } VkPhysicalDeviceMaintenance6PropertiesKHR; ... The`blockTexelViewCompatibleMultipleLayers` property indicates whether a`VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT` can be used with a`layerCount` of greater than`1`. ... The`maxCombinedImageSamplerDescriptorCount` property indicates the maximum number of descriptors needed for any of the multi-planar formats supported by the implementation that require`YCbCr` conversion .</excerpt> </source> <source> <title>VkPhysicalDeviceMaintenance6Properties(3) :: Vulkan Documentation Project</title> <location>https://docs.vulkan.org/refpages/latest/refpages/source/VkPhysicalDeviceMaintenance6Properties.html</location> <excerpt>VkPhysicalDeviceMaintenance6Properties(3) :: Vulkan Documentation Project # VkPhysicalDeviceMaintenance6Properties(3) ## Name VkPhysicalDeviceMaintenance6Properties - Structure describing various implementation-defined properties introduced with VK_KHR_maintenance6 ## C Specification The`VkPhysicalDeviceMaintenance6Properties` structure is defined as: ``` // Provided by VK_VERSION_1_4 typedef struct VkPhysicalDeviceMaintenance6Properties { VkStructureType sType; void* pNext; VkBool32 blockTexelViewCompatibleMultipleLayers; uint32_t maxCombinedImageSamplerDescriptorCount; VkBool32 fragmentShadingRateClampCombinerInputs; } VkPhysicalDeviceMaintenance6Properties; ``` c Copied! ``` // Provided by VK_KHR_maintenance6 // Equivalent to VkPhysicalDeviceMaintenance6Properties typedef VkPhysicalDeviceMaintenance6Properties VkPhysicalDeviceMaintenance6PropertiesKHR; ``` c Copied! ## Members `sType` is a VkStructureType value identifying this structure. `pNext` is`NULL` or a pointer to a structure extending this structure. ## Description `blockTexelViewCompatibleMultipleLayers` is a boolean value indicating that an implementation supports creating image views with VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT where the`layerCount` member of`subresourceRange` is greater than`1`. `maxCombinedImageSamplerDescriptorCount` is the maximum number of combined image sampler descriptors that the implementation uses to access any of the formats that require a sampler Y′CBCR conversion supported by the implementation. `fragmentShadingRateClampCombinerInputs` is a boolean value indicating that an implementation clamps the inputs to combiner operations. If the`VkPhysicalDeviceMaintenance6Properties` structure is included in the`pNext` chain of the VkPhysicalDeviceProperties2 structure passed to vkGetPhysicalDeviceProperties2, it is filled in with each corresponding implementation-dependent property. Valid Usage (Implicit) VUID-VkPhysicalDeviceMaintenance6Properties-sType-sType`sType` must be VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_6_PROPERTIES Structure Chaining ## See Also VK_KHR_maintenance6, VK_VERSION_1_4,`VkBool32`, VkStructureType ## Document Notes For more information, see the Vulkan Specification. This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.</excerpt> </source> <source> <title>VkPhysicalDeviceMaintenance6Properties(3) :: Vulkan Documentation Project</title> <location>https://vulkan.lunarg.com/doc/view/1.4.335.0/linux/antora/refpages/latest/refpages/source/VkPhysicalDeviceMaintenance6Properties.html</location> <excerpt>VkPhysicalDeviceMaintenance6Properties(3) :: Vulkan Documentation Project # VkPhysicalDeviceMaintenance6Properties(3) ## Name VkPhysicalDeviceMaintenance6Properties - Structure describing various implementation-defined properties introduced with VK_KHR_maintenance6 ## C Specification The`VkPhysicalDeviceMaintenance6Properties` structure is defined as: ``` // Provided by VK_VERSION_1_4 typedef struct VkPhysicalDeviceMaintenance6Properties { VkStructureType sType; void* pNext; VkBool32 blockTexelViewCompatibleMultipleLayers; uint32_t maxCombinedImageSamplerDescriptorCount; VkBool32 fragmentShadingRateClampCombinerInputs; } VkPhysicalDeviceMaintenance6Properties; ``` ``` // Provided by VK_KHR_maintenance6 // Equivalent to VkPhysicalDeviceMaintenance6Properties typedef VkPhysicalDeviceMaintenance6Properties VkPhysicalDeviceMaintenance6PropertiesKHR; ``` ## Members `sType` is a VkStructureType value identifying this structure. `pNext` is`NULL` or a pointer to a structure extending this structure. ## Description `blockTexelViewCompatibleMultipleLayers` is a boolean value indicating that an implementation supports creating image views with`VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT` where the`layerCount` member of`subresourceRange` is greater than`1`. `maxCombinedImageSamplerDescriptorCount` is the maximum number of combined image sampler descriptors that the implementation uses to access any of the formats that require a sampler Y′CBCR conversion supported by the implementation. `fragmentShadingRateClampCombinerInputs` is a boolean value indicating that an implementation clamps the inputs to combiner operations. If the`VkPhysicalDeviceMaintenance6Properties` structure is included in the`pNext` chain of the VkPhysicalDeviceProperties2 structure passed to vkGetPhysicalDeviceProperties2, it is filled in with each corresponding implementation-dependent property. Valid Usage (Implicit) VUID-VkPhysicalDeviceMaintenance6Properties-sType-sType`sType` must be`VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_6_PROPERTIES` ## See Also VK_KHR_maintenance6, VK_VERSION_1_4,`VkBool32`, VkStructureType ## Document Notes For more information, see the Vulkan Specification. This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.</excerpt> </source> <source> <title>Creating image views should be less restrictive if VK_IMAGE_CREATE_EXTENDED_USAGE_BIT is used · Issue `#1495` · KhronosGroup/Vulkan-ValidationLayers</title> <location>GitHub issue 1495 in KhronosGroup/Vulkan-ValidationLayers (link omitted to avoid creating a cross-reference)</location> <excerpt>`vkCreateImageView(): pCreateInfo-&gt;format with tiling VK_IMAGE_TILING_OPTIMAL does not support usage that includes VK_IMAGE_USAGE_STORAGE_BIT. The Vulkan spec states: If usage contains VK_IMAGE_USAGE_STORAGE_BIT, then the image view&`#39`;s format features must contain VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT. (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkImageViewCreateInfo-usage-02275)` ... This is made possible by two flags introduced in [vk_khr_maintenance2](https://github.com/KhronosGroup/Vulkan-Docs/blob/master/appendices/VK_KHR_maintenance2.txt). ... VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag allows to create an image view with an uncompressed format of an image with a compressed format. ... VK_IMAGE_CREATE_EXTENDED_USAGE_BIT allows to create images with incompatible format/usages. This is necessary because compressed formats doesn&`#39`;t allow the storage bit. Which means it would be impossible to create the image, but it would also be impossible to create an image view with the same format as the compressed image, used only for reading. ... This problem is referenced by ... 96. Assuming the above example is correct according to ... specs, there is no way ... validation layers to detect ... . VK_IMAGE_CREATE_EXTENDED_USAGE_BIT should only ... used in order ... , so shouldn&`#39`;t validation ... &gt; ``` &gt; VUID-VkImageCreateInfo-flags-01572 &gt; If flags contains VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT, then format must be a &gt; block-compressed image format, an ETC compressed image format, or an ASTC &gt; compressed image format. ... &gt; • VUID-VkImageCreateInfo-flags-01573 &gt; If flags contains VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT, then flags must also &gt; contain VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT. ... &gt; • VUID-VkImageViewCreateInfo-image-01583 &gt; If image was created with the VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag, &gt; format must be compatible with, or must be an uncompressed format that is sizecompatible with, the format used to create image. &gt; • VUID-VkImageViewCreateInfo-image-01584 &gt; If image was created with the VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag, the &gt; levelCount and layerCount members of subresourceRange must both be 1. &gt; ``` ... &gt; Sorry, I bumped this one towards the back of the wagon so many times it eventually _fell off_ ... wagon. &gt; &gt; I&`#39`;m not sure the original VUID (02275) can be reproduced, at least not without hitting `02251` first. I&`#39`;ve put up a change (`#3662`) that addresses the CTS error, and I _think_ it should resolve the one `@danginsburg` is seeing as well, but I&`#39`;m having hardware issues at the moment trying to get the original replay to work. I&`#39`;m not 100% sure my change is correct, though; I think it is, but the worry is that by using `VK_IMAGE_CREATE_EXTENDED_USAGE_BIT` one could create an image view later on that fails in the driver without triggering a validation message. I need to do some more testing on my part to try and verify that is working correctly. ... &gt; EDIT: Sorry, I realize there is a `VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT` being used, so a &quot;size-compatible uncompressed&quot; format can be used which can support the format feature flag I guess &gt; &gt; --- &gt; &gt; So I was able to run `dEQP-VK.image.sample_texture.128_bit_compressed_format` and get the `VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251` error because it doesn&`#39`;t support the `VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT` bit &gt; &gt; &gt; VK_IMAGE_CREATE_EXTENDED_USAGE_BIT allows to create images with incompatible format/usages. This is necessary because compressed formats doesn&`#39`;t allow the storage bit. Which means it would be impossible to create the image, but it would also be impossible to create an image view with the same format as the compressed image, used only for reading. &gt; &gt; I guess I don&`#39`;t see this as a Validation Layer…[truncated]</excerpt> </source> <source> <title>VkPhysicalDeviceMaintenance6Features - VulkanHub</title> <location>https://vkdoc.net/man/VkPhysicalDeviceMaintenance6Features</location> <excerpt>VkPhysicalDeviceMaintenance6Features - VulkanHub # VkPhysicalDeviceMaintenance6Features Structure describing whether the implementation supports maintenance6 functionality The `VkPhysicalDeviceMaintenance6Features` structure is defined as: C Rust ```c typedef struct VkPhysicalDeviceMaintenance6Features { VkStructureType sType; void* pNext; VkBool32 maintenance6; } VkPhysicalDeviceMaintenance6Features; ``` ```rs pub struct PhysicalDeviceMaintenance6Features { s_type: vk::StructureType, p_next: *mut c_void, maintenance6: vk::Bool32, } ``` ```c typedef VkPhysicalDeviceMaintenance6Features VkPhysicalDeviceMaintenance6FeaturesKHR; ``` ```rs type PhysicalDeviceMaintenance6FeaturesKHR = vk::PhysicalDeviceMaintenance6Features; ``` This structure describes the following feature: - `sType` is a VkStructureType value identifying this structure. - `pNext` is `NULL` or a pointer to a structure extending this structure. - EXTENSION FEATURES MAINTENANCE6 `maintenance6` indicates that the implementation supports the following: - VK_NULL_HANDLE can be used when binding an index buffer - VkBindMemoryStatus can be included in the `pNext` chain of the VkBindBufferMemoryInfo and VkBindImageMemoryInfo structures, enabling applications to retrieve VkResult values for individual memory binding operations. - VkPhysicalDeviceMaintenance6Properties::`blockTexelViewCompatibleMultipleLayers` property to indicate that the implementation supports creating image views with `VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT` where the `layerCount` member of `subresourceRange` is greater than `1`. - VkPhysicalDeviceMaintenance6Properties::`maxCombinedImageSamplerDescriptorCount` property which indicates the maximum descriptor size required for any format that requires a sampler Y′C B C R conversion supported by the implementation. - A VkPhysicalDeviceMaintenance6Properties::`fragmentShadingRateClampCombinerInputs` property which indicates whether the implementation clamps the inputs to fragment shading rate combiner operations. If the `VkPhysicalDeviceMaintenance6Features` structure is included in the `pNext` chain of the VkPhysicalDeviceFeatures2 structure passed to vkGetPhysicalDeviceFeatures2, it is filled in to indicate whether each corresponding feature is supported. If the application wishes to use a VkDevice with any features described by `VkPhysicalDeviceMaintenance6Features`, it must add an instance of the structure, with the desired feature members set to `VK_TRUE`, to the `pNext` chain of VkDeviceCreateInfo when creating the VkDevice. #### VUID-VkPhysicalDeviceMaintenance6Features-sType-sType `sType` must be `VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_6_FEATURES` Parent VK_VERSION_1_4 Type Structures Extends</excerpt> </source> </source_evidence> Citations: - 1: https://docs.vulkan.org/features/latest/features/proposals/VK_KHR_maintenance6.html - 2: https://docs.vulkan.org/refpages/latest/refpages/source/VkPhysicalDeviceMaintenance6Properties.html - 3: https://vulkan.lunarg.com/doc/view/1.4.335.0/linux/antora/refpages/latest/refpages/source/VkPhysicalDeviceMaintenance6Properties.html - 4: GitHub issue 1495 in KhronosGroup/Vulkan-ValidationLayers (link omitted to avoid creating a cross-reference) - 5: https://vkdoc.net/man/VkPhysicalDeviceMaintenance6Features --- 🌐 Web query: `site:registry.khronos.org/vulkan/specs/latest/html "blockTexelViewCompatibleMultipleLayers" "layerCount"` 💡 Result: <search_synthesis> The requested term blockTexelViewCompatibleMultipleLayers does not appear in the provided search results from the Vulkan 1.4.362 specification. Consequently, there is no information available in the provided sources regarding its relationship with layerCount. </search_synthesis> <source_evidence> <source> <title>Vulkan ® 1.4.308 - A Specification (with all registered extensions)</title> <location>https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html</location> <excerpt>45.1. Instance and Device Functionality * 45.2. Core Versions * 45.3. Layers * 45.4. Extensions * 45.5. Extension Dependencies * 45.6. Compatibility Guarantees (Informative) ... * Appendix E: Layers &amp; Extensions (Informative) * Extension Dependencies</excerpt> </source> </source_evidence> Citations: - 1: https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html --- 🏁 Script executed: ```bash python3 - <<'PY' import urllib.request url = "https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html" try: data = urllib.request.urlopen(url, timeout=10).read().decode("utf-8", "replace") needle = "blockTexelViewCompatibleMultipleLayers" pos = data.find(needle) print("found", pos) print(data[max(0, pos-3000):pos+5000] if pos >= 0 else "not found") except Exception as e: print(type(e).__name__, e) PY ``` Repository: KytyPS5/KytyPS5 Length of output: 297 --- </details> **Reject unsupported multi-layer block-texel views before `createImageView`.** When `supports_block_texel_view_multiple_layers` is false, this branch only logs the unsupported request. `createImageView` then receives the unchanged multi-layer `normalized.layer_count`. Vulkan validation can report this invalid usage, and the implementation can reject image-view creation. This function calls `EXIT` when creation fails. Reject the view before creation, or implement a per-layer fallback. Do not clamp `layer_count`. <details> <summary>Proposed guard</summary> ```diff if (static_cast<bool>(image.flags & vk::ImageCreateFlagBits::eBlockTexelViewCompatible) && normalized.layer_count > 1 && (ImageViewOps::FormatClass(normalized.format) & ImageViewOps::BlockFormatClasses) == 0 && !m_graphics.supports_block_texel_view_multiple_layers) { + EXIT("multi-layer block texel view requires VK_KHR_maintenance6\n"); static bool logged = false; ``` </details> <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion if (static_cast<bool>(image.flags & vk::ImageCreateFlagBits::eBlockTexelViewCompatible) && normalized.layer_count > 1 && (ImageViewOps::FormatClass(normalized.format) & ImageViewOps::BlockFormatClasses) == 0 && !m_graphics.supports_block_texel_view_multiple_layers) { EXIT("multi-layer block texel view requires VK_KHR_maintenance6\n"); ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:quokka --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:02d6806d58f2120b8292fcab --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 35de8b9
Author
Owner

@⁠YuhiAida on GitHub · 2026-09-19 15:37 UTC · original

Outside-diff finding "Do not mark the destination GPU-modified when no copy occurs" (textureCache.cpp:697-700) — addressed in cae4e77.

Took the suggested shape: Image::CopyMip now returns whether it actually copied (false when mip >= destination.backing.mip_levels, i.e. the guest mip maps beyond the host mip chain), and TextureCache::CopyImageMip marks the destination GPU-modified only on success, so ResolveDepthOverlap/ExpandImage can no longer claim ownership of pixels that were never transferred.

While tracing the callers I found the same silent return in Image::Resolve, and it was worse in that case: ResolveColorTargets called cache.MarkGpuWritten(dst.image_id) before the resolve, and CommitGpuWrite clears BufferModified/CpuDirty, so a skipped resolve would additionally mask a missing blit. Resolve also returns bool now and the mark only happens after a successful resolve. The remaining clamp sites (view, barriers, clear) clamp onto the deepest host level and proceed, so they were left as-is.

On reachability: ReportMipClamp had a single global 32-report budget which the view/barriers reports were saturating, so the other sites' real counts were invisible. It now has a per-site budget (first 4 verbatim, then a log-scale heartbeat with a total). A 120 s replay of the DQ7 sequence with VULKAN_VALIDATION=true on the fixed build reports copy-mip=0, resolve=0, view≥32, barriers≥32, create=3 — so on this content both skip paths are latent rather than currently corrupting state, and the run finished with no fatal or validation errors. The guard is there for when a guest image does present a mip beyond the host chain on another path.

**@⁠YuhiAida** on GitHub · 2026-09-19 15:37 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/717#issuecomment-5743143207) **Outside-diff finding "Do not mark the destination GPU-modified when no copy occurs" (`textureCache.cpp:697-700`) — addressed in cae4e77.** Took the suggested shape: `Image::CopyMip` now returns whether it actually copied (false when `mip >= destination.backing.mip_levels`, i.e. the guest mip maps beyond the host mip chain), and `TextureCache::CopyImageMip` marks the destination GPU-modified only on success, so `ResolveDepthOverlap`/`ExpandImage` can no longer claim ownership of pixels that were never transferred. While tracing the callers I found the same silent return in `Image::Resolve`, and it was worse in that case: `ResolveColorTargets` called `cache.MarkGpuWritten(dst.image_id)` *before* the resolve, and `CommitGpuWrite` clears `BufferModified`/`CpuDirty`, so a skipped resolve would additionally mask a missing blit. `Resolve` also returns bool now and the mark only happens after a successful resolve. The remaining clamp sites (`view`, `barriers`, `clear`) clamp onto the deepest host level and proceed, so they were left as-is. On reachability: `ReportMipClamp` had a single global 32-report budget which the `view`/`barriers` reports were saturating, so the other sites' real counts were invisible. It now has a per-site budget (first 4 verbatim, then a log-scale heartbeat with a total). A 120 s replay of the DQ7 sequence with `VULKAN_VALIDATION=true` on the fixed build reports `copy-mip=0`, `resolve=0`, `view≥32`, `barriers≥32`, `create=3` — so on this content both skip paths are latent rather than currently corrupting state, and the run finished with no fatal or validation errors. The guard is there for when a guest image does present a mip beyond the host chain on another path.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-29 19:28 UTC · original · edited 2026-09-29 20:15 UTC
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 668 (outdated):

@@ -664,7 +664,9 @@ void TextureCache::CopyImageMip(ImageId destination_id, ImageId source_id, uint3
 	if (source.IsBufferModified() || source.backing.samples != destination.backing.samples) {
 		EXIT("TextureCache: invalid mip-copy ownership or sample count\n");
 	}
-	destination.CopyMip(source, mip, layer);
+	if (!destination.CopyMip(source, mip, layer)) {
+		return;

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Preserve the source when a mip copy is skipped.

If a GPU-modified source maps to a destination mip beyond the host chain, CopyMip returns false here. ResolveOverlap and ExpandImage still call FreeImage on that source. FreeImage clears its GPU-modified flag and deletes the image, so the GPU-written contents are lost. Propagate the copy result to those callers. Retain or write back the source before freeing it.

✅ Addressed in commit b79a361

**@⁠coderabbitai[bot]** on GitHub · 2026-09-29 19:28 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/717#discussion_r4137472266) · edited 2026-09-29 20:15 UTC On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 668 (outdated): ```diff @@ -664,7 +664,9 @@ void TextureCache::CopyImageMip(ImageId destination_id, ImageId source_id, uint3 if (source.IsBufferModified() || source.backing.samples != destination.backing.samples) { EXIT("TextureCache: invalid mip-copy ownership or sample count\n"); } - destination.CopyMip(source, mip, layer); + if (!destination.CopyMip(source, mip, layer)) { + return; ``` _🗄️ Data Integrity & Integration_ | _🟠 Major_ | _🏗️ Heavy lift_ **Preserve the source when a mip copy is skipped.** If a GPU-modified source maps to a destination mip beyond the host chain, `CopyMip` returns `false` here. `ResolveOverlap` and `ExpandImage` still call `FreeImage` on that source. `FreeImage` clears its GPU-modified flag and deletes the image, so the GPU-written contents are lost. Propagate the copy result to those callers. Retain or write back the source before freeing it. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:1dc8985a68d125d667a7dd44 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit b79a361
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-29 19:28 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: cac61661-6e52-457f-88e6-3f5149689711

📥 Commits

Reviewing files that changed from the base of the PR and between cae4e77d01 and 4250a4d322.

📒 Files selected for processing (6)
  • src/graphics/host_gpu/graphicContext.h
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/image/image.cpp
  • src/graphics/host_gpu/renderer/image/image.h
  • src/graphics/host_gpu/renderer/renderDraw.cpp
  • src/graphics/presentation/window/vulkanWindow.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-09-29 19:28 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/717#pullrequestreview-5357373470) · **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**: `cac61661-6e52-457f-88e6-3f5149689711` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between cae4e77d01254f73a01b85cd66afd94910dcfd4e and 4250a4d322d17c03821a9087f7baa24e82d39760. </details> <details> <summary>📒 Files selected for processing (6)</summary> * `src/graphics/host_gpu/graphicContext.h` * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/image/image.cpp` * `src/graphics/host_gpu/renderer/image/image.h` * `src/graphics/host_gpu/renderer/renderDraw.cpp` * `src/graphics/presentation/window/vulkanWindow.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-29 20:23 UTC · original · reviewed

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Do not use the buffer when image synchronization fails. · textureCache.cpp:1796-1806

src/graphics/host_gpu/renderer/cache/textureCache.cpp:1796-1806
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Do not use the buffer when image synchronization fails.

CopyBuffer requests a non-write texel-buffer source and then immediately copies from the returned buffer. For a GPU-modified volume image with guest mip levels beyond host_levels, SynchronizeBufferFromImage returns false without copying the image. ObtainBuffer discards that result, so the copy can read stale buffer contents.

Propagate the synchronization failure to the caller. Do not issue the buffer read until a valid host-chain transfer completes. Keep the image GPU-modified for retry.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: ec2aefe3-a3e1-4411-90a0-8393dd232dcc

📥 Commits

Reviewing files that changed from the base of the PR and between 4250a4d322 and b79a361af2.

📒 Files selected for processing (2)
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-09-29 20:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/717#pullrequestreview-5357978320) · **reviewed** > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to GitHub limitations. > > **⚠️ Outside diff range comments (1)** > > <details> > <summary><em>🟡 Minor</em> · Do not use the buffer when image synchronization fails. · <code>textureCache.cpp:1796-1806</code></summary><blockquote> > > `src/graphics/host_gpu/renderer/cache/textureCache.cpp:1796-1806` > _🗄️ Data Integrity & Integration_ | _🟡 Minor_ | _⚡ Quick win_ > > **Do not use the buffer when image synchronization fails.** > > `CopyBuffer` requests a non-write texel-buffer source and then immediately copies from the returned buffer. For a GPU-modified volume image with guest mip levels beyond `host_levels`, `SynchronizeBufferFromImage` returns `false` without copying the image. `ObtainBuffer` discards that result, so the copy can read stale buffer contents. > > Propagate the synchronization failure to the caller. Do not issue the buffer read until a valid host-chain transfer completes. Keep the image GPU-modified for retry. > > <!-- cr-comment:v1:50e2308d2d3bc88f0165325c --> > > </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `ec2aefe3-a3e1-4411-90a0-8393dd232dcc` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 4250a4d322d17c03821a9087f7baa24e82d39760 and b79a361af2bf28598554d71916b338ecd6686879. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/cache/textureCache.h` </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary> * src/graphics/host_gpu/renderer/cache/textureCache.cpp </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
This pull request has changes conflicting with the target branch.
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/image/image.cpp
  • src/graphics/host_gpu/renderer/image/image.h
  • src/graphics/host_gpu/renderer/renderDraw.cpp
  • src/graphics/presentation/window/vulkanWindow.cpp
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/717/head:github-bot/gh-717'
git switch 'github-bot/gh-717'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-717'
git switch 'github-bot/gh-717'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-717'
git switch 'github-bot/gh-717'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-717'
git switch 'main'
git merge --squash 'github-bot/gh-717'
git switch 'main'
git merge --ff-only 'github-bot/gh-717'
git switch 'main'
git merge 'github-bot/gh-717'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.