renderer: apply fast clears to texture views and metadata-only fills #1200

Open
github-bot wants to merge 10 commits from github-bot/gh-1200 into main AGit
Owner

@⁠NeySlim on GitHub · 2026-10-08 10:10 UTC · original
NeySlim:fix/metadata-clear-texture-view → main · +339 −12 · 7 files · 10 commits · open

Problem

Kyty materializes a CMASK/DCC fast clear only when the target is bound as a color target for a draw. Two patterns in God of War Ragnarök (PPSA08332, 05.005) never get there:

  1. A 1280x720 RGBA16F distortion target is fast-cleared, receives zero to two quads, and is then read as a plain texture (T# without metadata) by a compute shader. When it is only bound as a texture, the clear is not applied.
  2. In cutscenes, the game clears another target by filling its CMASK with a compute shader, programs CB_COLORn_* for it, and never draws into it before reading it as a texture.

In both cases the compute shader reads stale contents (the output of an unrelated pass from the previous frame) as distortion vectors, displaces the scene by up to 1280 px per pixel, and characters turn into a grainy cloud.

Change

  • MaterializeColorClear also handles texture and storage views of an image whose last color-target binding recorded metadata and clear registers. The clear is decoded through the target's format (ImageMetadataInfo::clear_format), not the view's.
  • RebindImages calls MaterializeViewClear for cached texture bindings, so a clear that arrives after the lookup is still seen.
  • A target bound again without color metadata drops the clear state of its previous binding.
  • After a direct or indirect dispatch, small written buffers are remembered. When programmed color slots' CMASK/DCC address matches one of them, every such target is resolved, which materializes the clear without a draw. The set is bounded.
  • DecodePackedColorClear also decodes R16G16B16A16_UNORM and R32G32_UINT register clears from both clear words. This is what was left of #1188; the rest of it landed in 31b7be9f and 3c9da9c3.

Test

RenderExecutorColorMetadataClear gains checks: a texture view (with or without metadata) of a fast-cleared target reads the clear color, also through a cached binding and through a view in another format; a metadata-less rebind forgets the old clear; a metadata fill by a direct or indirect dispatch clears a programmed target without a draw, including two slots sharing one CMASK; R16G16B16A16_UNORM and R32G32_UINT register clears keep both words. Each fails when the corresponding part of the change is removed.

Validation

Linux, AMD Radeon 8060S, Mesa RADV 26.2.3, rebased on 9e41d832.

  • RenderExecutorColorMetadataClear and the CPU suites pass. shader_recompiler_compute_tests one case per process gives the same results as main (627 of 637; the same 10 fail on main on this setup).
  • God of War Ragnarök (checked before this rebase): in a RenderDoc capture of a cutscene, the distortion input is entirely zero and no pixel is displaced by more than 2 px. Cutscene screenshots show sharp characters instead of the grainy cloud.

Not measured precisely: the cost of reading back the CMASK once per frame per matching target. Not tested on Windows/macOS (platform-independent renderer code).

AI use

I used Claude Code (AI agent) to capture and analyze the frames in RenderDoc, trace the stale input back to the missing clears, write the change and the test, and run the tests above on my machine. I reviewed the diff and the results before opening this PR.

**@⁠NeySlim** on GitHub · 2026-10-08 10:10 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200) `NeySlim:fix/metadata-clear-texture-view` → `main` · +339 −12 · 7 files · 10 commits · open ## Problem Kyty materializes a CMASK/DCC fast clear only when the target is bound as a color target for a draw. Two patterns in God of War Ragnarök (PPSA08332, 05.005) never get there: 1. A 1280x720 RGBA16F distortion target is fast-cleared, receives zero to two quads, and is then read as a plain texture (T# without metadata) by a compute shader. When it is only bound as a texture, the clear is not applied. 2. In cutscenes, the game clears another target by filling its CMASK with a compute shader, programs `CB_COLORn_*` for it, and never draws into it before reading it as a texture. In both cases the compute shader reads stale contents (the output of an unrelated pass from the previous frame) as distortion vectors, displaces the scene by up to 1280 px per pixel, and characters turn into a grainy cloud. ## Change - `MaterializeColorClear` also handles texture and storage views of an image whose last color-target binding recorded metadata and clear registers. The clear is decoded through the target's format (`ImageMetadataInfo::clear_format`), not the view's. - `RebindImages` calls `MaterializeViewClear` for cached texture bindings, so a clear that arrives after the lookup is still seen. - A target bound again without color metadata drops the clear state of its previous binding. - After a direct or indirect dispatch, small written buffers are remembered. When programmed color slots' CMASK/DCC address matches one of them, every such target is resolved, which materializes the clear without a draw. The set is bounded. - `DecodePackedColorClear` also decodes `R16G16B16A16_UNORM` and `R32G32_UINT` register clears from both clear words. This is what was left of #1188; the rest of it landed in 31b7be9f and 3c9da9c3. ## Test `RenderExecutorColorMetadataClear` gains checks: a texture view (with or without metadata) of a fast-cleared target reads the clear color, also through a cached binding and through a view in another format; a metadata-less rebind forgets the old clear; a metadata fill by a direct or indirect dispatch clears a programmed target without a draw, including two slots sharing one CMASK; `R16G16B16A16_UNORM` and `R32G32_UINT` register clears keep both words. Each fails when the corresponding part of the change is removed. ## Validation Linux, AMD Radeon 8060S, Mesa RADV 26.2.3, rebased on 9e41d832. - `RenderExecutorColorMetadataClear` and the CPU suites pass. `shader_recompiler_compute_tests` one case per process gives the same results as main (627 of 637; the same 10 fail on main on this setup). - God of War Ragnarök (checked before this rebase): in a RenderDoc capture of a cutscene, the distortion input is entirely zero and no pixel is displaced by more than 2 px. Cutscene screenshots show sharp characters instead of the grainy cloud. Not measured precisely: the cost of reading back the CMASK once per frame per matching target. Not tested on Windows/macOS (platform-independent renderer code). ## AI use I used Claude Code (AI agent) to capture and analyze the frames in RenderDoc, trace the stale input back to the missing clears, write the change and the test, and run the tests above on my machine. I reviewed the diff and the results before opening this PR.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:47:28 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 10:15 UTC · original · edited 2026-10-19 04:36 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: a7844441e50bddcf648caecc48e5fa890a32db3f
  • Latest commit, not reviewed: 9836903002

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

Register-based color clears now decode both clear-register words for supported formats. TextureCache can materialize clears for existing views from matching cached color-target metadata. Compute dispatches track eligible written-buffer addresses and resolve matching color targets. Tests cover clear decoding, cached texture views, and repeated metadata fills.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: 🟡 Moderate · up to a7844

The fix applies pending color clears only after direct compute dispatches. Indirect dispatches skip it, so a texture read after one may still show stale pixels. A target that shares its metadata address with another slot can also be missed. The new tests can pass without exercising some of the intended paths. Resolve or explicitly accept these gaps before merging.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 7 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Title check Passed The title clearly and concisely summarizes the main changes: applying fast clears to texture views and metadata-only fills.
Description check Passed The description is directly related to the changeset. It explains the affected rendering cases, implementation changes, tests, and validation results.
Full details: Docstring Coverage

Explanation

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

  • Autopilot · 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-08 10:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#issuecomment-6057668133) · edited 2026-10-19 04:36 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/1200?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;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> <!-- 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: a7844441e50bddcf648caecc48e5fa890a32db3f > - Latest commit, not reviewed: 9836903002bd119f97eef65fd500a066675ceed4 > > 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> Register-based color clears now decode both clear-register words for supported formats. TextureCache can materialize clears for existing views from matching cached color-target metadata. Compute dispatches track eligible written-buffer addresses and resolve matching color targets. Tests cover clear decoding, cached texture views, and repeated metadata fills. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"a7844441e50bddcf648caecc48e5fa890a32db3f" --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>🟡 Moderate</strong> · up to <code>a7844</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🟡 Moderate** · up to `a7844` --> <!-- final_review_risk_coverage:{"sourceCommitId":"a7844441e50bddcf648caecc48e5fa890a32db3f","coveredCommitId":"a7844441e50bddcf648caecc48e5fa890a32db3f","kind":"reviewed"} --> The fix applies pending color clears only after direct compute dispatches. Indirect dispatches skip it, so a texture read after one may still show stale pixels. A target that shares its metadata address with another slot can also be missed. The new tests can pass without exercising some of the intended paths. Resolve or explicitly accept these gaps before merging. <!-- 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 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 7 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 | | :------------------------ | :--------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------- | | 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. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely summarizes the main changes: applying fast clears to texture views and metadata-only fills. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description is directly related to the changeset. It explains the affected rendering cases, implementation changes, tests, and validation results. | </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 7 files. (1 skipped: 1 too large.) </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">Autopilot</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=1200)! 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-08 10:15 UTC · original · edited 2026-10-08 10:43 UTC
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 1166 (outdated):

@@ -1132,22 +1132,54 @@ void TextureCache::InitializeImage(ImageId id) {
 	}
 }
 
+void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) {
+	{
+		std::scoped_lock lock {m_lock};
+		const auto*      image = m_slot_images.try_get(id);
+		if (image == nullptr || !image->info.metadata.clear_register_valid) {
+			return;
+		}
+	}
+	MaterializeColorClear(id, desc, desc.view_info.base_layer);
+}
+
 void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc,
                                        uint32_t metadata_base_layer) {
-	if (desc.info.metadata.kind != ImageMetadataKind::Dcc &&
-	    desc.info.metadata.kind != ImageMetadataKind::Cmask) {
-		return;
+	ImageDesc  clear_desc = desc;
+	auto&      metadata   = clear_desc.info.metadata;
+	const bool from_target =
+	    metadata.kind == ImageMetadataKind::Dcc || metadata.kind == ImageMetadataKind::Cmask;
+	if (!from_target) {
+		// A texture or storage view of a fast-cleared color target sees the clear as well. The
+		// image keeps the metadata and clear registers of its last color-target binding.
+		if (desc.type != BindingType::Texture && desc.type != BindingType::Storage) {
+			return;
+		}
+		std::scoped_lock lock {m_lock};
+		const auto&      image = m_slot_images[id];
+		if ((image.info.metadata.kind != ImageMetadataKind::Dcc &&
+		     image.info.metadata.kind != ImageMetadataKind::Cmask) ||
+		    !image.info.metadata.clear_register_valid ||
+		    image.info.data.address != desc.info.data.address || desc.info.resources.levels != 1 ||
+		    desc.view_info.level_count != 1 || image.info.IsVolume()) {
+			return;
+		}

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

set -eu
printf '%s\n' '--- changed hunk ---'
git diff --unified=35 5a8808086a9815b67d4822cd20cf1e8a7a05f002 76399168e8afee3323f203e5ace3e57b397e368e -- src/graphics/host_gpu/renderer/cache/textureCache.cpp

printf '%s\n' '--- relevant symbols ---'
rg -n -F --glob 'src/graphics/host_gpu/renderer/cache/textureCache.cpp' \
  -e 'FindImage' -e 'ResolveOverlap' -e 'TransferLayers' -e 'MaterializeColorClear' -e 'MaterializeViewClear' \
  src/graphics/host_gpu/renderer/cache/textureCache.cpp

printf '%s\n' '--- nearby implementation ---'
sed -n '1040,1235p' src/graphics/host_gpu/renderer/cache/textureCache.cpp

printf '%s\n' '--- lookup definitions and callers ---'
rg -n -F --glob '*.{cpp,h,hpp}' -e 'TextureCache::FindImage' -e 'ResolveOverlap' -e 'TransferLayers' src/graphics/host_gpu/renderer/cache

Repository: KytyPS5/KytyPS5

Length of output: 21238


🏁 Script executed:

set -eu
printf '%s\n' '--- ResolveOverlap ---'
sed -n '730,845p' src/graphics/host_gpu/renderer/cache/textureCache.cpp

printf '%s\n' '--- TransferLayers and ImageInfo helpers ---'
sed -n '880,975p' src/graphics/host_gpu/renderer/cache/textureCache.cpp
rg -n -F --glob '*.{h,hpp,cpp}' \
  -e 'TransferLayers()' -e 'struct ImageInfo' -e 'class ImageInfo' -e 'resources.layers' \
  src/graphics/host_gpu/renderer/cache src/graphics/host_gpu/renderer/image

printf '%s\n' '--- FindImage ---'
sed -n '1270,1380p' src/graphics/host_gpu/renderer/cache/textureCache.cpp

printf '%s\n' '--- declarations and resource type definitions ---'
rg -n -F --glob '*.{h,hpp,cpp}' \
  -e 'struct ImageResources' -e 'class ImageResources' -e 'struct ImageDesc' \
  src/graphics/host_gpu/renderer

Repository: KytyPS5/KytyPS5

Length of output: 19729


🏁 Script executed:

set -eu
printf '%s\n' '--- SameBacking and ResolveOverlap complete ---'
sed -n '150,225p' src/graphics/host_gpu/renderer/cache/textureCache.cpp
sed -n '660,875p' src/graphics/host_gpu/renderer/cache/textureCache.cpp

printf '%s\n' '--- ImageInfo definition ---'
sed -n '45,180p' src/graphics/host_gpu/renderer/image/imageInfo.h

printf '%s\n' '--- ValidateImageDesc ---'
sed -n '475,535p' src/graphics/host_gpu/renderer/cache/textureCache.cpp

Repository: KytyPS5/KytyPS5

Length of output: 21684


Validate the cached image layout before using its metadata.

FindImage can reuse a cached image with more mip levels or layers than desc, and ResolveOverlap can reuse one with a larger data range. The texture/storage path then uses the cached metadata.range but divides it by desc.info.TransferLayers(). This can produce an invalid metadata slice size, reach the alignment or bounds EXIT, or clear the wrong slices.

Require the cached image to have one mip, the same data size, and the same layer count:

Proposed guard
 		    !image.info.metadata.clear_register_valid ||
 		    image.info.data.address != desc.info.data.address || desc.info.resources.levels != 1 ||
-		    desc.view_info.level_count != 1 || image.info.IsVolume()) {
+		    image.info.resources.levels != 1 || image.info.data.size != desc.info.data.size ||
+		    image.info.resources.layers != desc.info.resources.layers ||
+		    desc.view_info.level_count != 1 || image.info.IsVolume()) {
 			return;
 		}
📝 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 ((image.info.metadata.kind != ImageMetadataKind::Dcc &&
		     image.info.metadata.kind != ImageMetadataKind::Cmask) ||
		    !image.info.metadata.clear_register_valid ||
		    image.info.data.address != desc.info.data.address || desc.info.resources.levels != 1 ||
		    image.info.resources.levels != 1 || image.info.data.size != desc.info.data.size ||
		    image.info.resources.layers != desc.info.resources.layers ||
		    desc.view_info.level_count != 1 || image.info.IsVolume()) {
			return;
		}

✅ Confirmed as addressed by @⁠NeySlim

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 10:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4217684363) · edited 2026-10-08 10:43 UTC On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 1166 (outdated): ```diff @@ -1132,22 +1132,54 @@ void TextureCache::InitializeImage(ImageId id) { } } +void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) { + { + std::scoped_lock lock {m_lock}; + const auto* image = m_slot_images.try_get(id); + if (image == nullptr || !image->info.metadata.clear_register_valid) { + return; + } + } + MaterializeColorClear(id, desc, desc.view_info.base_layer); +} + void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc, uint32_t metadata_base_layer) { - if (desc.info.metadata.kind != ImageMetadataKind::Dcc && - desc.info.metadata.kind != ImageMetadataKind::Cmask) { - return; + ImageDesc clear_desc = desc; + auto& metadata = clear_desc.info.metadata; + const bool from_target = + metadata.kind == ImageMetadataKind::Dcc || metadata.kind == ImageMetadataKind::Cmask; + if (!from_target) { + // A texture or storage view of a fast-cleared color target sees the clear as well. The + // image keeps the metadata and clear registers of its last color-target binding. + if (desc.type != BindingType::Texture && desc.type != BindingType::Storage) { + return; + } + std::scoped_lock lock {m_lock}; + const auto& image = m_slot_images[id]; + if ((image.info.metadata.kind != ImageMetadataKind::Dcc && + image.info.metadata.kind != ImageMetadataKind::Cmask) || + !image.info.metadata.clear_register_valid || + image.info.data.address != desc.info.data.address || desc.info.resources.levels != 1 || + desc.view_info.level_count != 1 || image.info.IsVolume()) { + return; + } ``` **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash set -eu printf '%s\n' '--- changed hunk ---' git diff --unified=35 5a8808086a9815b67d4822cd20cf1e8a7a05f002 76399168e8afee3323f203e5ace3e57b397e368e -- src/graphics/host_gpu/renderer/cache/textureCache.cpp printf '%s\n' '--- relevant symbols ---' rg -n -F --glob 'src/graphics/host_gpu/renderer/cache/textureCache.cpp' \ -e 'FindImage' -e 'ResolveOverlap' -e 'TransferLayers' -e 'MaterializeColorClear' -e 'MaterializeViewClear' \ src/graphics/host_gpu/renderer/cache/textureCache.cpp printf '%s\n' '--- nearby implementation ---' sed -n '1040,1235p' src/graphics/host_gpu/renderer/cache/textureCache.cpp printf '%s\n' '--- lookup definitions and callers ---' rg -n -F --glob '*.{cpp,h,hpp}' -e 'TextureCache::FindImage' -e 'ResolveOverlap' -e 'TransferLayers' src/graphics/host_gpu/renderer/cache ``` Repository: KytyPS5/KytyPS5 Length of output: 21238 --- 🏁 Script executed: ```bash set -eu printf '%s\n' '--- ResolveOverlap ---' sed -n '730,845p' src/graphics/host_gpu/renderer/cache/textureCache.cpp printf '%s\n' '--- TransferLayers and ImageInfo helpers ---' sed -n '880,975p' src/graphics/host_gpu/renderer/cache/textureCache.cpp rg -n -F --glob '*.{h,hpp,cpp}' \ -e 'TransferLayers()' -e 'struct ImageInfo' -e 'class ImageInfo' -e 'resources.layers' \ src/graphics/host_gpu/renderer/cache src/graphics/host_gpu/renderer/image printf '%s\n' '--- FindImage ---' sed -n '1270,1380p' src/graphics/host_gpu/renderer/cache/textureCache.cpp printf '%s\n' '--- declarations and resource type definitions ---' rg -n -F --glob '*.{h,hpp,cpp}' \ -e 'struct ImageResources' -e 'class ImageResources' -e 'struct ImageDesc' \ src/graphics/host_gpu/renderer ``` Repository: KytyPS5/KytyPS5 Length of output: 19729 --- 🏁 Script executed: ```bash set -eu printf '%s\n' '--- SameBacking and ResolveOverlap complete ---' sed -n '150,225p' src/graphics/host_gpu/renderer/cache/textureCache.cpp sed -n '660,875p' src/graphics/host_gpu/renderer/cache/textureCache.cpp printf '%s\n' '--- ImageInfo definition ---' sed -n '45,180p' src/graphics/host_gpu/renderer/image/imageInfo.h printf '%s\n' '--- ValidateImageDesc ---' sed -n '475,535p' src/graphics/host_gpu/renderer/cache/textureCache.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 21684 --- </details> **Validate the cached image layout before using its metadata.** `FindImage` can reuse a cached image with more mip levels or layers than `desc`, and `ResolveOverlap` can reuse one with a larger data range. The texture/storage path then uses the cached `metadata.range` but divides it by `desc.info.TransferLayers()`. This can produce an invalid metadata slice size, reach the alignment or bounds `EXIT`, or clear the wrong slices. Require the cached image to have one mip, the same data size, and the same layer count: <details> <summary>Proposed guard</summary> ```diff !image.info.metadata.clear_register_valid || image.info.data.address != desc.info.data.address || desc.info.resources.levels != 1 || - desc.view_info.level_count != 1 || image.info.IsVolume()) { + image.info.resources.levels != 1 || image.info.data.size != desc.info.data.size || + image.info.resources.layers != desc.info.resources.layers || + desc.view_info.level_count != 1 || image.info.IsVolume()) { return; } ``` </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 ((image.info.metadata.kind != ImageMetadataKind::Dcc && image.info.metadata.kind != ImageMetadataKind::Cmask) || !image.info.metadata.clear_register_valid || image.info.data.address != desc.info.data.address || desc.info.resources.levels != 1 || image.info.resources.levels != 1 || image.info.data.size != desc.info.data.size || image.info.resources.layers != desc.info.resources.layers || desc.view_info.level_count != 1 || image.info.IsVolume()) { return; } ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:poseidon:beignet55 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:3ffdf65aa5fdbf180413d04f --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠NeySlim <!-- This is an auto-generated comment by CodeRabbit -->
@ -827,2 +827,4 @@
BindImage(images[i].image_id,
images[i].desc.type == TextureCache::BindingType::Storage);
} else {
texture_cache.MaterializeViewClear(images[i].image_id, images[i].desc);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 10:15 UTC · original · edited 2026-10-08 10:43 UTC

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 12 'TextureCache::FindImage\s*\(' src/graphics/host_gpu/renderer/cache/textureCache.cpp
rg -n -C 12 'MaterializeViewClear|MaterializeColorClear|from_target|DecodeColorClear' src/graphics/host_gpu/renderer/cache/textureCache.cpp
rg -n -C 8 'MetaCompress|metadata\.kind|desc\.type' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp

Repository: KytyPS5/KytyPS5

Length of output: 14168


🏁 Script executed:

sed -n '1297,1370p' src/graphics/host_gpu/renderer/cache/textureCache.cpp
printf '\n--- ResolveTexture descriptor construction ---\n'
sed -n '660,710p' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp

Repository: KytyPS5/KytyPS5

Length of output: 5226


🏁 Script executed:

rg -n -C 12 'ValidateImageDesc\s*\(' src/graphics/host_gpu/renderer/cache/textureCache.cpp src/graphics/host_gpu/renderer/cache/textureCache.h

Repository: KytyPS5/KytyPS5

Length of output: 7911


🏁 Script executed:

rg -n -C 10 'MaterializeColorClear\s*\(|MaterializeViewClear\s*\(' src/graphics/host_gpu/renderer
printf '\n--- metadata declarations ---\n'
rg -n -C 16 'struct ImageMetadataInfo|class ImageMetadataInfo|ImageMetadataInfo' src/graphics/host_gpu/renderer/cache src/graphics/host_gpu/renderer | head -220
printf '\n--- materialization body ---\n'
sed -n '1135,1245p' src/graphics/host_gpu/renderer/cache/textureCache.cpp

Repository: KytyPS5/KytyPS5

Length of output: 23590


Preserve target metadata for cached DCC views.

FindImage does not change the descriptor type or metadata kind. A cached texture view can therefore reach MaterializeColorClear with DCC metadata and a texture or storage binding. The current from_target branch replaces the cached target metadata and does not set clear_desc.type to RenderTarget. DecodeColorClear then rejects register clears, so the view can retain stale pixels.

Treat DCC metadata as from_target only for a RenderTarget descriptor. This preserves the cached target metadata for texture and storage views and uses the existing RenderTarget conversion path.

🐛 Suggested fix
-	const bool from_target =
-	    metadata.kind == ImageMetadataKind::Dcc || metadata.kind == ImageMetadataKind::Cmask;
+	const bool from_target =
+	    desc.type == BindingType::RenderTarget &&
+	    (metadata.kind == ImageMetadataKind::Dcc || metadata.kind == ImageMetadataKind::Cmask);

Add a focused regression test for a cached DCC view after a target fast clear.

✅ Addressed in commit 322e6f3

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 10:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4217684387) · edited 2026-10-08 10:43 UTC **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash set -euo pipefail rg -n -C 12 'TextureCache::FindImage\s*\(' src/graphics/host_gpu/renderer/cache/textureCache.cpp rg -n -C 12 'MaterializeViewClear|MaterializeColorClear|from_target|DecodeColorClear' src/graphics/host_gpu/renderer/cache/textureCache.cpp rg -n -C 8 'MetaCompress|metadata\.kind|desc\.type' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 14168 --- 🏁 Script executed: ```bash sed -n '1297,1370p' src/graphics/host_gpu/renderer/cache/textureCache.cpp printf '\n--- ResolveTexture descriptor construction ---\n' sed -n '660,710p' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 5226 --- 🏁 Script executed: ```bash rg -n -C 12 'ValidateImageDesc\s*\(' src/graphics/host_gpu/renderer/cache/textureCache.cpp src/graphics/host_gpu/renderer/cache/textureCache.h ``` Repository: KytyPS5/KytyPS5 Length of output: 7911 --- 🏁 Script executed: ```bash rg -n -C 10 'MaterializeColorClear\s*\(|MaterializeViewClear\s*\(' src/graphics/host_gpu/renderer printf '\n--- metadata declarations ---\n' rg -n -C 16 'struct ImageMetadataInfo|class ImageMetadataInfo|ImageMetadataInfo' src/graphics/host_gpu/renderer/cache src/graphics/host_gpu/renderer | head -220 printf '\n--- materialization body ---\n' sed -n '1135,1245p' src/graphics/host_gpu/renderer/cache/textureCache.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 23590 --- </details> **Preserve target metadata for cached DCC views.** `FindImage` does not change the descriptor type or metadata kind. A cached texture view can therefore reach `MaterializeColorClear` with DCC metadata and a texture or storage binding. The current `from_target` branch replaces the cached target metadata and does not set `clear_desc.type` to `RenderTarget`. `DecodeColorClear` then rejects register clears, so the view can retain stale pixels. Treat DCC metadata as `from_target` only for a `RenderTarget` descriptor. This preserves the cached target metadata for texture and storage views and uses the existing `RenderTarget` conversion path. <details> <summary>🐛 Suggested fix</summary> ```diff - const bool from_target = - metadata.kind == ImageMetadataKind::Dcc || metadata.kind == ImageMetadataKind::Cmask; + const bool from_target = + desc.type == BindingType::RenderTarget && + (metadata.kind == ImageMetadataKind::Dcc || metadata.kind == ImageMetadataKind::Cmask); ``` </details> Add a focused regression test for a cached DCC view after a target fast clear. <!-- fingerprinting:phantom:triton:serval --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:262553b1b6998eaeb481ca5e --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commit 322e6f3
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 10:15 UTC · original · edited 2026-10-08 10:42 UTC
On src/graphics/host_gpu/renderer/renderCompute.cpp line 465 (outdated):

@@ -434,9 +436,38 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer,
 
 	// The removed host fence also ordered read-only dispatches before later writers.
 	ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader);
+	// A shader rewriting color metadata performs a fast clear; the target may only be
+	// programmed later, so remember the range until a color slot names it.
+	constexpr size_t MaxPendingMetaFills = 1024;
+	if (m_pending_meta_fills.size() > MaxPendingMetaFills) {
+		m_pending_meta_fills.clear();
+	}
+	for (uint32_t i = 0; i < program.info.buffers.size(); i++) {
+		if (!program.info.buffers[i].written) continue;
+		const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]);
+		if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48());
+	}
+	ResolvePendingMetaClears(buffer);
 	ResetBindings();
 }
 
+// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or
+// without a draw: the texture reads that follow expect the cleared color.
+void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) {
+	if (m_pending_meta_fills.empty()) return;
+	const auto& hw = buffer.GetRegisters();
+	for (uint32_t slot = 0; slot < 8; slot++) {
+		const auto& rt = hw.GetRenderTarget(slot);
+		if (rt.base.addr == 0 ||
+		    !(rt.info.cmask_fast_clear_enable || rt.info.dcc_compression_enable))
+			continue;
+		const auto meta = rt.info.dcc_compression_enable ? rt.dcc_addr.addr : rt.cmask.addr;
+		if (m_pending_meta_fills.erase(meta) == 0) continue;

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep pending CMASK addresses until the target can use them.

If cmask_fast_clear_enable is set on a multisampled target, this check accepts the target and Line 465 removes its pending address. The color-target resolver accepts CMASK metadata only for a single-sample target with FMASK compression and VRS-to-CMASK disabled. In that state, ResolveRenderColorTarget cannot attach the rewritten CMASK metadata, but the pending fill is lost. Match the resolver’s CMASK eligibility before erasing the address, or retain the address when resolution does not consume the metadata. citenone

✅ Addressed in commit 322e6f3

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 10:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4217684395) · edited 2026-10-08 10:42 UTC On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 465 (outdated): ```diff @@ -434,9 +436,38 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer, // The removed host fence also ordered read-only dispatches before later writers. ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader); + // A shader rewriting color metadata performs a fast clear; the target may only be + // programmed later, so remember the range until a color slot names it. + constexpr size_t MaxPendingMetaFills = 1024; + if (m_pending_meta_fills.size() > MaxPendingMetaFills) { + m_pending_meta_fills.clear(); + } + for (uint32_t i = 0; i < program.info.buffers.size(); i++) { + if (!program.info.buffers[i].written) continue; + const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]); + if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48()); + } + ResolvePendingMetaClears(buffer); ResetBindings(); } +// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or +// without a draw: the texture reads that follow expect the cleared color. +void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) { + if (m_pending_meta_fills.empty()) return; + const auto& hw = buffer.GetRegisters(); + for (uint32_t slot = 0; slot < 8; slot++) { + const auto& rt = hw.GetRenderTarget(slot); + if (rt.base.addr == 0 || + !(rt.info.cmask_fast_clear_enable || rt.info.dcc_compression_enable)) + continue; + const auto meta = rt.info.dcc_compression_enable ? rt.dcc_addr.addr : rt.cmask.addr; + if (m_pending_meta_fills.erase(meta) == 0) continue; ``` **🗄️ Data Integrity & Integration** | **🟠 Major** | **⚡ Quick win** **Keep pending CMASK addresses until the target can use them.** If `cmask_fast_clear_enable` is set on a multisampled target, this check accepts the target and Line 465 removes its pending address. The color-target resolver accepts CMASK metadata only for a single-sample target with FMASK compression and VRS-to-CMASK disabled. In that state, `ResolveRenderColorTarget` cannot attach the rewritten CMASK metadata, but the pending fill is lost. Match the resolver’s CMASK eligibility before erasing the address, or retain the address when resolution does not consume the metadata. citenone <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:67c9413666ba5661316c5820 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commit 322e6f3
Author
Owner

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

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 74372638-44ae-44fc-bfd3-342418c9f373
📥 Commits

Reviewing files that changed from the base of the PR and between 5a8808086a and 76399168e8afee3323f203e5ace3e57b397e368e.

📒 Files selected for processing (8)
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.h
  • src/graphics/host_gpu/renderer/colorRenderTarget.cpp
  • src/graphics/host_gpu/renderer/image/imageInfo.h
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/host_gpu/renderer/render.h
  • src/graphics/host_gpu/renderer/renderCompute.cpp
  • tests/ShaderRecompilerComputeTests.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-10-08 10:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#pullrequestreview-5455051900) · **reviewed** **Actionable comments posted: 3** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `74372638-44ae-44fc-bfd3-342418c9f373` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 5a8808086a9815b67d4822cd20cf1e8a7a05f002 and 76399168e8afee3323f203e5ace3e57b397e368e. </details> <details> <summary>📒 Files selected for processing (8)</summary> * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/cache/textureCache.h` * `src/graphics/host_gpu/renderer/colorRenderTarget.cpp` * `src/graphics/host_gpu/renderer/image/imageInfo.h` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/host_gpu/renderer/render.h` * `src/graphics/host_gpu/renderer/renderCompute.cpp` * `tests/ShaderRecompilerComputeTests.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 --> <!-- coderabbit-review-publication v1 publication=6e010c3d-569c-44f9-a403-377f8c26d4d6 attempt=2dee51a0-1072-4d0a-b3c4-7d62c07695a9 batch=1/1 -->
Author
Owner

@⁠NeySlim on GitHub · 2026-10-08 10:38 UTC · original
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 1166 (outdated):

@@ -1132,22 +1132,54 @@ void TextureCache::InitializeImage(ImageId id) {
 	}
 }
 
+void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) {
+	{
+		std::scoped_lock lock {m_lock};
+		const auto*      image = m_slot_images.try_get(id);
+		if (image == nullptr || !image->info.metadata.clear_register_valid) {
+			return;
+		}
+	}
+	MaterializeColorClear(id, desc, desc.view_info.base_layer);
+}
+
 void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc,
                                        uint32_t metadata_base_layer) {
-	if (desc.info.metadata.kind != ImageMetadataKind::Dcc &&
-	    desc.info.metadata.kind != ImageMetadataKind::Cmask) {
-		return;
+	ImageDesc  clear_desc = desc;
+	auto&      metadata   = clear_desc.info.metadata;
+	const bool from_target =
+	    metadata.kind == ImageMetadataKind::Dcc || metadata.kind == ImageMetadataKind::Cmask;
+	if (!from_target) {
+		// A texture or storage view of a fast-cleared color target sees the clear as well. The
+		// image keeps the metadata and clear registers of its last color-target binding.
+		if (desc.type != BindingType::Texture && desc.type != BindingType::Storage) {
+			return;
+		}
+		std::scoped_lock lock {m_lock};
+		const auto&      image = m_slot_images[id];
+		if ((image.info.metadata.kind != ImageMetadataKind::Dcc &&
+		     image.info.metadata.kind != ImageMetadataKind::Cmask) ||
+		    !image.info.metadata.clear_register_valid ||
+		    image.info.data.address != desc.info.data.address || desc.info.resources.levels != 1 ||
+		    desc.view_info.level_count != 1 || image.info.IsVolume()) {
+			return;
+		}

Agreed, fixed in 322e6f3. The texture/storage path now uses the cached target metadata only when the cached image has one mip, the same data range and the same layer count as the view, and is not a volume. Anything else keeps the previous behavior.

**@⁠NeySlim** on GitHub · 2026-10-08 10:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4217888662) On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 1166 (outdated): ```diff @@ -1132,22 +1132,54 @@ void TextureCache::InitializeImage(ImageId id) { } } +void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) { + { + std::scoped_lock lock {m_lock}; + const auto* image = m_slot_images.try_get(id); + if (image == nullptr || !image->info.metadata.clear_register_valid) { + return; + } + } + MaterializeColorClear(id, desc, desc.view_info.base_layer); +} + void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc, uint32_t metadata_base_layer) { - if (desc.info.metadata.kind != ImageMetadataKind::Dcc && - desc.info.metadata.kind != ImageMetadataKind::Cmask) { - return; + ImageDesc clear_desc = desc; + auto& metadata = clear_desc.info.metadata; + const bool from_target = + metadata.kind == ImageMetadataKind::Dcc || metadata.kind == ImageMetadataKind::Cmask; + if (!from_target) { + // A texture or storage view of a fast-cleared color target sees the clear as well. The + // image keeps the metadata and clear registers of its last color-target binding. + if (desc.type != BindingType::Texture && desc.type != BindingType::Storage) { + return; + } + std::scoped_lock lock {m_lock}; + const auto& image = m_slot_images[id]; + if ((image.info.metadata.kind != ImageMetadataKind::Dcc && + image.info.metadata.kind != ImageMetadataKind::Cmask) || + !image.info.metadata.clear_register_valid || + image.info.data.address != desc.info.data.address || desc.info.resources.levels != 1 || + desc.view_info.level_count != 1 || image.info.IsVolume()) { + return; + } ``` Agreed, fixed in 322e6f3. The texture/storage path now uses the cached target metadata only when the cached image has one mip, the same data range and the same layer count as the view, and is not a volume. Anything else keeps the previous behavior.
@ -827,2 +827,4 @@
BindImage(images[i].image_id,
images[i].desc.type == TextureCache::BindingType::Storage);
} else {
texture_cache.MaterializeViewClear(images[i].image_id, images[i].desc);
Author
Owner

@⁠NeySlim on GitHub · 2026-10-08 10:38 UTC · original

Agreed, fixed in 322e6f3. For texture and storage views, the target's recorded metadata and clear registers now take precedence over the view's own DCC/CMASK metadata, and the decode goes through the RenderTarget path. The view's metadata no longer overwrites the target's, and clear_format is only recorded from a color-target binding. New check in RenderExecutorColorMetadataClear, "metadata texture view sees target clear": a texture view carrying the target's metadata without clear registers, with the target unprogrammed during the fill so only the view can apply the clear. It fails without the change.

**@⁠NeySlim** on GitHub · 2026-10-08 10:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4217888893) Agreed, fixed in 322e6f3. For texture and storage views, the target's recorded metadata and clear registers now take precedence over the view's own DCC/CMASK metadata, and the decode goes through the `RenderTarget` path. The view's metadata no longer overwrites the target's, and `clear_format` is only recorded from a color-target binding. New check in `RenderExecutorColorMetadataClear`, "metadata texture view sees target clear": a texture view carrying the target's metadata without clear registers, with the target unprogrammed during the fill so only the view can apply the clear. It fails without the change.
Author
Owner

@⁠NeySlim on GitHub · 2026-10-08 10:39 UTC · original
On src/graphics/host_gpu/renderer/renderCompute.cpp line 465 (outdated):

@@ -434,9 +436,38 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer,
 
 	// The removed host fence also ordered read-only dispatches before later writers.
 	ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader);
+	// A shader rewriting color metadata performs a fast clear; the target may only be
+	// programmed later, so remember the range until a color slot names it.
+	constexpr size_t MaxPendingMetaFills = 1024;
+	if (m_pending_meta_fills.size() > MaxPendingMetaFills) {
+		m_pending_meta_fills.clear();
+	}
+	for (uint32_t i = 0; i < program.info.buffers.size(); i++) {
+		if (!program.info.buffers[i].written) continue;
+		const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]);
+		if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48());
+	}
+	ResolvePendingMetaClears(buffer);
 	ResetBindings();
 }
 
+// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or
+// without a draw: the texture reads that follow expect the cleared color.
+void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) {
+	if (m_pending_meta_fills.empty()) return;
+	const auto& hw = buffer.GetRegisters();
+	for (uint32_t slot = 0; slot < 8; slot++) {
+		const auto& rt = hw.GetRenderTarget(slot);
+		if (rt.base.addr == 0 ||
+		    !(rt.info.cmask_fast_clear_enable || rt.info.dcc_compression_enable))
+			continue;
+		const auto meta = rt.info.dcc_compression_enable ? rt.dcc_addr.addr : rt.cmask.addr;
+		if (m_pending_meta_fills.erase(meta) == 0) continue;

Agreed, fixed in 322e6f3. ResolvePendingMetaClears now uses the same eligibility as ResolveRenderColorTarget (DCC with an address, or CMASK only for a single-sample target without FMASK compression or VRS-to-CMASK) and keeps the pending address otherwise.

**@⁠NeySlim** on GitHub · 2026-10-08 10:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4217889060) On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 465 (outdated): ```diff @@ -434,9 +436,38 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer, // The removed host fence also ordered read-only dispatches before later writers. ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader); + // A shader rewriting color metadata performs a fast clear; the target may only be + // programmed later, so remember the range until a color slot names it. + constexpr size_t MaxPendingMetaFills = 1024; + if (m_pending_meta_fills.size() > MaxPendingMetaFills) { + m_pending_meta_fills.clear(); + } + for (uint32_t i = 0; i < program.info.buffers.size(); i++) { + if (!program.info.buffers[i].written) continue; + const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]); + if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48()); + } + ResolvePendingMetaClears(buffer); ResetBindings(); } +// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or +// without a draw: the texture reads that follow expect the cleared color. +void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) { + if (m_pending_meta_fills.empty()) return; + const auto& hw = buffer.GetRegisters(); + for (uint32_t slot = 0; slot < 8; slot++) { + const auto& rt = hw.GetRenderTarget(slot); + if (rt.base.addr == 0 || + !(rt.info.cmask_fast_clear_enable || rt.info.dcc_compression_enable)) + continue; + const auto meta = rt.info.dcc_compression_enable ? rt.dcc_addr.addr : rt.cmask.addr; + if (m_pending_meta_fills.erase(meta) == 0) continue; ``` Agreed, fixed in 322e6f3. `ResolvePendingMetaClears` now uses the same eligibility as `ResolveRenderColorTarget` (DCC with an address, or CMASK only for a single-sample target without FMASK compression or VRS-to-CMASK) and keeps the pending address otherwise.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 10:43 UTC · original
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 1166 (outdated):

@@ -1132,22 +1132,54 @@ void TextureCache::InitializeImage(ImageId id) {
 	}
 }
 
+void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) {
+	{
+		std::scoped_lock lock {m_lock};
+		const auto*      image = m_slot_images.try_get(id);
+		if (image == nullptr || !image->info.metadata.clear_register_valid) {
+			return;
+		}
+	}
+	MaterializeColorClear(id, desc, desc.view_info.base_layer);
+}
+
 void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc,
                                        uint32_t metadata_base_layer) {
-	if (desc.info.metadata.kind != ImageMetadataKind::Dcc &&
-	    desc.info.metadata.kind != ImageMetadataKind::Cmask) {
-		return;
+	ImageDesc  clear_desc = desc;
+	auto&      metadata   = clear_desc.info.metadata;
+	const bool from_target =
+	    metadata.kind == ImageMetadataKind::Dcc || metadata.kind == ImageMetadataKind::Cmask;
+	if (!from_target) {
+		// A texture or storage view of a fast-cleared color target sees the clear as well. The
+		// image keeps the metadata and clear registers of its last color-target binding.
+		if (desc.type != BindingType::Texture && desc.type != BindingType::Storage) {
+			return;
+		}
+		std::scoped_lock lock {m_lock};
+		const auto&      image = m_slot_images[id];
+		if ((image.info.metadata.kind != ImageMetadataKind::Dcc &&
+		     image.info.metadata.kind != ImageMetadataKind::Cmask) ||
+		    !image.info.metadata.clear_register_valid ||
+		    image.info.data.address != desc.info.data.address || desc.info.resources.levels != 1 ||
+		    desc.view_info.level_count != 1 || image.info.IsVolume()) {
+			return;
+		}

@NeySlim Thanks for the fix in 322e6f3. The updated guards address the cached metadata layout mismatch.


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-08 10:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4217924485) On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 1166 (outdated): ```diff @@ -1132,22 +1132,54 @@ void TextureCache::InitializeImage(ImageId id) { } } +void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) { + { + std::scoped_lock lock {m_lock}; + const auto* image = m_slot_images.try_get(id); + if (image == nullptr || !image->info.metadata.clear_register_valid) { + return; + } + } + MaterializeColorClear(id, desc, desc.view_info.base_layer); +} + void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc, uint32_t metadata_base_layer) { - if (desc.info.metadata.kind != ImageMetadataKind::Dcc && - desc.info.metadata.kind != ImageMetadataKind::Cmask) { - return; + ImageDesc clear_desc = desc; + auto& metadata = clear_desc.info.metadata; + const bool from_target = + metadata.kind == ImageMetadataKind::Dcc || metadata.kind == ImageMetadataKind::Cmask; + if (!from_target) { + // A texture or storage view of a fast-cleared color target sees the clear as well. The + // image keeps the metadata and clear registers of its last color-target binding. + if (desc.type != BindingType::Texture && desc.type != BindingType::Storage) { + return; + } + std::scoped_lock lock {m_lock}; + const auto& image = m_slot_images[id]; + if ((image.info.metadata.kind != ImageMetadataKind::Dcc && + image.info.metadata.kind != ImageMetadataKind::Cmask) || + !image.info.metadata.clear_register_valid || + image.info.data.address != desc.info.data.address || desc.info.resources.levels != 1 || + desc.view_info.level_count != 1 || image.info.IsVolume()) { + return; + } ``` `@NeySlim` Thanks for the fix in `322e6f3`. The updated guards address the cached metadata layout mismatch. --- <!-- 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=%40coderabbitai%20caught%20a%20texture-cache%20correctness%20bug%3A%20mismatched%20mip%20levels%2C%20data%20ranges%2C%20or%20layer%20counts%20could%20corrupt%20metadata%20slices%20or%20clear%20the%20wrong%20layers.%20Validate%20cached%20layouts%20before%20reuse.%20%F0%9F%9B%A0%EF%B8%8F%F0%9F%8E%AF&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1200%23discussion_r4217684363)? 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

@⁠coderabbitai[bot] on GitHub · 2026-10-08 10:43 UTC · original
On src/graphics/host_gpu/renderer/renderCompute.cpp line 465 (outdated):

@@ -434,9 +436,38 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer,
 
 	// The removed host fence also ordered read-only dispatches before later writers.
 	ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader);
+	// A shader rewriting color metadata performs a fast clear; the target may only be
+	// programmed later, so remember the range until a color slot names it.
+	constexpr size_t MaxPendingMetaFills = 1024;
+	if (m_pending_meta_fills.size() > MaxPendingMetaFills) {
+		m_pending_meta_fills.clear();
+	}
+	for (uint32_t i = 0; i < program.info.buffers.size(); i++) {
+		if (!program.info.buffers[i].written) continue;
+		const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]);
+		if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48());
+	}
+	ResolvePendingMetaClears(buffer);
 	ResetBindings();
 }
 
+// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or
+// without a draw: the texture reads that follow expect the cleared color.
+void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) {
+	if (m_pending_meta_fills.empty()) return;
+	const auto& hw = buffer.GetRegisters();
+	for (uint32_t slot = 0; slot < 8; slot++) {
+		const auto& rt = hw.GetRenderTarget(slot);
+		if (rt.base.addr == 0 ||
+		    !(rt.info.cmask_fast_clear_enable || rt.info.dcc_compression_enable))
+			continue;
+		const auto meta = rt.info.dcc_compression_enable ? rt.dcc_addr.addr : rt.cmask.addr;
+		if (m_pending_meta_fills.erase(meta) == 0) continue;

@NeySlim, thanks for the fix. The updated ResolvePendingMetaClears checks metadata eligibility before erasing the pending address. Ineligible targets retain the pending address, which addresses this finding.


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-08 10:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4217924749) On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 465 (outdated): ```diff @@ -434,9 +436,38 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer, // The removed host fence also ordered read-only dispatches before later writers. ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader); + // A shader rewriting color metadata performs a fast clear; the target may only be + // programmed later, so remember the range until a color slot names it. + constexpr size_t MaxPendingMetaFills = 1024; + if (m_pending_meta_fills.size() > MaxPendingMetaFills) { + m_pending_meta_fills.clear(); + } + for (uint32_t i = 0; i < program.info.buffers.size(); i++) { + if (!program.info.buffers[i].written) continue; + const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]); + if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48()); + } + ResolvePendingMetaClears(buffer); ResetBindings(); } +// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or +// without a draw: the texture reads that follow expect the cleared color. +void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) { + if (m_pending_meta_fills.empty()) return; + const auto& hw = buffer.GetRegisters(); + for (uint32_t slot = 0; slot < 8; slot++) { + const auto& rt = hw.GetRenderTarget(slot); + if (rt.base.addr == 0 || + !(rt.info.cmask_fast_clear_enable || rt.info.dcc_compression_enable)) + continue; + const auto meta = rt.info.dcc_compression_enable ? rt.dcc_addr.addr : rt.cmask.addr; + if (m_pending_meta_fills.erase(meta) == 0) continue; ``` `@NeySlim`, thanks for the fix. The updated `ResolvePendingMetaClears` checks metadata eligibility before erasing the pending address. Ineligible targets retain the pending address, which addresses this finding. --- <!-- 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=Pending%20CMASK%20clears%20must%20survive%20until%20the%20target%20can%20consume%20them.%20%40coderabbitai%20caught%20the%20eligibility%20mismatch%E2%80%94and%20the%20fix%20keeps%20metadata%20intact.%20Try%20CodeRabbit%20for%20sharper%20reviews!%20%F0%9F%9B%A0%EF%B8%8F&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1200%23discussion_r4217684395)? 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 -->
@ -827,2 +827,4 @@
BindImage(images[i].image_id,
images[i].desc.type == TextureCache::BindingType::Storage);
} else {
texture_cache.MaterializeViewClear(images[i].image_id, images[i].desc);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 10:43 UTC · original

@NeySlim, thanks for the fix and clarification. The change in 322e6f3 addresses the metadata precedence and RenderTarget decode concerns. The regression check covers a metadata-bearing texture view when the target is unprogrammed.


✏️ Learnings added
Learnt from: NeySlim
Repo: KytyPS5/KytyPS5 PR: 1200
File: src/graphics/host_gpu/renderer/pipeline/descriptors.cpp:917-917
Timestamp: 2026-10-08T10:43:38.979Z
Learning: In KytyPS5's C++ TextureCache clear-materialization path in src/graphics/host_gpu/renderer/cache/textureCache.cpp, texture and storage views must use the cached color target's recorded metadata and clear registers in preference to the view's DCC/CMASK metadata. Register-clear decoding must use the RenderTarget path. Record ImageMetadataInfo::clear_format only from a color-target binding.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


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-08 10:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4217931037) `@NeySlim`, thanks for the fix and clarification. The change in `322e6f3` addresses the metadata precedence and `RenderTarget` decode concerns. The regression check covers a metadata-bearing texture view when the target is unprogrammed. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: NeySlim Repo: KytyPS5/KytyPS5 PR: 1200 File: src/graphics/host_gpu/renderer/pipeline/descriptors.cpp:917-917 Timestamp: 2026-10-08T10:43:38.979Z Learning: In KytyPS5's C++ TextureCache clear-materialization path in src/graphics/host_gpu/renderer/cache/textureCache.cpp, texture and storage views must use the cached color target's recorded metadata and clear registers in preference to the view's DCC/CMASK metadata. Register-clear decoding must use the RenderTarget path. Record ImageMetadataInfo::clear_format only from a color-target binding. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> --- <!-- 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=A%20cached%20DCC%20texture%20or%20storage%20view%20could%20miss%20a%20target%20fast%20clear%20and%20show%20stale%20pixels.%20%40coderabbitai%E2%80%99s%20fix%20preserves%20target%20metadata%20and%20routes%20clear%20decoding%20correctly%E2%80%94with%20a%20regression%20test.%20Try%20%40coderabbitai%20%F0%9F%90%9B&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1200%23discussion_r4217684387)? 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

@⁠coderabbitai[bot] on GitHub · 2026-10-08 13:19 UTC · original · edited 2026-10-08 13:25 UTC
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 1149 (outdated):

@@ -1132,22 +1132,62 @@ void TextureCache::InitializeImage(ImageId id) {
 	}
 }
 
+void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) {
+	{
+		std::scoped_lock lock {m_lock};
+		const auto*      image = m_slot_images.try_get(id);
+		if (image == nullptr || !image->info.metadata.clear_register_valid) {
+			return;
+		}
+	}
+	MaterializeColorClear(id, desc, desc.view_info.base_layer);
+}
+
 void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc,
                                        uint32_t metadata_base_layer) {
-	if (desc.info.metadata.kind != ImageMetadataKind::Dcc &&
-	    desc.info.metadata.kind != ImageMetadataKind::Cmask) {
+	const bool        desc_metadata = desc.info.metadata.kind == ImageMetadataKind::Dcc ||
+	                                  desc.info.metadata.kind == ImageMetadataKind::Cmask;

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Clear cached metadata when a render target has no color metadata.

If a cached render target is rebound without DCC or CMASK, desc_metadata is false. The early return leaves the previous image.info.metadata and its valid clear registers in place. A later texture view can select that stale target metadata and clear the native image from old metadata bytes. Update the cached metadata for a metadata-less render-target binding before returning.

✅ Confirmed as addressed by @⁠NeySlim

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 13:19 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4219429670) · edited 2026-10-08 13:25 UTC On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 1149 (outdated): ```diff @@ -1132,22 +1132,62 @@ void TextureCache::InitializeImage(ImageId id) { } } +void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) { + { + std::scoped_lock lock {m_lock}; + const auto* image = m_slot_images.try_get(id); + if (image == nullptr || !image->info.metadata.clear_register_valid) { + return; + } + } + MaterializeColorClear(id, desc, desc.view_info.base_layer); +} + void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc, uint32_t metadata_base_layer) { - if (desc.info.metadata.kind != ImageMetadataKind::Dcc && - desc.info.metadata.kind != ImageMetadataKind::Cmask) { + const bool desc_metadata = desc.info.metadata.kind == ImageMetadataKind::Dcc || + desc.info.metadata.kind == ImageMetadataKind::Cmask; ``` **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** **Clear cached metadata when a render target has no color metadata.** If a cached render target is rebound without DCC or CMASK, `desc_metadata` is false. The early return leaves the previous `image.info.metadata` and its valid clear registers in place. A later texture view can select that stale target metadata and clear the native image from old metadata bytes. Update the cached metadata for a metadata-less render-target binding before returning. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:498e7aba6e92d54d1f639c5f --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠NeySlim <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 13:19 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: 3b5d183b-6266-4a76-aa5a-75efad187dd8
📥 Commits

Reviewing files that changed from the base of the PR and between 322e6f3b6b59be12a43e3a201c09105b009c3e48 and e5a64a5973b701802e284597fd88b9ba35775b9b.

📒 Files selected for processing (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; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 13:19 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#pullrequestreview-5457208497) · **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**: `3b5d183b-6266-4a76-aa5a-75efad187dd8` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 322e6f3b6b59be12a43e3a201c09105b009c3e48 and e5a64a5973b701802e284597fd88b9ba35775b9b. </details> <details> <summary>📒 Files selected for processing (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; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=a5362b09-e2eb-4383-a1e2-2b104b48b823 attempt=c0ca69e7-b096-4b76-9ee3-92782c0d3643 batch=1/1 -->
Author
Owner

@⁠NeySlim on GitHub · 2026-10-08 13:25 UTC · original
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 1149 (outdated):

@@ -1132,22 +1132,62 @@ void TextureCache::InitializeImage(ImageId id) {
 	}
 }
 
+void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) {
+	{
+		std::scoped_lock lock {m_lock};
+		const auto*      image = m_slot_images.try_get(id);
+		if (image == nullptr || !image->info.metadata.clear_register_valid) {
+			return;
+		}
+	}
+	MaterializeColorClear(id, desc, desc.view_info.base_layer);
+}
+
 void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc,
                                        uint32_t metadata_base_layer) {
-	if (desc.info.metadata.kind != ImageMetadataKind::Dcc &&
-	    desc.info.metadata.kind != ImageMetadataKind::Cmask) {
+	const bool        desc_metadata = desc.info.metadata.kind == ImageMetadataKind::Dcc ||
+	                                  desc.info.metadata.kind == ImageMetadataKind::Cmask;

Agreed, fixed in 9b6c9ba: a render-target binding without color metadata now drops the previous DCC/CMASK metadata and clear registers before the early return. New check in RenderExecutorColorMetadataClear, "metadata-less rebind forgets the clear": fresh clear keys, a metadata-less rebind, drawn texels, then a texture view must keep them. It fails without the change.

**@⁠NeySlim** on GitHub · 2026-10-08 13:25 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4219493759) On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 1149 (outdated): ```diff @@ -1132,22 +1132,62 @@ void TextureCache::InitializeImage(ImageId id) { } } +void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) { + { + std::scoped_lock lock {m_lock}; + const auto* image = m_slot_images.try_get(id); + if (image == nullptr || !image->info.metadata.clear_register_valid) { + return; + } + } + MaterializeColorClear(id, desc, desc.view_info.base_layer); +} + void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc, uint32_t metadata_base_layer) { - if (desc.info.metadata.kind != ImageMetadataKind::Dcc && - desc.info.metadata.kind != ImageMetadataKind::Cmask) { + const bool desc_metadata = desc.info.metadata.kind == ImageMetadataKind::Dcc || + desc.info.metadata.kind == ImageMetadataKind::Cmask; ``` Agreed, fixed in 9b6c9ba: a render-target binding without color metadata now drops the previous DCC/CMASK metadata and clear registers before the early return. New check in `RenderExecutorColorMetadataClear`, "metadata-less rebind forgets the clear": fresh clear keys, a metadata-less rebind, drawn texels, then a texture view must keep them. It fails without the change.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 13:25 UTC · original
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 1149 (outdated):

@@ -1132,22 +1132,62 @@ void TextureCache::InitializeImage(ImageId id) {
 	}
 }
 
+void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) {
+	{
+		std::scoped_lock lock {m_lock};
+		const auto*      image = m_slot_images.try_get(id);
+		if (image == nullptr || !image->info.metadata.clear_register_valid) {
+			return;
+		}
+	}
+	MaterializeColorClear(id, desc, desc.view_info.base_layer);
+}
+
 void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc,
                                        uint32_t metadata_base_layer) {
-	if (desc.info.metadata.kind != ImageMetadataKind::Dcc &&
-	    desc.info.metadata.kind != ImageMetadataKind::Cmask) {
+	const bool        desc_metadata = desc.info.metadata.kind == ImageMetadataKind::Dcc ||
+	                                  desc.info.metadata.kind == ImageMetadataKind::Cmask;

@NeySlim, thanks for the fix. The supplied code drops the cached DCC/CMASK metadata and clear registers before the early return. The reported regression check covers the stale-clear sequence that triggered this finding.


🧠 Learnings used
Learnt from: NeySlim
Repo: KytyPS5/KytyPS5 PR: 1200
File: src/graphics/host_gpu/renderer/pipeline/descriptors.cpp:917-917
Timestamp: 2026-10-08T10:43:43.143Z
Learning: In KytyPS5's C++ TextureCache clear-materialization path in src/graphics/host_gpu/renderer/cache/textureCache.cpp, texture and storage views must use the cached color target's recorded metadata and clear registers in preference to the view's DCC/CMASK metadata. Register-clear decoding must use the RenderTarget path. Record ImageMetadataInfo::clear_format only from a color-target binding.

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-08 13:25 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4219498601) On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 1149 (outdated): ```diff @@ -1132,22 +1132,62 @@ void TextureCache::InitializeImage(ImageId id) { } } +void TextureCache::MaterializeViewClear(ImageId id, const ImageDesc& desc) { + { + std::scoped_lock lock {m_lock}; + const auto* image = m_slot_images.try_get(id); + if (image == nullptr || !image->info.metadata.clear_register_valid) { + return; + } + } + MaterializeColorClear(id, desc, desc.view_info.base_layer); +} + void TextureCache::MaterializeColorClear(ImageId id, const ImageDesc& desc, uint32_t metadata_base_layer) { - if (desc.info.metadata.kind != ImageMetadataKind::Dcc && - desc.info.metadata.kind != ImageMetadataKind::Cmask) { + const bool desc_metadata = desc.info.metadata.kind == ImageMetadataKind::Dcc || + desc.info.metadata.kind == ImageMetadataKind::Cmask; ``` `@NeySlim`, thanks for the fix. The supplied code drops the cached DCC/CMASK metadata and clear registers before the early return. The reported regression check covers the stale-clear sequence that triggered this finding. --- <details> <summary>🧠 Learnings used</summary> ``` Learnt from: NeySlim Repo: KytyPS5/KytyPS5 PR: 1200 File: src/graphics/host_gpu/renderer/pipeline/descriptors.cpp:917-917 Timestamp: 2026-10-08T10:43:43.143Z Learning: In KytyPS5's C++ TextureCache clear-materialization path in src/graphics/host_gpu/renderer/cache/textureCache.cpp, texture and storage views must use the cached color target's recorded metadata and clear registers in preference to the view's DCC/CMASK metadata. Register-clear decoding must use the RenderTarget path. Record ImageMetadataInfo::clear_format only from a color-target binding. ``` </details> --- <!-- 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=Stale%20DCC%2FCMASK%20metadata%20could%20corrupt%20texels%20after%20a%20metadata-less%20rebind.%20Clear%20cached%20metadata%20before%20returning%3B%20a%20regression%20test%20catches%20it.%20Try%20%40coderabbitai%20%F0%9F%90%87&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1200%23discussion_r4219429670)? 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

@⁠NeySlim on GitHub · 2026-10-09 19:53 UTC · original

Rebased on main (59183dbf) together with #1188. The only conflict was an include in renderCompute.cpp that main removed. Rechecked each part against RenderExecutorColorMetadataClear: removing the texture-view path, the pending metadata fills, or the metadata-less rebind reset each makes it fail. Full GPU suite, one case per process: 602/612, same as main.

**@⁠NeySlim** on GitHub · 2026-10-09 19:53 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#issuecomment-6088195892) Rebased on main (59183dbf) together with #1188. The only conflict was an include in `renderCompute.cpp` that main removed. Rechecked each part against `RenderExecutorColorMetadataClear`: removing the texture-view path, the pending metadata fills, or the metadata-less rebind reset each makes it fail. Full GPU suite, one case per process: 602/612, same as main.
@ -458,0 +474,4 @@
const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]);
if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48());
}
ResolvePendingMetaClears(buffer);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 19:57 UTC · original · edited 2026-10-09 20:47 UTC

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

Track metadata writes from indirect dispatches.

If DispatchIndirect fills DCC or CMASK through a written buffer, it does not add that buffer address to m_pending_meta_fills. Its path at Lines 481-539 also does not call ResolvePendingMetaClears. A later texture read can therefore observe the unmaterialized clear. Apply the same eligible-write tracking and resolution to indirect dispatches.

✅ Addressed in commits 7afa1ef to 4d58b55

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 19:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234046642) · edited 2026-10-09 20:47 UTC **🗄️ Data Integrity & Integration** | **🟠 Major** | **🏗️ Heavy lift** **Track metadata writes from indirect dispatches.** If `DispatchIndirect` fills DCC or CMASK through a written buffer, it does not add that buffer address to `m_pending_meta_fills`. Its path at Lines 481-539 also does not call `ResolvePendingMetaClears`. A later texture read can therefore observe the unmaterialized clear. Apply the same eligible-write tracking and resolution to indirect dispatches. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:e5a76b918f08585759b9ab5c --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commits 7afa1ef to 4d58b55
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 19:57 UTC · original · edited 2026-10-09 20:47 UTC
On src/graphics/host_gpu/renderer/renderCompute.cpp line 477 (outdated):

@@ -434,9 +436,48 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer,
 
 	// The removed host fence also ordered read-only dispatches before later writers.
 	ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader);
+	// A shader rewriting color metadata performs a fast clear; the target may only be
+	// programmed later, so remember the range until a color slot names it.
+	constexpr size_t MaxPendingMetaFills = 1024;
+	if (m_pending_meta_fills.size() > MaxPendingMetaFills) {
+		m_pending_meta_fills.clear();
+	}
+	for (uint32_t i = 0; i < program.info.buffers.size(); i++) {
+		if (!program.info.buffers[i].written) continue;
+		const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]);
+		if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48());
+	}
+	ResolvePendingMetaClears(buffer);
 	ResetBindings();
 }
 
+// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or
+// without a draw: the texture reads that follow expect the cleared color.
+void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) {
+	if (m_pending_meta_fills.empty()) {
+		return;
+	}
+	const auto& hw = buffer.GetRegisters();
+	for (uint32_t slot = 0; slot < 8; slot++) {
+		const auto& rt = hw.GetRenderTarget(slot);
+		// Same eligibility as ResolveRenderColorTarget, so a fill is only consumed when the
+		// target can attach the rewritten metadata.
+		const bool dcc = rt.info.dcc_compression_enable && rt.dcc_addr.addr != 0;
+		const bool cmask =
+		    !rt.info.dcc_compression_enable && rt.info.cmask_fast_clear_enable &&
+		    rt.cmask.addr != 0 && render_sample_count(rt.attrib.num_fragments) == 1 &&
+		    !rt.info.fmask_compression_enable && !rt.attrib3.write_vrs_rate_hint_to_cmask;
+		if (rt.base.addr == 0 || (!dcc && !cmask)) {
+			continue;
+		}
+		if (m_pending_meta_fills.erase(dcc ? rt.dcc_addr.addr : rt.cmask.addr) == 0) {
+			continue;
+		}
+		RenderColorInfo color {};
+		ResolveRenderColorTarget(buffer, color, 0, slot, true, false);

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Resolve every slot that matches a pending address.

If two programmed color slots use the same DCC or CMASK address, erase succeeds for the first slot only. The second slot is skipped, even if it names a different image or layer that also needs resolution. Keep the address available throughout this scan, then remove it after all matching slots have been resolved.

✅ Addressed in commits 7afa1ef to 4d58b55

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 19:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234046650) · edited 2026-10-09 20:47 UTC On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 477 (outdated): ```diff @@ -434,9 +436,48 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer, // The removed host fence also ordered read-only dispatches before later writers. ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader); + // A shader rewriting color metadata performs a fast clear; the target may only be + // programmed later, so remember the range until a color slot names it. + constexpr size_t MaxPendingMetaFills = 1024; + if (m_pending_meta_fills.size() > MaxPendingMetaFills) { + m_pending_meta_fills.clear(); + } + for (uint32_t i = 0; i < program.info.buffers.size(); i++) { + if (!program.info.buffers[i].written) continue; + const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]); + if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48()); + } + ResolvePendingMetaClears(buffer); ResetBindings(); } +// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or +// without a draw: the texture reads that follow expect the cleared color. +void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) { + if (m_pending_meta_fills.empty()) { + return; + } + const auto& hw = buffer.GetRegisters(); + for (uint32_t slot = 0; slot < 8; slot++) { + const auto& rt = hw.GetRenderTarget(slot); + // Same eligibility as ResolveRenderColorTarget, so a fill is only consumed when the + // target can attach the rewritten metadata. + const bool dcc = rt.info.dcc_compression_enable && rt.dcc_addr.addr != 0; + const bool cmask = + !rt.info.dcc_compression_enable && rt.info.cmask_fast_clear_enable && + rt.cmask.addr != 0 && render_sample_count(rt.attrib.num_fragments) == 1 && + !rt.info.fmask_compression_enable && !rt.attrib3.write_vrs_rate_hint_to_cmask; + if (rt.base.addr == 0 || (!dcc && !cmask)) { + continue; + } + if (m_pending_meta_fills.erase(dcc ? rt.dcc_addr.addr : rt.cmask.addr) == 0) { + continue; + } + RenderColorInfo color {}; + ResolveRenderColorTarget(buffer, color, 0, slot, true, false); ``` **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** **Resolve every slot that matches a pending address.** If two programmed color slots use the same DCC or CMASK address, `erase` succeeds for the first slot only. The second slot is skipped, even if it names a different image or layer that also needs resolution. Keep the address available throughout this scan, then remove it after all matching slots have been resolved. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:09babf75d472d2f7bf736493 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commits 7afa1ef to 4d58b55
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 19:57 UTC · original · edited 2026-10-09 20:47 UTC
On tests/ShaderRecompilerComputeTests.cpp line 10862 (outdated):

@@ -10846,6 +10856,84 @@ class VulkanHarness {
         Require(name, "complete fill after partial fill",
                 read_texel() == expected,
                 "completing the metadata overwrite did not restore its clear");
+        // A texture view of the fast-cleared target sees the clear without a
+        // color bind.
+        paint();
+        fill_metadata(metadata_words);

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep the target unprogrammed during the metadata fill.

The target is still programmed when fill_metadata() runs. The new dispatch path can resolve that target before FindTexture() runs. This check can therefore pass even if a metadata-less texture view fails to materialize the clear. Set the color base to zero for the fill, then restore it before acquiring the view.

✅ Addressed in commits 7afa1ef to 4d58b55

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 19:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234046659) · edited 2026-10-09 20:47 UTC On `tests/ShaderRecompilerComputeTests.cpp` line 10862 (outdated): ```diff @@ -10846,6 +10856,84 @@ class VulkanHarness { Require(name, "complete fill after partial fill", read_texel() == expected, "completing the metadata overwrite did not restore its clear"); + // A texture view of the fast-cleared target sees the clear without a + // color bind. + paint(); + fill_metadata(metadata_words); ``` **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Keep the target unprogrammed during the metadata fill.** The target is still programmed when `fill_metadata()` runs. The new dispatch path can resolve that target before `FindTexture()` runs. This check can therefore pass even if a metadata-less texture view fails to materialize the clear. Set the color base to zero for the fill, then restore it before acquiring the view. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:e669c1be1e4db5999f594860 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commits 7afa1ef to 4d58b55
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 19:57 UTC · original · edited 2026-10-09 20:47 UTC
On tests/ShaderRecompilerComputeTests.cpp line 10922 (outdated):

@@ -10846,6 +10856,84 @@ class VulkanHarness {
         Require(name, "complete fill after partial fill",
                 read_texel() == expected,
                 "completing the metadata overwrite did not restore its clear");
+        // A texture view of the fast-cleared target sees the clear without a
+        // color bind.
+        paint();
+        fill_metadata(metadata_words);
+        {
+          ImageDesc sampled = color.desc;
+          sampled.type = BindingType::Texture;
+          sampled.info.metadata = {};
+          sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled;
+          RenderExecutorTestAccess::ResetBindings(executor);
+          const auto sampled_id = texture_cache.FindImage(sampled);
+          (void)texture_cache.FindTexture(sampled_id, sampled);
+          Require(name, "texture view reuses target image",
+                  sampled_id == color.image_id,
+                  "a texture view of the fast-cleared target created another "
+                  "image");
+          Require(
+              name, "texture view sees metadata clear",
+              read_texel() == expected,
+              "a texture binding read drawn texels of a fast-cleared target");
+        }
+        bind();
+        // A texture view carrying the target's metadata, without the clear
+        // registers a T# lacks, still uses the target's registers. The target
+        // is unprogrammed during the fill so only the view can apply the clear.
+        paint();
+        registers.SetColorBase(0, {.addr = 0});
+        fill_metadata(metadata_words);
+        registers.SetColorBase(0, {.addr = base});
+        {
+          ImageDesc sampled = color.desc;
+          sampled.type = BindingType::Texture;
+          sampled.info.metadata.clear_register_valid = false;
+          sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled;
+          RenderExecutorTestAccess::ResetBindings(executor);
+          const auto sampled_id = texture_cache.FindImage(sampled);
+          (void)texture_cache.FindTexture(sampled_id, sampled);
+          Require(name, "metadata texture view sees target clear",
+                  sampled_id == color.image_id && read_texel() == expected,
+                  "a texture view with metadata lost the target's clear "
+                  "registers");
+        }
+        bind();
+        // A later binding of the target without color metadata forgets the
+        // old clear state, so a texture view keeps the drawn texels.
+        {
+          // Fresh clear keys, with the target unprogrammed so no draw or
+          // dispatch consumes them before the metadata-less rebind.
+          registers.SetColorBase(0, {.addr = 0});
+          fill_metadata(metadata_words);
+          registers.SetColorBase(0, {.addr = base});
+          ImageDesc plain = color.desc;
+          plain.info.metadata = {};
+          (void)texture_cache.FindImage(plain);
+          paint();
+          ImageDesc sampled = color.desc;
+          sampled.type = BindingType::Texture;
+          sampled.info.metadata = {};
+          sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled;
+          RenderExecutorTestAccess::ResetBindings(executor);
+          const auto sampled_id = texture_cache.FindImage(sampled);
+          (void)texture_cache.FindTexture(sampled_id, sampled);
+          Require(name, "metadata-less rebind forgets the clear",
+                  sampled_id == color.image_id && retains_painted_texel(),

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Check every painted texel after the metadata-less rebind.

retains_painted_texel() succeeds when just one texel still has the painted value. A stale clear that changes the rest of the selected layer would pass this new check. Compare the complete selected layer with the repeated painted value.

✅ Addressed in commits 7afa1ef to 4d58b55

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 19:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234046670) · edited 2026-10-09 20:47 UTC On `tests/ShaderRecompilerComputeTests.cpp` line 10922 (outdated): ```diff @@ -10846,6 +10856,84 @@ class VulkanHarness { Require(name, "complete fill after partial fill", read_texel() == expected, "completing the metadata overwrite did not restore its clear"); + // A texture view of the fast-cleared target sees the clear without a + // color bind. + paint(); + fill_metadata(metadata_words); + { + ImageDesc sampled = color.desc; + sampled.type = BindingType::Texture; + sampled.info.metadata = {}; + sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled; + RenderExecutorTestAccess::ResetBindings(executor); + const auto sampled_id = texture_cache.FindImage(sampled); + (void)texture_cache.FindTexture(sampled_id, sampled); + Require(name, "texture view reuses target image", + sampled_id == color.image_id, + "a texture view of the fast-cleared target created another " + "image"); + Require( + name, "texture view sees metadata clear", + read_texel() == expected, + "a texture binding read drawn texels of a fast-cleared target"); + } + bind(); + // A texture view carrying the target's metadata, without the clear + // registers a T# lacks, still uses the target's registers. The target + // is unprogrammed during the fill so only the view can apply the clear. + paint(); + registers.SetColorBase(0, {.addr = 0}); + fill_metadata(metadata_words); + registers.SetColorBase(0, {.addr = base}); + { + ImageDesc sampled = color.desc; + sampled.type = BindingType::Texture; + sampled.info.metadata.clear_register_valid = false; + sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled; + RenderExecutorTestAccess::ResetBindings(executor); + const auto sampled_id = texture_cache.FindImage(sampled); + (void)texture_cache.FindTexture(sampled_id, sampled); + Require(name, "metadata texture view sees target clear", + sampled_id == color.image_id && read_texel() == expected, + "a texture view with metadata lost the target's clear " + "registers"); + } + bind(); + // A later binding of the target without color metadata forgets the + // old clear state, so a texture view keeps the drawn texels. + { + // Fresh clear keys, with the target unprogrammed so no draw or + // dispatch consumes them before the metadata-less rebind. + registers.SetColorBase(0, {.addr = 0}); + fill_metadata(metadata_words); + registers.SetColorBase(0, {.addr = base}); + ImageDesc plain = color.desc; + plain.info.metadata = {}; + (void)texture_cache.FindImage(plain); + paint(); + ImageDesc sampled = color.desc; + sampled.type = BindingType::Texture; + sampled.info.metadata = {}; + sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled; + RenderExecutorTestAccess::ResetBindings(executor); + const auto sampled_id = texture_cache.FindImage(sampled); + (void)texture_cache.FindTexture(sampled_id, sampled); + Require(name, "metadata-less rebind forgets the clear", + sampled_id == color.image_id && retains_painted_texel(), ``` **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Check every painted texel after the metadata-less rebind.** `retains_painted_texel()` succeeds when just one texel still has the painted value. A stale clear that changes the rest of the selected layer would pass this new check. Compare the complete selected layer with the repeated `painted` value. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:94bf80bfdf79ab456f7647ae --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commits 7afa1ef to 4d58b55
@ -12058,0 +12207,4 @@
RenderExecutorTestAccess::ResetBindings(executor);
fill_metadata(metadata_words);
Require(name, "metadata fill clears without a draw",
read_texel() == expected,
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 19:57 UTC · original · edited 2026-10-09 20:47 UTC

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Check the first metadata fill before the second dispatch.

The assertion runs only after two fills. It can pass if the first dispatch leaves painted texels and the second dispatch resolves them. Add a separate first-fill readback, then repaint before the existing two-dispatch check so that the latter still tests consecutive dispatches without an intervening readback.

✅ Addressed in commits 7afa1ef to 4d58b55

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 19:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234046684) · edited 2026-10-09 20:47 UTC **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Check the first metadata fill before the second dispatch.** The assertion runs only after two fills. It can pass if the first dispatch leaves painted texels and the second dispatch resolves them. Add a separate first-fill readback, then repaint before the existing two-dispatch check so that the latter still tests consecutive dispatches without an intervening readback. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:784d7795cea3fea7bca092aa --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commits 7afa1ef to 4d58b55
Author
Owner

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

Actionable comments posted: 5


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4d53f7fa-7982-45e5-9cc3-d443a879719a
📥 Commits

Reviewing files that changed from the base of the PR and between 9b6c9baf40683cd05c02f1c628465cb129f3bae9 and a7844441e50bddcf648caecc48e5fa890a32db3f.

📒 Files selected for processing (5)
  • src/graphics/host_gpu/renderer/cache/textureCache.h
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/host_gpu/renderer/render.h
  • src/graphics/host_gpu/renderer/renderCompute.cpp
  • tests/ShaderRecompilerComputeTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 19:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#pullrequestreview-5474766682) · **reviewed** **Actionable comments posted: 5** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `4d53f7fa-7982-45e5-9cc3-d443a879719a` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 9b6c9baf40683cd05c02f1c628465cb129f3bae9 and a7844441e50bddcf648caecc48e5fa890a32db3f. </details> <details> <summary>📒 Files selected for processing (5)</summary> * `src/graphics/host_gpu/renderer/cache/textureCache.h` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/host_gpu/renderer/render.h` * `src/graphics/host_gpu/renderer/renderCompute.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=1682bd49-970d-43bd-ab7c-95e4d52f04b1 attempt=37384fa0-ec97-4994-959d-342f1ed2f790 batch=1/1 -->
@ -458,0 +474,4 @@
const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]);
if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48());
}
ResolvePendingMetaClears(buffer);
Author
Owner

@⁠NeySlim on GitHub · 2026-10-09 20:46 UTC · original

Agreed, fixed in 7afa1ef. DispatchIndirect now resolves pending fills before the dispatch and records its written buffers after it, through the same TrackMetaFills helper as DispatchDirect. New check "indirect metadata fill clears" fails without it.

**@⁠NeySlim** on GitHub · 2026-10-09 20:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234412748) Agreed, fixed in 7afa1ef. `DispatchIndirect` now resolves pending fills before the dispatch and records its written buffers after it, through the same `TrackMetaFills` helper as `DispatchDirect`. New check "indirect metadata fill clears" fails without it.
Author
Owner

@⁠NeySlim on GitHub · 2026-10-09 20:46 UTC · original
On src/graphics/host_gpu/renderer/renderCompute.cpp line 477 (outdated):

@@ -434,9 +436,48 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer,
 
 	// The removed host fence also ordered read-only dispatches before later writers.
 	ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader);
+	// A shader rewriting color metadata performs a fast clear; the target may only be
+	// programmed later, so remember the range until a color slot names it.
+	constexpr size_t MaxPendingMetaFills = 1024;
+	if (m_pending_meta_fills.size() > MaxPendingMetaFills) {
+		m_pending_meta_fills.clear();
+	}
+	for (uint32_t i = 0; i < program.info.buffers.size(); i++) {
+		if (!program.info.buffers[i].written) continue;
+		const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]);
+		if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48());
+	}
+	ResolvePendingMetaClears(buffer);
 	ResetBindings();
 }
 
+// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or
+// without a draw: the texture reads that follow expect the cleared color.
+void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) {
+	if (m_pending_meta_fills.empty()) {
+		return;
+	}
+	const auto& hw = buffer.GetRegisters();
+	for (uint32_t slot = 0; slot < 8; slot++) {
+		const auto& rt = hw.GetRenderTarget(slot);
+		// Same eligibility as ResolveRenderColorTarget, so a fill is only consumed when the
+		// target can attach the rewritten metadata.
+		const bool dcc = rt.info.dcc_compression_enable && rt.dcc_addr.addr != 0;
+		const bool cmask =
+		    !rt.info.dcc_compression_enable && rt.info.cmask_fast_clear_enable &&
+		    rt.cmask.addr != 0 && render_sample_count(rt.attrib.num_fragments) == 1 &&
+		    !rt.info.fmask_compression_enable && !rt.attrib3.write_vrs_rate_hint_to_cmask;
+		if (rt.base.addr == 0 || (!dcc && !cmask)) {
+			continue;
+		}
+		if (m_pending_meta_fills.erase(dcc ? rt.dcc_addr.addr : rt.cmask.addr) == 0) {
+			continue;
+		}
+		RenderColorInfo color {};
+		ResolveRenderColorTarget(buffer, color, 0, slot, true, false);

Agreed, fixed in 7afa1ef. Matching addresses are collected during the scan and erased after it, so every slot naming the address is resolved. New check "shared metadata clears every slot" (two slots on different layers of one CMASK) fails without it.

**@⁠NeySlim** on GitHub · 2026-10-09 20:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234412904) On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 477 (outdated): ```diff @@ -434,9 +436,48 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer, // The removed host fence also ordered read-only dispatches before later writers. ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader); + // A shader rewriting color metadata performs a fast clear; the target may only be + // programmed later, so remember the range until a color slot names it. + constexpr size_t MaxPendingMetaFills = 1024; + if (m_pending_meta_fills.size() > MaxPendingMetaFills) { + m_pending_meta_fills.clear(); + } + for (uint32_t i = 0; i < program.info.buffers.size(); i++) { + if (!program.info.buffers[i].written) continue; + const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]); + if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48()); + } + ResolvePendingMetaClears(buffer); ResetBindings(); } +// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or +// without a draw: the texture reads that follow expect the cleared color. +void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) { + if (m_pending_meta_fills.empty()) { + return; + } + const auto& hw = buffer.GetRegisters(); + for (uint32_t slot = 0; slot < 8; slot++) { + const auto& rt = hw.GetRenderTarget(slot); + // Same eligibility as ResolveRenderColorTarget, so a fill is only consumed when the + // target can attach the rewritten metadata. + const bool dcc = rt.info.dcc_compression_enable && rt.dcc_addr.addr != 0; + const bool cmask = + !rt.info.dcc_compression_enable && rt.info.cmask_fast_clear_enable && + rt.cmask.addr != 0 && render_sample_count(rt.attrib.num_fragments) == 1 && + !rt.info.fmask_compression_enable && !rt.attrib3.write_vrs_rate_hint_to_cmask; + if (rt.base.addr == 0 || (!dcc && !cmask)) { + continue; + } + if (m_pending_meta_fills.erase(dcc ? rt.dcc_addr.addr : rt.cmask.addr) == 0) { + continue; + } + RenderColorInfo color {}; + ResolveRenderColorTarget(buffer, color, 0, slot, true, false); ``` Agreed, fixed in 7afa1ef. Matching addresses are collected during the scan and erased after it, so every slot naming the address is resolved. New check "shared metadata clears every slot" (two slots on different layers of one CMASK) fails without it.
Author
Owner

@⁠NeySlim on GitHub · 2026-10-09 20:46 UTC · original
On tests/ShaderRecompilerComputeTests.cpp line 10862 (outdated):

@@ -10846,6 +10856,84 @@ class VulkanHarness {
         Require(name, "complete fill after partial fill",
                 read_texel() == expected,
                 "completing the metadata overwrite did not restore its clear");
+        // A texture view of the fast-cleared target sees the clear without a
+        // color bind.
+        paint();
+        fill_metadata(metadata_words);

Agreed, fixed in 7afa1ef. The target is now unprogrammed during the fill, and the check fails when the texture view path is disabled. This also showed that the view path does not apply to a cached mip chain (the one-mip guard from the earlier review), so that case skips this check.

**@⁠NeySlim** on GitHub · 2026-10-09 20:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234413099) On `tests/ShaderRecompilerComputeTests.cpp` line 10862 (outdated): ```diff @@ -10846,6 +10856,84 @@ class VulkanHarness { Require(name, "complete fill after partial fill", read_texel() == expected, "completing the metadata overwrite did not restore its clear"); + // A texture view of the fast-cleared target sees the clear without a + // color bind. + paint(); + fill_metadata(metadata_words); ``` Agreed, fixed in 7afa1ef. The target is now unprogrammed during the fill, and the check fails when the texture view path is disabled. This also showed that the view path does not apply to a cached mip chain (the one-mip guard from the earlier review), so that case skips this check.
Author
Owner

@⁠NeySlim on GitHub · 2026-10-09 20:46 UTC · original
On tests/ShaderRecompilerComputeTests.cpp line 10922 (outdated):

@@ -10846,6 +10856,84 @@ class VulkanHarness {
         Require(name, "complete fill after partial fill",
                 read_texel() == expected,
                 "completing the metadata overwrite did not restore its clear");
+        // A texture view of the fast-cleared target sees the clear without a
+        // color bind.
+        paint();
+        fill_metadata(metadata_words);
+        {
+          ImageDesc sampled = color.desc;
+          sampled.type = BindingType::Texture;
+          sampled.info.metadata = {};
+          sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled;
+          RenderExecutorTestAccess::ResetBindings(executor);
+          const auto sampled_id = texture_cache.FindImage(sampled);
+          (void)texture_cache.FindTexture(sampled_id, sampled);
+          Require(name, "texture view reuses target image",
+                  sampled_id == color.image_id,
+                  "a texture view of the fast-cleared target created another "
+                  "image");
+          Require(
+              name, "texture view sees metadata clear",
+              read_texel() == expected,
+              "a texture binding read drawn texels of a fast-cleared target");
+        }
+        bind();
+        // A texture view carrying the target's metadata, without the clear
+        // registers a T# lacks, still uses the target's registers. The target
+        // is unprogrammed during the fill so only the view can apply the clear.
+        paint();
+        registers.SetColorBase(0, {.addr = 0});
+        fill_metadata(metadata_words);
+        registers.SetColorBase(0, {.addr = base});
+        {
+          ImageDesc sampled = color.desc;
+          sampled.type = BindingType::Texture;
+          sampled.info.metadata.clear_register_valid = false;
+          sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled;
+          RenderExecutorTestAccess::ResetBindings(executor);
+          const auto sampled_id = texture_cache.FindImage(sampled);
+          (void)texture_cache.FindTexture(sampled_id, sampled);
+          Require(name, "metadata texture view sees target clear",
+                  sampled_id == color.image_id && read_texel() == expected,
+                  "a texture view with metadata lost the target's clear "
+                  "registers");
+        }
+        bind();
+        // A later binding of the target without color metadata forgets the
+        // old clear state, so a texture view keeps the drawn texels.
+        {
+          // Fresh clear keys, with the target unprogrammed so no draw or
+          // dispatch consumes them before the metadata-less rebind.
+          registers.SetColorBase(0, {.addr = 0});
+          fill_metadata(metadata_words);
+          registers.SetColorBase(0, {.addr = base});
+          ImageDesc plain = color.desc;
+          plain.info.metadata = {};
+          (void)texture_cache.FindImage(plain);
+          paint();
+          ImageDesc sampled = color.desc;
+          sampled.type = BindingType::Texture;
+          sampled.info.metadata = {};
+          sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled;
+          RenderExecutorTestAccess::ResetBindings(executor);
+          const auto sampled_id = texture_cache.FindImage(sampled);
+          (void)texture_cache.FindTexture(sampled_id, sampled);
+          Require(name, "metadata-less rebind forgets the clear",
+                  sampled_id == color.image_id && retains_painted_texel(),

Agreed, fixed in 7afa1ef: the check now compares every texel of the selected layer with the painted value.

**@⁠NeySlim** on GitHub · 2026-10-09 20:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234413302) On `tests/ShaderRecompilerComputeTests.cpp` line 10922 (outdated): ```diff @@ -10846,6 +10856,84 @@ class VulkanHarness { Require(name, "complete fill after partial fill", read_texel() == expected, "completing the metadata overwrite did not restore its clear"); + // A texture view of the fast-cleared target sees the clear without a + // color bind. + paint(); + fill_metadata(metadata_words); + { + ImageDesc sampled = color.desc; + sampled.type = BindingType::Texture; + sampled.info.metadata = {}; + sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled; + RenderExecutorTestAccess::ResetBindings(executor); + const auto sampled_id = texture_cache.FindImage(sampled); + (void)texture_cache.FindTexture(sampled_id, sampled); + Require(name, "texture view reuses target image", + sampled_id == color.image_id, + "a texture view of the fast-cleared target created another " + "image"); + Require( + name, "texture view sees metadata clear", + read_texel() == expected, + "a texture binding read drawn texels of a fast-cleared target"); + } + bind(); + // A texture view carrying the target's metadata, without the clear + // registers a T# lacks, still uses the target's registers. The target + // is unprogrammed during the fill so only the view can apply the clear. + paint(); + registers.SetColorBase(0, {.addr = 0}); + fill_metadata(metadata_words); + registers.SetColorBase(0, {.addr = base}); + { + ImageDesc sampled = color.desc; + sampled.type = BindingType::Texture; + sampled.info.metadata.clear_register_valid = false; + sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled; + RenderExecutorTestAccess::ResetBindings(executor); + const auto sampled_id = texture_cache.FindImage(sampled); + (void)texture_cache.FindTexture(sampled_id, sampled); + Require(name, "metadata texture view sees target clear", + sampled_id == color.image_id && read_texel() == expected, + "a texture view with metadata lost the target's clear " + "registers"); + } + bind(); + // A later binding of the target without color metadata forgets the + // old clear state, so a texture view keeps the drawn texels. + { + // Fresh clear keys, with the target unprogrammed so no draw or + // dispatch consumes them before the metadata-less rebind. + registers.SetColorBase(0, {.addr = 0}); + fill_metadata(metadata_words); + registers.SetColorBase(0, {.addr = base}); + ImageDesc plain = color.desc; + plain.info.metadata = {}; + (void)texture_cache.FindImage(plain); + paint(); + ImageDesc sampled = color.desc; + sampled.type = BindingType::Texture; + sampled.info.metadata = {}; + sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled; + RenderExecutorTestAccess::ResetBindings(executor); + const auto sampled_id = texture_cache.FindImage(sampled); + (void)texture_cache.FindTexture(sampled_id, sampled); + Require(name, "metadata-less rebind forgets the clear", + sampled_id == color.image_id && retains_painted_texel(), ``` Agreed, fixed in 7afa1ef: the check now compares every texel of the selected layer with the painted value.
@ -12058,0 +12207,4 @@
RenderExecutorTestAccess::ResetBindings(executor);
fill_metadata(metadata_words);
Require(name, "metadata fill clears without a draw",
read_texel() == expected,
Author
Owner

@⁠NeySlim on GitHub · 2026-10-09 20:46 UTC · original

Agreed, fixed in 7afa1ef. A single fill is checked first, then the target is repainted before the two-dispatch check. The single-fill check fails without the post-dispatch resolve.

**@⁠NeySlim** on GitHub · 2026-10-09 20:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234413522) Agreed, fixed in 7afa1ef. A single fill is checked first, then the target is repainted before the two-dispatch check. The single-fill check fails without the post-dispatch resolve.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 20:47 UTC · original
On src/graphics/host_gpu/renderer/renderCompute.cpp line 477 (outdated):

@@ -434,9 +436,48 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer,
 
 	// The removed host fence also ordered read-only dispatches before later writers.
 	ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader);
+	// A shader rewriting color metadata performs a fast clear; the target may only be
+	// programmed later, so remember the range until a color slot names it.
+	constexpr size_t MaxPendingMetaFills = 1024;
+	if (m_pending_meta_fills.size() > MaxPendingMetaFills) {
+		m_pending_meta_fills.clear();
+	}
+	for (uint32_t i = 0; i < program.info.buffers.size(); i++) {
+		if (!program.info.buffers[i].written) continue;
+		const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]);
+		if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48());
+	}
+	ResolvePendingMetaClears(buffer);
 	ResetBindings();
 }
 
+// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or
+// without a draw: the texture reads that follow expect the cleared color.
+void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) {
+	if (m_pending_meta_fills.empty()) {
+		return;
+	}
+	const auto& hw = buffer.GetRegisters();
+	for (uint32_t slot = 0; slot < 8; slot++) {
+		const auto& rt = hw.GetRenderTarget(slot);
+		// Same eligibility as ResolveRenderColorTarget, so a fill is only consumed when the
+		// target can attach the rewritten metadata.
+		const bool dcc = rt.info.dcc_compression_enable && rt.dcc_addr.addr != 0;
+		const bool cmask =
+		    !rt.info.dcc_compression_enable && rt.info.cmask_fast_clear_enable &&
+		    rt.cmask.addr != 0 && render_sample_count(rt.attrib.num_fragments) == 1 &&
+		    !rt.info.fmask_compression_enable && !rt.attrib3.write_vrs_rate_hint_to_cmask;
+		if (rt.base.addr == 0 || (!dcc && !cmask)) {
+			continue;
+		}
+		if (m_pending_meta_fills.erase(dcc ? rt.dcc_addr.addr : rt.cmask.addr) == 0) {
+			continue;
+		}
+		RenderColorInfo color {};
+		ResolveRenderColorTarget(buffer, color, 0, slot, true, false);

@NeySlim, thanks for the fix. The updated scan resolves every matching slot before it erases the shared metadata address. The new “shared metadata clears every slot” check covers the reported case.


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-09 20:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234417645) On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 477 (outdated): ```diff @@ -434,9 +436,48 @@ void RenderExecutor::DispatchDirect(uint64_t submit_id, CommandBuffer& buffer, // The removed host fence also ordered read-only dispatches before later writers. ShaderAccessBarrier(vk_buffer, vk::PipelineStageFlagBits::eComputeShader); + // A shader rewriting color metadata performs a fast clear; the target may only be + // programmed later, so remember the range until a color slot names it. + constexpr size_t MaxPendingMetaFills = 1024; + if (m_pending_meta_fills.size() > MaxPendingMetaFills) { + m_pending_meta_fills.clear(); + } + for (uint32_t i = 0; i < program.info.buffers.size(); i++) { + if (!program.info.buffers[i].written) continue; + const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]); + if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48()); + } + ResolvePendingMetaClears(buffer); ResetBindings(); } +// Clear the color targets whose fast-clear metadata was rewritten by a shader, with or +// without a draw: the texture reads that follow expect the cleared color. +void RenderExecutor::ResolvePendingMetaClears(CommandBuffer& buffer) { + if (m_pending_meta_fills.empty()) { + return; + } + const auto& hw = buffer.GetRegisters(); + for (uint32_t slot = 0; slot < 8; slot++) { + const auto& rt = hw.GetRenderTarget(slot); + // Same eligibility as ResolveRenderColorTarget, so a fill is only consumed when the + // target can attach the rewritten metadata. + const bool dcc = rt.info.dcc_compression_enable && rt.dcc_addr.addr != 0; + const bool cmask = + !rt.info.dcc_compression_enable && rt.info.cmask_fast_clear_enable && + rt.cmask.addr != 0 && render_sample_count(rt.attrib.num_fragments) == 1 && + !rt.info.fmask_compression_enable && !rt.attrib3.write_vrs_rate_hint_to_cmask; + if (rt.base.addr == 0 || (!dcc && !cmask)) { + continue; + } + if (m_pending_meta_fills.erase(dcc ? rt.dcc_addr.addr : rt.cmask.addr) == 0) { + continue; + } + RenderColorInfo color {}; + ResolveRenderColorTarget(buffer, color, 0, slot, true, false); ``` `@NeySlim`, thanks for the fix. The updated scan resolves every matching slot before it erases the shared metadata address. The new “shared metadata clears every slot” check covers the reported case. --- <!-- 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=Shared%20DCC%2FCMASK%20addresses%20can%20leave%20slots%20unresolved%20if%20erase%20stops%20at%20the%20first%20match.%20Scan%20all%20slots%2C%20then%20clear%20the%20address.%20Try%20%40coderabbitai%20for%20sharp%20code%20reviews%20%F0%9F%8E%AF&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1200%23discussion_r4234046650)? 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 -->
@ -12058,0 +12207,4 @@
RenderExecutorTestAccess::ResetBindings(executor);
fill_metadata(metadata_words);
Require(name, "metadata fill clears without a draw",
read_texel() == expected,
Author
Owner

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

@NeySlim Thanks for the fix in 7afa1ef. The single-fill check covers the first dispatch. Repainting preserves the separate two-dispatch check without an intervening readback.


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-09 20:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234417815) `@NeySlim` Thanks for the fix in `7afa1ef`. The single-fill check covers the first dispatch. Repainting preserves the separate two-dispatch check without an intervening readback. --- <!-- 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=Check%20the%20first%20metadata%20fill%20with%20a%20readback%E2%80%94two%20fills%20can%20hide%20stale%20texels.%20Repaint%20before%20testing%20consecutive%20dispatches.%20Try%20%40coderabbitai%20for%20actionable%20code%20reviews%20%F0%9F%90%87&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1200%23discussion_r4234046684)? 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 -->
@ -458,0 +474,4 @@
const auto d = DecodeNativeDescriptor<ShaderBufferResource>(resources.buffers[i]);
if (d.Base48() != 0 && d.GetSize() <= 0x40000) m_pending_meta_fills.insert(d.Base48());
}
ResolvePendingMetaClears(buffer);
Author
Owner

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

@NeySlim, thanks for the fix. The supplied code confirms that DispatchIndirect resolves pending fills before dispatch and tracks written buffers afterward through TrackMetaFills, matching DispatchDirect.


🧠 Learnings used
Learnt from: NeySlim
Repo: KytyPS5/KytyPS5 PR: 1200
File: src/graphics/host_gpu/renderer/pipeline/descriptors.cpp:917-917
Timestamp: 2026-10-08T10:43:43.143Z
Learning: In KytyPS5's C++ TextureCache clear-materialization path in src/graphics/host_gpu/renderer/cache/textureCache.cpp, texture and storage views must use the cached color target's recorded metadata and clear registers in preference to the view's DCC/CMASK metadata. Register-clear decoding must use the RenderTarget path. Record ImageMetadataInfo::clear_format only from a color-target binding.

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-09 20:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234419222) `@NeySlim`, thanks for the fix. The supplied code confirms that `DispatchIndirect` resolves pending fills before dispatch and tracks written buffers afterward through `TrackMetaFills`, matching `DispatchDirect`. --- <details> <summary>🧠 Learnings used</summary> ``` Learnt from: NeySlim Repo: KytyPS5/KytyPS5 PR: 1200 File: src/graphics/host_gpu/renderer/pipeline/descriptors.cpp:917-917 Timestamp: 2026-10-08T10:43:43.143Z Learning: In KytyPS5's C++ TextureCache clear-materialization path in src/graphics/host_gpu/renderer/cache/textureCache.cpp, texture and storage views must use the cached color target's recorded metadata and clear registers in preference to the view's DCC/CMASK metadata. Register-clear decoding must use the RenderTarget path. Record ImageMetadataInfo::clear_format only from a color-target binding. ``` </details> --- <!-- 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=Indirect%20dispatches%20could%20leave%20DCC%2FCMASK%20clears%20unmaterialized.%20%40coderabbitai%20flagged%20the%20gap%3B%20shared%20tracking%20and%20a%20regression%20check%20fixed%20it.%20Try%20it%20on%20your%20PRs!%20%F0%9F%90%87&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1200%23discussion_r4234046642)? 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

@⁠coderabbitai[bot] on GitHub · 2026-10-09 20:47 UTC · original
On tests/ShaderRecompilerComputeTests.cpp line 10862 (outdated):

@@ -10846,6 +10856,84 @@ class VulkanHarness {
         Require(name, "complete fill after partial fill",
                 read_texel() == expected,
                 "completing the metadata overwrite did not restore its clear");
+        // A texture view of the fast-cleared target sees the clear without a
+        // color bind.
+        paint();
+        fill_metadata(metadata_words);

@NeySlim Thanks for the fix and clarification. Leaving the target unprogrammed during the fill isolates the texture-view path. The reported failure with that path disabled confirms the check covers it. Skipping cached mip chains matches the one-mip guard.


✏️ Learnings added
Learnt from: NeySlim
Repo: KytyPS5/KytyPS5 PR: 1200
File: tests/ShaderRecompilerComputeTests.cpp:0-0
Timestamp: 2026-10-09T20:47:47.142Z
Learning: In KytyPS5's C++ clear-materialization path in src/graphics/host_gpu/renderer/cache/textureCache.cpp, the texture-view path has a one-mip guard and does not apply to cached mip chains. The corresponding texture-view check in CheckRenderExecutorColorMetadataClear in tests/ShaderRecompilerComputeTests.cpp skips cached mip chains.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: NeySlim
Repo: KytyPS5/KytyPS5 PR: 1200
File: src/graphics/host_gpu/renderer/pipeline/descriptors.cpp:917-917
Timestamp: 2026-10-08T10:43:43.143Z
Learning: In KytyPS5's C++ TextureCache clear-materialization path in src/graphics/host_gpu/renderer/cache/textureCache.cpp, texture and storage views must use the cached color target's recorded metadata and clear registers in preference to the view's DCC/CMASK metadata. Register-clear decoding must use the RenderTarget path. Record ImageMetadataInfo::clear_format only from a color-target binding.

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-09 20:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234421888) On `tests/ShaderRecompilerComputeTests.cpp` line 10862 (outdated): ```diff @@ -10846,6 +10856,84 @@ class VulkanHarness { Require(name, "complete fill after partial fill", read_texel() == expected, "completing the metadata overwrite did not restore its clear"); + // A texture view of the fast-cleared target sees the clear without a + // color bind. + paint(); + fill_metadata(metadata_words); ``` `@NeySlim` Thanks for the fix and clarification. Leaving the target unprogrammed during the fill isolates the texture-view path. The reported failure with that path disabled confirms the check covers it. Skipping cached mip chains matches the one-mip guard. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: NeySlim Repo: KytyPS5/KytyPS5 PR: 1200 File: tests/ShaderRecompilerComputeTests.cpp:0-0 Timestamp: 2026-10-09T20:47:47.142Z Learning: In KytyPS5's C++ clear-materialization path in src/graphics/host_gpu/renderer/cache/textureCache.cpp, the texture-view path has a one-mip guard and does not apply to cached mip chains. The corresponding texture-view check in CheckRenderExecutorColorMetadataClear in tests/ShaderRecompilerComputeTests.cpp skips cached mip chains. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> --- <details> <summary>🧠 Learnings used</summary> ``` Learnt from: NeySlim Repo: KytyPS5/KytyPS5 PR: 1200 File: src/graphics/host_gpu/renderer/pipeline/descriptors.cpp:917-917 Timestamp: 2026-10-08T10:43:43.143Z Learning: In KytyPS5's C++ TextureCache clear-materialization path in src/graphics/host_gpu/renderer/cache/textureCache.cpp, texture and storage views must use the cached color target's recorded metadata and clear registers in preference to the view's DCC/CMASK metadata. Register-clear decoding must use the RenderTarget path. Record ImageMetadataInfo::clear_format only from a color-target binding. ``` </details> --- <!-- 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=Keep%20the%20target%20unprogrammed%20during%20metadata%20fill%2C%20then%20restore%20it%20before%20acquiring%20the%20view%E2%80%94otherwise%20dispatch%20can%20mask%20a%20broken%20clear.%20Try%20%40coderabbitai%20for%20actionable%20code%20reviews%20%F0%9F%90%87&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1200%23discussion_r4234046659)? 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

@⁠coderabbitai[bot] on GitHub · 2026-10-09 20:47 UTC · original
On tests/ShaderRecompilerComputeTests.cpp line 10922 (outdated):

@@ -10846,6 +10856,84 @@ class VulkanHarness {
         Require(name, "complete fill after partial fill",
                 read_texel() == expected,
                 "completing the metadata overwrite did not restore its clear");
+        // A texture view of the fast-cleared target sees the clear without a
+        // color bind.
+        paint();
+        fill_metadata(metadata_words);
+        {
+          ImageDesc sampled = color.desc;
+          sampled.type = BindingType::Texture;
+          sampled.info.metadata = {};
+          sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled;
+          RenderExecutorTestAccess::ResetBindings(executor);
+          const auto sampled_id = texture_cache.FindImage(sampled);
+          (void)texture_cache.FindTexture(sampled_id, sampled);
+          Require(name, "texture view reuses target image",
+                  sampled_id == color.image_id,
+                  "a texture view of the fast-cleared target created another "
+                  "image");
+          Require(
+              name, "texture view sees metadata clear",
+              read_texel() == expected,
+              "a texture binding read drawn texels of a fast-cleared target");
+        }
+        bind();
+        // A texture view carrying the target's metadata, without the clear
+        // registers a T# lacks, still uses the target's registers. The target
+        // is unprogrammed during the fill so only the view can apply the clear.
+        paint();
+        registers.SetColorBase(0, {.addr = 0});
+        fill_metadata(metadata_words);
+        registers.SetColorBase(0, {.addr = base});
+        {
+          ImageDesc sampled = color.desc;
+          sampled.type = BindingType::Texture;
+          sampled.info.metadata.clear_register_valid = false;
+          sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled;
+          RenderExecutorTestAccess::ResetBindings(executor);
+          const auto sampled_id = texture_cache.FindImage(sampled);
+          (void)texture_cache.FindTexture(sampled_id, sampled);
+          Require(name, "metadata texture view sees target clear",
+                  sampled_id == color.image_id && read_texel() == expected,
+                  "a texture view with metadata lost the target's clear "
+                  "registers");
+        }
+        bind();
+        // A later binding of the target without color metadata forgets the
+        // old clear state, so a texture view keeps the drawn texels.
+        {
+          // Fresh clear keys, with the target unprogrammed so no draw or
+          // dispatch consumes them before the metadata-less rebind.
+          registers.SetColorBase(0, {.addr = 0});
+          fill_metadata(metadata_words);
+          registers.SetColorBase(0, {.addr = base});
+          ImageDesc plain = color.desc;
+          plain.info.metadata = {};
+          (void)texture_cache.FindImage(plain);
+          paint();
+          ImageDesc sampled = color.desc;
+          sampled.type = BindingType::Texture;
+          sampled.info.metadata = {};
+          sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled;
+          RenderExecutorTestAccess::ResetBindings(executor);
+          const auto sampled_id = texture_cache.FindImage(sampled);
+          (void)texture_cache.FindTexture(sampled_id, sampled);
+          Require(name, "metadata-less rebind forgets the clear",
+                  sampled_id == color.image_id && retains_painted_texel(),

@NeySlim Thanks for fixing this. Comparing every texel of the selected layer with the painted value addresses the incomplete check.


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-09 20:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#discussion_r4234422008) On `tests/ShaderRecompilerComputeTests.cpp` line 10922 (outdated): ```diff @@ -10846,6 +10856,84 @@ class VulkanHarness { Require(name, "complete fill after partial fill", read_texel() == expected, "completing the metadata overwrite did not restore its clear"); + // A texture view of the fast-cleared target sees the clear without a + // color bind. + paint(); + fill_metadata(metadata_words); + { + ImageDesc sampled = color.desc; + sampled.type = BindingType::Texture; + sampled.info.metadata = {}; + sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled; + RenderExecutorTestAccess::ResetBindings(executor); + const auto sampled_id = texture_cache.FindImage(sampled); + (void)texture_cache.FindTexture(sampled_id, sampled); + Require(name, "texture view reuses target image", + sampled_id == color.image_id, + "a texture view of the fast-cleared target created another " + "image"); + Require( + name, "texture view sees metadata clear", + read_texel() == expected, + "a texture binding read drawn texels of a fast-cleared target"); + } + bind(); + // A texture view carrying the target's metadata, without the clear + // registers a T# lacks, still uses the target's registers. The target + // is unprogrammed during the fill so only the view can apply the clear. + paint(); + registers.SetColorBase(0, {.addr = 0}); + fill_metadata(metadata_words); + registers.SetColorBase(0, {.addr = base}); + { + ImageDesc sampled = color.desc; + sampled.type = BindingType::Texture; + sampled.info.metadata.clear_register_valid = false; + sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled; + RenderExecutorTestAccess::ResetBindings(executor); + const auto sampled_id = texture_cache.FindImage(sampled); + (void)texture_cache.FindTexture(sampled_id, sampled); + Require(name, "metadata texture view sees target clear", + sampled_id == color.image_id && read_texel() == expected, + "a texture view with metadata lost the target's clear " + "registers"); + } + bind(); + // A later binding of the target without color metadata forgets the + // old clear state, so a texture view keeps the drawn texels. + { + // Fresh clear keys, with the target unprogrammed so no draw or + // dispatch consumes them before the metadata-less rebind. + registers.SetColorBase(0, {.addr = 0}); + fill_metadata(metadata_words); + registers.SetColorBase(0, {.addr = base}); + ImageDesc plain = color.desc; + plain.info.metadata = {}; + (void)texture_cache.FindImage(plain); + paint(); + ImageDesc sampled = color.desc; + sampled.type = BindingType::Texture; + sampled.info.metadata = {}; + sampled.view_info.usage = vk::ImageUsageFlagBits::eSampled; + RenderExecutorTestAccess::ResetBindings(executor); + const auto sampled_id = texture_cache.FindImage(sampled); + (void)texture_cache.FindTexture(sampled_id, sampled); + Require(name, "metadata-less rebind forgets the clear", + sampled_id == color.image_id && retains_painted_texel(), ``` `@NeySlim` Thanks for fixing this. Comparing every texel of the selected layer with the painted value addresses the incomplete check. --- <!-- 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=Check%20every%20texel%20after%20a%20metadata-less%20rebind%3A%20one%20surviving%20painted%20texel%20can%20hide%20a%20stale%20clear%20elsewhere.%20%40coderabbitai%20spots%20subtle%20test%20gaps%E2%80%94give%20it%20a%20try%20%F0%9F%90%87&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1200%23discussion_r4234046670)? 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

@⁠NeySlim on GitHub · 2026-10-14 07:04 UTC · original

Rebased on main and folded in what was left of #1188 (R16G16B16A16_UNORM and R32G32_UINT register clears); the rest of #1188 landed in 31b7be9f and 3c9da9c3. Also added checks for a clear seen through a cached texture binding and through a view in another format.

**@⁠NeySlim** on GitHub · 2026-10-14 07:04 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1200#issuecomment-6162858682) Rebased on main and folded in what was left of #1188 (R16G16B16A16_UNORM and R32G32_UINT register clears); the rest of #1188 landed in 31b7be9f and 3c9da9c3. Also added checks for a clear seen through a cached texture binding and through a view in another format.
This pull request has changes conflicting with the target branch.
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/image/imageInfo.h
  • src/graphics/host_gpu/renderer/renderCompute.cpp
  • tests/ShaderRecompilerComputeTests.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/1200/head:github-bot/gh-1200'
git switch 'github-bot/gh-1200'

Merge

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