graphics: clamp CopyImageWithBuffer uploads to the destination extent #1742

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

@⁠theantipopau on GitHub · 2026-10-20 00:47 UTC · original
theantipopau:fix/texture-buffer-copy-clamp → main · +43 −11 · 1 files · 3 commits · closed without merging

Companion to 440245f6 (which clamped the direct CopyImage path): the buffer-staged path reused the source extent for copyBufferToImage, so a larger source into a smaller destination writes out of bounds — the remaining Jusant #1636 validation error (60x33x26 into 54x33x26 B10G11R11). Clamps width/height per level and pins the source stride via bufferRowLength/bufferImageHeight; no behavior change when the destination covers the source.

**@⁠theantipopau** on GitHub · 2026-10-20 00:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742) `theantipopau:fix/texture-buffer-copy-clamp` → `main` · +43 −11 · 1 files · 3 commits · closed without merging Companion to 440245f6 (which clamped the direct CopyImage path): the buffer-staged path reused the source extent for copyBufferToImage, so a larger source into a smaller destination writes out of bounds — the remaining Jusant #1636 validation error (60x33x26 into 54x33x26 B10G11R11). Clamps width/height per level and pins the source stride via bufferRowLength/bufferImageHeight; no behavior change when the destination covers the source.
CopyImageWithBuffer reused the source extent for the buffer->image
upload, so copying a larger source into a smaller destination (Jusant's
60x33x26 image into a 54x33x26 one) writes out of bounds. Clamp the
copied width/height like CopyImage does and describe the full source
rows explicitly via bufferRowLength/bufferImageHeight. Identical
behavior when the destination covers the source.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
Download full source block rows and clamp only the destination upload,
so the source extent stays a multiple of the block size for compressed
formats. Round the upload stride fields up to block multiples; the
rounding is exact because the download packs tight block rows.

Addresses CodeRabbit Major findings on #1742.

Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
Clamping the upload to the destination extent is not enough for a
block-compressed destination: copyBufferToImage requires imageExtent to be a
whole number of blocks, or to reach the mip edge. A BC5 6x6 source copied into
a 16x16 image kept width 6 and still tripped VUID 00207.

Round the clamped extent up to the block size, capped by the destination mip
extent and height. The staging rows already use the same block-aligned pitch,
so the extra texels stay inside the downloaded data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:04:15 +00:00
github-bot closed this pull request 2026-11-26 10:04:16 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 00:51 UTC · original · edited 2026-10-22 03:29 UTC

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 447eeba2-703e-43d3-b733-be793fd9c2f7
📥 Commits

Reviewing files that changed from the base of the PR and between d42a484987 and 7be529ddb3.

📒 Files selected for processing: 1
  • src/graphics/host_gpu/renderer/image/image.cpp

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

📝 Walkthrough

Image::CopyImageWithBuffer clamps copied width and height to the destination mip dimensions. It limits the slice count to the source and destination depths. It derives block-row chunking from the clamped height, preserves full source-row downloads, and sets explicit buffer row and image strides for the upload.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 7be52

The copy changes appear ready to merge after normal checks. The requested 16-case Vulkan matrix rerun has not been reported.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description clearly explains the buffer-staged image-copy bug, the destination extent clamping, the stride handling, and the expected behavior.
Title check Passed The title is concise and accurately identifies the main change: clamping CopyImageWithBuffer uploads to the destination extent.
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.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

❤️ Share

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 00:51 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#issuecomment-6280717033) · edited 2026-10-22 03:29 UTC <!-- coderabbit-ai-generated:v1 --> <!-- 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/1742?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary><strong>ℹ️ Recent review info</strong></summary> <dl> <dd> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `447eeba2-703e-43d3-b733-be793fd9c2f7` </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between d42a484987afc1dc8a1ea42af2ffe24ef5382a98 and 7be529ddb3a13213e181d97a3916b3f23324203c. </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing: 1</strong></summary> <dl> <dd> * `src/graphics/host_gpu/renderer/image/image.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </dd> </dl> </details> <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> `Image::CopyImageWithBuffer` clamps copied width and height to the destination mip dimensions. It limits the slice count to the source and destination depths. It derives block-row chunking from the clamped height, preserves full source-row downloads, and sets explicit buffer row and image strides for the upload. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"7be529ddb3a13213e181d97a3916b3f23324203c" --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>⚪ Minimal</strong> · up to <code>7be52</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `7be52` --> <!-- final_review_risk_coverage:{"sourceCommitId":"7be529ddb3a13213e181d97a3916b3f23324203c","coveredCommitId":"7be529ddb3a13213e181d97a3916b3f23324203c","kind":"reviewed"} --> The copy changes appear ready to merge after normal checks. The requested 16-case Vulkan matrix rerun has not been reported. <!-- 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-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></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 warning</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. | 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 | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------- | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description clearly explains the buffer-staged image-copy bug, the destination extent clamping, the stride handling, and the expected behavior. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title is concise and accurately identifies the main change: clamping CopyImageWithBuffer uploads to the destination extent. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1742)! 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-20 00:51 UTC · original · edited 2026-10-20 07:30 UTC
On src/graphics/host_gpu/renderer/image/image.cpp line 525 (outdated):

@@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile
 	for (uint32_t level = 0; level < levels; level++) {
 		const auto width             = std::max(source.backing.extent.width >> level, 1u);
 		const auto height            = std::max(source.backing.extent.height >> level, 1u);
+		// The destination may be smaller than the source (e.g. Jusant's 60x33x26
+		// image copied into a 54x33x26 one). Clamp the copied region like CopyImage
+		// does, or copyBufferToImage writes out of bounds.
+		const auto copy_width  = std::min(width, std::max(backing.extent.width >> level, 1u));
+		const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u));
 		const auto source_depth      = source.backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(source.backing.extent.depth >> level, 1u)
 		                                   : source.backing.layers;
 		const auto destination_depth = backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(backing.extent.depth >> level, 1u)
 		                                   : backing.layers;
-		const auto slices            = std::min(source_depth, destination_depth);
-		const auto block_rows        = (height + source_block - 1) / source_block;
+		const auto slices            = std::min(source_depth, destination_depth);		const auto block_rows = (copy_height + source_block - 1) / source_block;
 		const auto row_size =
 		    static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes;
 		const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size());
 		EXIT_IF(slices == 0 || rows_per_copy == 0);
 		for (uint32_t slice = 0; slice < slices; slice++) {
 			for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) {
-				const auto          copy_rows   = std::min(rows_per_copy, block_rows - block_row);
-				const auto          y           = block_row * source_block;
-				const auto          copy_height = std::min(copy_rows * source_block, height - y);
-				const auto          copy_size   = row_size * copy_rows;
+				const auto copy_rows = std::min(rows_per_copy, block_rows - block_row);
+			const auto y             = block_row * source_block;
+			const auto chunk_height  = std::min(copy_rows * source_block, copy_height - y);

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Keep the source download extent valid after a height clamp.

If a block-compressed source is 8 rows high and the destination is 5 rows high, chunk_height becomes 5. The subsequent source_copy downloads 5 rows, but that extent ends inside the source and is not a multiple of the 4-row block height. Download complete source blocks into the staging buffer, then upload only the clamped destination height. (docs.vulkan.org)

✅ Addressed in commit d42a484

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 00:51 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#discussion_r4320378966) · edited 2026-10-20 07:30 UTC On `src/graphics/host_gpu/renderer/image/image.cpp` line 525 (outdated): ```diff @@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile for (uint32_t level = 0; level < levels; level++) { const auto width = std::max(source.backing.extent.width >> level, 1u); const auto height = std::max(source.backing.extent.height >> level, 1u); + // The destination may be smaller than the source (e.g. Jusant's 60x33x26 + // image copied into a 54x33x26 one). Clamp the copied region like CopyImage + // does, or copyBufferToImage writes out of bounds. + const auto copy_width = std::min(width, std::max(backing.extent.width >> level, 1u)); + const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u)); const auto source_depth = source.backing.image_type == vk::ImageType::e3D ? std::max(source.backing.extent.depth >> level, 1u) : source.backing.layers; const auto destination_depth = backing.image_type == vk::ImageType::e3D ? std::max(backing.extent.depth >> level, 1u) : backing.layers; - const auto slices = std::min(source_depth, destination_depth); - const auto block_rows = (height + source_block - 1) / source_block; + const auto slices = std::min(source_depth, destination_depth); const auto block_rows = (copy_height + source_block - 1) / source_block; const auto row_size = static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes; const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size()); EXIT_IF(slices == 0 || rows_per_copy == 0); for (uint32_t slice = 0; slice < slices; slice++) { for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) { - const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); - const auto y = block_row * source_block; - const auto copy_height = std::min(copy_rows * source_block, height - y); - const auto copy_size = row_size * copy_rows; + const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); + const auto y = block_row * source_block; + const auto chunk_height = std::min(copy_rows * source_block, copy_height - y); ``` **🩺 Stability & Availability** | **🟠 Major** | **⚡ Quick win** **Keep the source download extent valid after a height clamp.** If a block-compressed source is 8 rows high and the destination is 5 rows high, `chunk_height` becomes 5. The subsequent `source_copy` downloads 5 rows, but that extent ends inside the source and is not a multiple of the 4-row block height. Download complete source blocks into the staging buffer, then upload only the clamped destination height. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/copies.html)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:9c3a84070f2b92423d2c242f --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commit d42a484
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 00:51 UTC · original · edited 2026-10-20 07:30 UTC
On src/graphics/host_gpu/renderer/image/image.cpp line 540 (outdated):

@@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile
 	for (uint32_t level = 0; level < levels; level++) {
 		const auto width             = std::max(source.backing.extent.width >> level, 1u);
 		const auto height            = std::max(source.backing.extent.height >> level, 1u);
+		// The destination may be smaller than the source (e.g. Jusant's 60x33x26
+		// image copied into a 54x33x26 one). Clamp the copied region like CopyImage
+		// does, or copyBufferToImage writes out of bounds.
+		const auto copy_width  = std::min(width, std::max(backing.extent.width >> level, 1u));
+		const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u));
 		const auto source_depth      = source.backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(source.backing.extent.depth >> level, 1u)
 		                                   : source.backing.layers;
 		const auto destination_depth = backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(backing.extent.depth >> level, 1u)
 		                                   : backing.layers;
-		const auto slices            = std::min(source_depth, destination_depth);
-		const auto block_rows        = (height + source_block - 1) / source_block;
+		const auto slices            = std::min(source_depth, destination_depth);		const auto block_rows = (copy_height + source_block - 1) / source_block;
 		const auto row_size =
 		    static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes;
 		const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size());
 		EXIT_IF(slices == 0 || rows_per_copy == 0);
 		for (uint32_t slice = 0; slice < slices; slice++) {
 			for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) {
-				const auto          copy_rows   = std::min(rows_per_copy, block_rows - block_row);
-				const auto          y           = block_row * source_block;
-				const auto          copy_height = std::min(copy_rows * source_block, height - y);
-				const auto          copy_size   = row_size * copy_rows;
+				const auto copy_rows = std::min(rows_per_copy, block_rows - block_row);
+			const auto y             = block_row * source_block;
+			const auto chunk_height  = std::min(copy_rows * source_block, copy_height - y);
+			const auto copy_size     = row_size * copy_rows;
 				vk::BufferImageCopy source_copy {};
 				source_copy.imageSubresource = {
 				    source_aspect, level,
 				    source.backing.image_type == vk::ImageType::e3D ? 0u : slice, 1};
 				source_copy.imageOffset           = {0, static_cast<int32_t>(y),
-				                                     source.backing.image_type == vk::ImageType::e3D
-				                                         ? static_cast<int32_t>(slice)
-				                                         : 0};
-				source_copy.imageExtent           = {width, copy_height, 1};
+			                                     source.backing.image_type == vk::ImageType::e3D
+			                                         ? static_cast<int32_t>(slice)
+			                                         : 0};
+				source_copy.imageExtent           = {width, chunk_height, 1};
 				auto destination_copy             = source_copy;
+				// The staging buffer holds full source rows, so describe that stride
+				// explicitly once the uploaded extent is narrower than the download.
+				destination_copy.bufferRowLength   = width;
+				destination_copy.bufferImageHeight = chunk_height;

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '470,560p' src/graphics/host_gpu/renderer/image/image.cpp
git diff 742fe171736e4f0cd9fc454c45b8d962f995be62 2294b534be9476410229ae4791382fb091aa69f6 -- src/graphics/host_gpu/renderer/image/image.cpp

Repository: KytyPS5/KytyPS5

Length of output: 9918


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- IsBlock and block metadata ---'
rg -n -F --glob '*.{cpp,h,hpp}' -e 'IsBlock' -e 'bytes_per_block' -e 'block_width' -e 'block_height' src | head -160
printf '%s\n' '--- CopyImageWithBuffer declarations and callers ---'
rg -n -F --glob '*.{cpp,h,hpp}' -e 'CopyImageWithBuffer' src
printf '%s\n' '--- reviewed copy loop ---'
nl -ba src/graphics/host_gpu/renderer/image/image.cpp | sed -n '485,575p'
printf '%s\n' '--- base copy loop ---'
git show 742fe171736e4f0cd9fc454c45b8d962f995be62:src/graphics/host_gpu/renderer/image/image.cpp | nl -ba | sed -n '490,555p'
printf '%s\n' '--- format and extent definitions ---'
rg -n -F --glob '*.{cpp,h,hpp}' -e 'struct ImageInfo' -e 'class ImageInfo' -e 'ImageInfo::' -e 'FormatInfo' src | head -120

Repository: KytyPS5/KytyPS5

Length of output: 32832


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- ImageInfo complete relevant declarations ---'
nl -ba src/graphics/host_gpu/renderer/image/imageInfo.h | sed -n '60,145p'
nl -ba src/graphics/host_gpu/renderer/image/imageInfo.cpp | sed -n '65,105p'
printf '%s\n' '--- CopyImageWithBuffer caller and surrounding flow ---'
nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '540,615p'
printf '%s\n' '--- Image creation paths assigning extents and format metadata ---'
rg -n -F --glob '*.{cpp,h,hpp}' -e 'backing.extent' -e 'desc.info' -e 'info.extent' -e 'ImageInfo {' src/graphics/host_gpu/renderer | head -180

Repository: KytyPS5/KytyPS5

Length of output: 32405


Keep explicit buffer strides block-aligned.

width and chunk_height are texel dimensions, not block counts. For block-compressed images, they can be non-multiples of the 4×4 block dimensions because mip extents use direct bit shifts and are not aligned.

The source copy uses a tightly packed layout. Its row size is based on the rounded-up block count. Round the explicit destination strides to preserve that layout and satisfy Vulkan. Do not set them to zero because copy_width can be narrower than the source width.

🐛 Suggested fix
--- "a/src/graphics/host_gpu/renderer/image/image.cpp"
+++ "b/src/graphics/host_gpu/renderer/image/image.cpp"
@@ -536,8 +536,10 @@
 				auto destination_copy             = source_copy;
 				// The staging buffer holds full source rows, so describe that stride
 				// explicitly once the uploaded extent is narrower than the download.
-				destination_copy.bufferRowLength   = width;
-				destination_copy.bufferImageHeight = chunk_height;
+				destination_copy.bufferRowLength =
+				    ((width + source_block - 1) / source_block) * source_block;
+				destination_copy.bufferImageHeight =
+				    ((chunk_height + source_block - 1) / source_block) * source_block;
 				destination_copy.imageExtent       = {copy_width, chunk_height, 1};
 				destination_copy.imageSubresource = {
 				    destination_aspect, level,
📝 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.

				destination_copy.bufferRowLength =
				    ((width + source_block - 1) / source_block) * source_block;
				destination_copy.bufferImageHeight =
				    ((chunk_height + source_block - 1) / source_block) * source_block;

✅ Addressed in commit d42a484

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 00:51 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#discussion_r4320378973) · edited 2026-10-20 07:30 UTC On `src/graphics/host_gpu/renderer/image/image.cpp` line 540 (outdated): ```diff @@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile for (uint32_t level = 0; level < levels; level++) { const auto width = std::max(source.backing.extent.width >> level, 1u); const auto height = std::max(source.backing.extent.height >> level, 1u); + // The destination may be smaller than the source (e.g. Jusant's 60x33x26 + // image copied into a 54x33x26 one). Clamp the copied region like CopyImage + // does, or copyBufferToImage writes out of bounds. + const auto copy_width = std::min(width, std::max(backing.extent.width >> level, 1u)); + const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u)); const auto source_depth = source.backing.image_type == vk::ImageType::e3D ? std::max(source.backing.extent.depth >> level, 1u) : source.backing.layers; const auto destination_depth = backing.image_type == vk::ImageType::e3D ? std::max(backing.extent.depth >> level, 1u) : backing.layers; - const auto slices = std::min(source_depth, destination_depth); - const auto block_rows = (height + source_block - 1) / source_block; + const auto slices = std::min(source_depth, destination_depth); const auto block_rows = (copy_height + source_block - 1) / source_block; const auto row_size = static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes; const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size()); EXIT_IF(slices == 0 || rows_per_copy == 0); for (uint32_t slice = 0; slice < slices; slice++) { for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) { - const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); - const auto y = block_row * source_block; - const auto copy_height = std::min(copy_rows * source_block, height - y); - const auto copy_size = row_size * copy_rows; + const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); + const auto y = block_row * source_block; + const auto chunk_height = std::min(copy_rows * source_block, copy_height - y); + const auto copy_size = row_size * copy_rows; vk::BufferImageCopy source_copy {}; source_copy.imageSubresource = { source_aspect, level, source.backing.image_type == vk::ImageType::e3D ? 0u : slice, 1}; source_copy.imageOffset = {0, static_cast<int32_t>(y), - source.backing.image_type == vk::ImageType::e3D - ? static_cast<int32_t>(slice) - : 0}; - source_copy.imageExtent = {width, copy_height, 1}; + source.backing.image_type == vk::ImageType::e3D + ? static_cast<int32_t>(slice) + : 0}; + source_copy.imageExtent = {width, chunk_height, 1}; auto destination_copy = source_copy; + // The staging buffer holds full source rows, so describe that stride + // explicitly once the uploaded extent is narrower than the download. + destination_copy.bufferRowLength = width; + destination_copy.bufferImageHeight = chunk_height; ``` **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '470,560p' src/graphics/host_gpu/renderer/image/image.cpp git diff 742fe171736e4f0cd9fc454c45b8d962f995be62 2294b534be9476410229ae4791382fb091aa69f6 -- src/graphics/host_gpu/renderer/image/image.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 9918 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- IsBlock and block metadata ---' rg -n -F --glob '*.{cpp,h,hpp}' -e 'IsBlock' -e 'bytes_per_block' -e 'block_width' -e 'block_height' src | head -160 printf '%s\n' '--- CopyImageWithBuffer declarations and callers ---' rg -n -F --glob '*.{cpp,h,hpp}' -e 'CopyImageWithBuffer' src printf '%s\n' '--- reviewed copy loop ---' nl -ba src/graphics/host_gpu/renderer/image/image.cpp | sed -n '485,575p' printf '%s\n' '--- base copy loop ---' git show 742fe171736e4f0cd9fc454c45b8d962f995be62:src/graphics/host_gpu/renderer/image/image.cpp | nl -ba | sed -n '490,555p' printf '%s\n' '--- format and extent definitions ---' rg -n -F --glob '*.{cpp,h,hpp}' -e 'struct ImageInfo' -e 'class ImageInfo' -e 'ImageInfo::' -e 'FormatInfo' src | head -120 ``` Repository: KytyPS5/KytyPS5 Length of output: 32832 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- ImageInfo complete relevant declarations ---' nl -ba src/graphics/host_gpu/renderer/image/imageInfo.h | sed -n '60,145p' nl -ba src/graphics/host_gpu/renderer/image/imageInfo.cpp | sed -n '65,105p' printf '%s\n' '--- CopyImageWithBuffer caller and surrounding flow ---' nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '540,615p' printf '%s\n' '--- Image creation paths assigning extents and format metadata ---' rg -n -F --glob '*.{cpp,h,hpp}' -e 'backing.extent' -e 'desc.info' -e 'info.extent' -e 'ImageInfo {' src/graphics/host_gpu/renderer | head -180 ``` Repository: KytyPS5/KytyPS5 Length of output: 32405 --- </details> **Keep explicit buffer strides block-aligned.** `width` and `chunk_height` are texel dimensions, not block counts. For block-compressed images, they can be non-multiples of the 4×4 block dimensions because mip extents use direct bit shifts and are not aligned. The source copy uses a tightly packed layout. Its row size is based on the rounded-up block count. Round the explicit destination strides to preserve that layout and satisfy Vulkan. Do not set them to zero because `copy_width` can be narrower than the source width. <details> <summary>🐛 Suggested fix</summary> ```diff --- "a/src/graphics/host_gpu/renderer/image/image.cpp" +++ "b/src/graphics/host_gpu/renderer/image/image.cpp" @@ -536,8 +536,10 @@ auto destination_copy = source_copy; // The staging buffer holds full source rows, so describe that stride // explicitly once the uploaded extent is narrower than the download. - destination_copy.bufferRowLength = width; - destination_copy.bufferImageHeight = chunk_height; + destination_copy.bufferRowLength = + ((width + source_block - 1) / source_block) * source_block; + destination_copy.bufferImageHeight = + ((chunk_height + source_block - 1) / source_block) * source_block; destination_copy.imageExtent = {copy_width, chunk_height, 1}; destination_copy.imageSubresource = { destination_aspect, level, ``` </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 destination_copy.bufferRowLength = ((width + source_block - 1) / source_block) * source_block; destination_copy.bufferImageHeight = ((chunk_height + source_block - 1) / source_block) * source_block; ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:456176c999f04db1ee5e090f --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commit d42a484
Author
Owner

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 361b8199-1feb-4cda-a947-2f3316aa1b9c
📥 Commits

Reviewing files that changed from the base of the PR and between 742fe17173 and 2294b534be9476410229ae4791382fb091aa69f6.

📒 Files selected for processing: 1
  • src/graphics/host_gpu/renderer/image/image.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-20 00:52 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#pullrequestreview-5579517442) · **reviewed** **Actionable comments posted: 2** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `361b8199-1feb-4cda-a947-2f3316aa1b9c` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 742fe171736e4f0cd9fc454c45b8d962f995be62 and 2294b534be9476410229ae4791382fb091aa69f6. </details> <details> <summary>📒 Files selected for processing: 1</summary> * `src/graphics/host_gpu/renderer/image/image.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=08490c42-8ad7-48db-b6d9-4775c784b2fb attempt=1ba511c2-c406-422a-94de-a2b886de4890 batch=1/1 -->
Author
Owner

@⁠theantipopau on GitHub · 2026-10-20 07:30 UTC · original
On src/graphics/host_gpu/renderer/image/image.cpp line 525 (outdated):

@@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile
 	for (uint32_t level = 0; level < levels; level++) {
 		const auto width             = std::max(source.backing.extent.width >> level, 1u);
 		const auto height            = std::max(source.backing.extent.height >> level, 1u);
+		// The destination may be smaller than the source (e.g. Jusant's 60x33x26
+		// image copied into a 54x33x26 one). Clamp the copied region like CopyImage
+		// does, or copyBufferToImage writes out of bounds.
+		const auto copy_width  = std::min(width, std::max(backing.extent.width >> level, 1u));
+		const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u));
 		const auto source_depth      = source.backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(source.backing.extent.depth >> level, 1u)
 		                                   : source.backing.layers;
 		const auto destination_depth = backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(backing.extent.depth >> level, 1u)
 		                                   : backing.layers;
-		const auto slices            = std::min(source_depth, destination_depth);
-		const auto block_rows        = (height + source_block - 1) / source_block;
+		const auto slices            = std::min(source_depth, destination_depth);		const auto block_rows = (copy_height + source_block - 1) / source_block;
 		const auto row_size =
 		    static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes;
 		const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size());
 		EXIT_IF(slices == 0 || rows_per_copy == 0);
 		for (uint32_t slice = 0; slice < slices; slice++) {
 			for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) {
-				const auto          copy_rows   = std::min(rows_per_copy, block_rows - block_row);
-				const auto          y           = block_row * source_block;
-				const auto          copy_height = std::min(copy_rows * source_block, height - y);
-				const auto          copy_size   = row_size * copy_rows;
+				const auto copy_rows = std::min(rows_per_copy, block_rows - block_row);
+			const auto y             = block_row * source_block;
+			const auto chunk_height  = std::min(copy_rows * source_block, copy_height - y);

Good catch — fixed in d42a484. The loop now iterates over full source block rows (block_rows = ceil(copy_height / source_block)) so source_copy.imageExtent stays block-aligned for compressed formats, and only the upload is clamped via a new upload_height = min(chunk_height, copy_height - y) for destination_copy.imageExtent. Since block_rows covers ceil(copy_height/block), y < copy_height always holds in-loop, so every upload writes at least one row and neither height - y nor copy_height - y can underflow.

**@⁠theantipopau** on GitHub · 2026-10-20 07:30 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#discussion_r4322497251) On `src/graphics/host_gpu/renderer/image/image.cpp` line 525 (outdated): ```diff @@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile for (uint32_t level = 0; level < levels; level++) { const auto width = std::max(source.backing.extent.width >> level, 1u); const auto height = std::max(source.backing.extent.height >> level, 1u); + // The destination may be smaller than the source (e.g. Jusant's 60x33x26 + // image copied into a 54x33x26 one). Clamp the copied region like CopyImage + // does, or copyBufferToImage writes out of bounds. + const auto copy_width = std::min(width, std::max(backing.extent.width >> level, 1u)); + const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u)); const auto source_depth = source.backing.image_type == vk::ImageType::e3D ? std::max(source.backing.extent.depth >> level, 1u) : source.backing.layers; const auto destination_depth = backing.image_type == vk::ImageType::e3D ? std::max(backing.extent.depth >> level, 1u) : backing.layers; - const auto slices = std::min(source_depth, destination_depth); - const auto block_rows = (height + source_block - 1) / source_block; + const auto slices = std::min(source_depth, destination_depth); const auto block_rows = (copy_height + source_block - 1) / source_block; const auto row_size = static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes; const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size()); EXIT_IF(slices == 0 || rows_per_copy == 0); for (uint32_t slice = 0; slice < slices; slice++) { for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) { - const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); - const auto y = block_row * source_block; - const auto copy_height = std::min(copy_rows * source_block, height - y); - const auto copy_size = row_size * copy_rows; + const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); + const auto y = block_row * source_block; + const auto chunk_height = std::min(copy_rows * source_block, copy_height - y); ``` Good catch — fixed in d42a484. The loop now iterates over full source block rows (`block_rows = ceil(copy_height / source_block)`) so `source_copy.imageExtent` stays block-aligned for compressed formats, and only the upload is clamped via a new `upload_height = min(chunk_height, copy_height - y)` for `destination_copy.imageExtent`. Since `block_rows` covers `ceil(copy_height/block)`, `y < copy_height` always holds in-loop, so every upload writes at least one row and neither `height - y` nor `copy_height - y` can underflow.
Author
Owner

@⁠theantipopau on GitHub · 2026-10-20 07:30 UTC · original
On src/graphics/host_gpu/renderer/image/image.cpp line 540 (outdated):

@@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile
 	for (uint32_t level = 0; level < levels; level++) {
 		const auto width             = std::max(source.backing.extent.width >> level, 1u);
 		const auto height            = std::max(source.backing.extent.height >> level, 1u);
+		// The destination may be smaller than the source (e.g. Jusant's 60x33x26
+		// image copied into a 54x33x26 one). Clamp the copied region like CopyImage
+		// does, or copyBufferToImage writes out of bounds.
+		const auto copy_width  = std::min(width, std::max(backing.extent.width >> level, 1u));
+		const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u));
 		const auto source_depth      = source.backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(source.backing.extent.depth >> level, 1u)
 		                                   : source.backing.layers;
 		const auto destination_depth = backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(backing.extent.depth >> level, 1u)
 		                                   : backing.layers;
-		const auto slices            = std::min(source_depth, destination_depth);
-		const auto block_rows        = (height + source_block - 1) / source_block;
+		const auto slices            = std::min(source_depth, destination_depth);		const auto block_rows = (copy_height + source_block - 1) / source_block;
 		const auto row_size =
 		    static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes;
 		const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size());
 		EXIT_IF(slices == 0 || rows_per_copy == 0);
 		for (uint32_t slice = 0; slice < slices; slice++) {
 			for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) {
-				const auto          copy_rows   = std::min(rows_per_copy, block_rows - block_row);
-				const auto          y           = block_row * source_block;
-				const auto          copy_height = std::min(copy_rows * source_block, height - y);
-				const auto          copy_size   = row_size * copy_rows;
+				const auto copy_rows = std::min(rows_per_copy, block_rows - block_row);
+			const auto y             = block_row * source_block;
+			const auto chunk_height  = std::min(copy_rows * source_block, copy_height - y);
+			const auto copy_size     = row_size * copy_rows;
 				vk::BufferImageCopy source_copy {};
 				source_copy.imageSubresource = {
 				    source_aspect, level,
 				    source.backing.image_type == vk::ImageType::e3D ? 0u : slice, 1};
 				source_copy.imageOffset           = {0, static_cast<int32_t>(y),
-				                                     source.backing.image_type == vk::ImageType::e3D
-				                                         ? static_cast<int32_t>(slice)
-				                                         : 0};
-				source_copy.imageExtent           = {width, copy_height, 1};
+			                                     source.backing.image_type == vk::ImageType::e3D
+			                                         ? static_cast<int32_t>(slice)
+			                                         : 0};
+				source_copy.imageExtent           = {width, chunk_height, 1};
 				auto destination_copy             = source_copy;
+				// The staging buffer holds full source rows, so describe that stride
+				// explicitly once the uploaded extent is narrower than the download.
+				destination_copy.bufferRowLength   = width;
+				destination_copy.bufferImageHeight = chunk_height;

Applied as suggested in d42a484 (verified against the staging layout rather than blindly — the download packs tight block rows, so the rounding is exact). bufferRowLength/bufferImageHeight are now block-rounded from the full source width/chunk height, while the destination extent uses the clamped copy_width/upload_height. Mixed-compression cases stay guarded by the existing source_block == destination_block check.

**@⁠theantipopau** on GitHub · 2026-10-20 07:30 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#discussion_r4322498279) On `src/graphics/host_gpu/renderer/image/image.cpp` line 540 (outdated): ```diff @@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile for (uint32_t level = 0; level < levels; level++) { const auto width = std::max(source.backing.extent.width >> level, 1u); const auto height = std::max(source.backing.extent.height >> level, 1u); + // The destination may be smaller than the source (e.g. Jusant's 60x33x26 + // image copied into a 54x33x26 one). Clamp the copied region like CopyImage + // does, or copyBufferToImage writes out of bounds. + const auto copy_width = std::min(width, std::max(backing.extent.width >> level, 1u)); + const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u)); const auto source_depth = source.backing.image_type == vk::ImageType::e3D ? std::max(source.backing.extent.depth >> level, 1u) : source.backing.layers; const auto destination_depth = backing.image_type == vk::ImageType::e3D ? std::max(backing.extent.depth >> level, 1u) : backing.layers; - const auto slices = std::min(source_depth, destination_depth); - const auto block_rows = (height + source_block - 1) / source_block; + const auto slices = std::min(source_depth, destination_depth); const auto block_rows = (copy_height + source_block - 1) / source_block; const auto row_size = static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes; const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size()); EXIT_IF(slices == 0 || rows_per_copy == 0); for (uint32_t slice = 0; slice < slices; slice++) { for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) { - const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); - const auto y = block_row * source_block; - const auto copy_height = std::min(copy_rows * source_block, height - y); - const auto copy_size = row_size * copy_rows; + const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); + const auto y = block_row * source_block; + const auto chunk_height = std::min(copy_rows * source_block, copy_height - y); + const auto copy_size = row_size * copy_rows; vk::BufferImageCopy source_copy {}; source_copy.imageSubresource = { source_aspect, level, source.backing.image_type == vk::ImageType::e3D ? 0u : slice, 1}; source_copy.imageOffset = {0, static_cast<int32_t>(y), - source.backing.image_type == vk::ImageType::e3D - ? static_cast<int32_t>(slice) - : 0}; - source_copy.imageExtent = {width, copy_height, 1}; + source.backing.image_type == vk::ImageType::e3D + ? static_cast<int32_t>(slice) + : 0}; + source_copy.imageExtent = {width, chunk_height, 1}; auto destination_copy = source_copy; + // The staging buffer holds full source rows, so describe that stride + // explicitly once the uploaded extent is narrower than the download. + destination_copy.bufferRowLength = width; + destination_copy.bufferImageHeight = chunk_height; ``` Applied as suggested in d42a484 (verified against the staging layout rather than blindly — the download packs tight block rows, so the rounding is exact). bufferRowLength/bufferImageHeight are now block-rounded from the full source width/chunk height, while the destination extent uses the clamped copy_width/upload_height. Mixed-compression cases stay guarded by the existing source_block == destination_block check.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-20 07:30 UTC · original
On src/graphics/host_gpu/renderer/image/image.cpp line 525 (outdated):

@@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile
 	for (uint32_t level = 0; level < levels; level++) {
 		const auto width             = std::max(source.backing.extent.width >> level, 1u);
 		const auto height            = std::max(source.backing.extent.height >> level, 1u);
+		// The destination may be smaller than the source (e.g. Jusant's 60x33x26
+		// image copied into a 54x33x26 one). Clamp the copied region like CopyImage
+		// does, or copyBufferToImage writes out of bounds.
+		const auto copy_width  = std::min(width, std::max(backing.extent.width >> level, 1u));
+		const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u));
 		const auto source_depth      = source.backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(source.backing.extent.depth >> level, 1u)
 		                                   : source.backing.layers;
 		const auto destination_depth = backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(backing.extent.depth >> level, 1u)
 		                                   : backing.layers;
-		const auto slices            = std::min(source_depth, destination_depth);
-		const auto block_rows        = (height + source_block - 1) / source_block;
+		const auto slices            = std::min(source_depth, destination_depth);		const auto block_rows = (copy_height + source_block - 1) / source_block;
 		const auto row_size =
 		    static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes;
 		const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size());
 		EXIT_IF(slices == 0 || rows_per_copy == 0);
 		for (uint32_t slice = 0; slice < slices; slice++) {
 			for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) {
-				const auto          copy_rows   = std::min(rows_per_copy, block_rows - block_row);
-				const auto          y           = block_row * source_block;
-				const auto          copy_height = std::min(copy_rows * source_block, height - y);
-				const auto          copy_size   = row_size * copy_rows;
+				const auto copy_rows = std::min(rows_per_copy, block_rows - block_row);
+			const auto y             = block_row * source_block;
+			const auto chunk_height  = std::min(copy_rows * source_block, copy_height - y);

@⁠theantipopau Thanks for the fix. The supplied code keeps source downloads block-aligned or ending at the source edge, then clamps only the upload. The loop bounds also prevent both subtractions from underflowing. This addresses the 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-20 07:30 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#discussion_r4322499808) On `src/graphics/host_gpu/renderer/image/image.cpp` line 525 (outdated): ```diff @@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile for (uint32_t level = 0; level < levels; level++) { const auto width = std::max(source.backing.extent.width >> level, 1u); const auto height = std::max(source.backing.extent.height >> level, 1u); + // The destination may be smaller than the source (e.g. Jusant's 60x33x26 + // image copied into a 54x33x26 one). Clamp the copied region like CopyImage + // does, or copyBufferToImage writes out of bounds. + const auto copy_width = std::min(width, std::max(backing.extent.width >> level, 1u)); + const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u)); const auto source_depth = source.backing.image_type == vk::ImageType::e3D ? std::max(source.backing.extent.depth >> level, 1u) : source.backing.layers; const auto destination_depth = backing.image_type == vk::ImageType::e3D ? std::max(backing.extent.depth >> level, 1u) : backing.layers; - const auto slices = std::min(source_depth, destination_depth); - const auto block_rows = (height + source_block - 1) / source_block; + const auto slices = std::min(source_depth, destination_depth); const auto block_rows = (copy_height + source_block - 1) / source_block; const auto row_size = static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes; const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size()); EXIT_IF(slices == 0 || rows_per_copy == 0); for (uint32_t slice = 0; slice < slices; slice++) { for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) { - const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); - const auto y = block_row * source_block; - const auto copy_height = std::min(copy_rows * source_block, height - y); - const auto copy_size = row_size * copy_rows; + const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); + const auto y = block_row * source_block; + const auto chunk_height = std::min(copy_rows * source_block, copy_height - y); ``` @⁠theantipopau Thanks for the fix. The supplied code keeps source downloads block-aligned or ending at the source edge, then clamps only the upload. The loop bounds also prevent both subtractions from underflowing. This addresses the 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=%40coderabbitai%20catches%20Vulkan%20pitfalls%3A%20keep%20compressed-source%20downloads%20block-aligned%20after%20height%20clamping%2C%20while%20clamping%20only%20destination%20uploads.%20Safer%20graphics%20code%E2%80%94try%20it!%20%F0%9F%9B%A1%EF%B8%8F&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1742%23discussion_r4320378966)? 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-20 07:30 UTC · original
On src/graphics/host_gpu/renderer/image/image.cpp line 540 (outdated):

@@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile
 	for (uint32_t level = 0; level < levels; level++) {
 		const auto width             = std::max(source.backing.extent.width >> level, 1u);
 		const auto height            = std::max(source.backing.extent.height >> level, 1u);
+		// The destination may be smaller than the source (e.g. Jusant's 60x33x26
+		// image copied into a 54x33x26 one). Clamp the copied region like CopyImage
+		// does, or copyBufferToImage writes out of bounds.
+		const auto copy_width  = std::min(width, std::max(backing.extent.width >> level, 1u));
+		const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u));
 		const auto source_depth      = source.backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(source.backing.extent.depth >> level, 1u)
 		                                   : source.backing.layers;
 		const auto destination_depth = backing.image_type == vk::ImageType::e3D
 		                                   ? std::max(backing.extent.depth >> level, 1u)
 		                                   : backing.layers;
-		const auto slices            = std::min(source_depth, destination_depth);
-		const auto block_rows        = (height + source_block - 1) / source_block;
+		const auto slices            = std::min(source_depth, destination_depth);		const auto block_rows = (copy_height + source_block - 1) / source_block;
 		const auto row_size =
 		    static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes;
 		const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size());
 		EXIT_IF(slices == 0 || rows_per_copy == 0);
 		for (uint32_t slice = 0; slice < slices; slice++) {
 			for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) {
-				const auto          copy_rows   = std::min(rows_per_copy, block_rows - block_row);
-				const auto          y           = block_row * source_block;
-				const auto          copy_height = std::min(copy_rows * source_block, height - y);
-				const auto          copy_size   = row_size * copy_rows;
+				const auto copy_rows = std::min(rows_per_copy, block_rows - block_row);
+			const auto y             = block_row * source_block;
+			const auto chunk_height  = std::min(copy_rows * source_block, copy_height - y);
+			const auto copy_size     = row_size * copy_rows;
 				vk::BufferImageCopy source_copy {};
 				source_copy.imageSubresource = {
 				    source_aspect, level,
 				    source.backing.image_type == vk::ImageType::e3D ? 0u : slice, 1};
 				source_copy.imageOffset           = {0, static_cast<int32_t>(y),
-				                                     source.backing.image_type == vk::ImageType::e3D
-				                                         ? static_cast<int32_t>(slice)
-				                                         : 0};
-				source_copy.imageExtent           = {width, copy_height, 1};
+			                                     source.backing.image_type == vk::ImageType::e3D
+			                                         ? static_cast<int32_t>(slice)
+			                                         : 0};
+				source_copy.imageExtent           = {width, chunk_height, 1};
 				auto destination_copy             = source_copy;
+				// The staging buffer holds full source rows, so describe that stride
+				// explicitly once the uploaded extent is narrower than the download.
+				destination_copy.bufferRowLength   = width;
+				destination_copy.bufferImageHeight = chunk_height;

@⁠theantipopau Thanks for checking the staging layout. The block-rounded strides match the tightly packed source block rows. The clamped copy_width and upload_height limit the destination upload. This addresses the stride-alignment finding.


✏️ Learnings added
Learnt from: theantipopau
Repo: KytyPS5/KytyPS5 PR: 1742
File: src/graphics/host_gpu/renderer/image/image.cpp:0-0
Timestamp: 2026-10-20T07:30:36.857Z
Learning: In src/graphics/host_gpu/renderer/image/image.cpp, Image::CopyImageWithBuffer downloads tightly packed source block rows. Explicit upload buffer strides must describe that source layout, independently of the clamped destination extent. The existing source_block != destination_block guard rejects mixed-compression copies.

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-20 07:30 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#discussion_r4322502161) On `src/graphics/host_gpu/renderer/image/image.cpp` line 540 (outdated): ```diff @@ -502,34 +502,43 @@ void Image::CopyImageWithBuffer(Image& source, Buffer& buffer, TileManager& tile for (uint32_t level = 0; level < levels; level++) { const auto width = std::max(source.backing.extent.width >> level, 1u); const auto height = std::max(source.backing.extent.height >> level, 1u); + // The destination may be smaller than the source (e.g. Jusant's 60x33x26 + // image copied into a 54x33x26 one). Clamp the copied region like CopyImage + // does, or copyBufferToImage writes out of bounds. + const auto copy_width = std::min(width, std::max(backing.extent.width >> level, 1u)); + const auto copy_height = std::min(height, std::max(backing.extent.height >> level, 1u)); const auto source_depth = source.backing.image_type == vk::ImageType::e3D ? std::max(source.backing.extent.depth >> level, 1u) : source.backing.layers; const auto destination_depth = backing.image_type == vk::ImageType::e3D ? std::max(backing.extent.depth >> level, 1u) : backing.layers; - const auto slices = std::min(source_depth, destination_depth); - const auto block_rows = (height + source_block - 1) / source_block; + const auto slices = std::min(source_depth, destination_depth); const auto block_rows = (copy_height + source_block - 1) / source_block; const auto row_size = static_cast<uint64_t>((width + source_block - 1) / source_block) * source_bytes; const auto rows_per_copy = CopyRows(row_size, block_rows, buffer.Size()); EXIT_IF(slices == 0 || rows_per_copy == 0); for (uint32_t slice = 0; slice < slices; slice++) { for (uint32_t block_row = 0; block_row < block_rows; block_row += rows_per_copy) { - const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); - const auto y = block_row * source_block; - const auto copy_height = std::min(copy_rows * source_block, height - y); - const auto copy_size = row_size * copy_rows; + const auto copy_rows = std::min(rows_per_copy, block_rows - block_row); + const auto y = block_row * source_block; + const auto chunk_height = std::min(copy_rows * source_block, copy_height - y); + const auto copy_size = row_size * copy_rows; vk::BufferImageCopy source_copy {}; source_copy.imageSubresource = { source_aspect, level, source.backing.image_type == vk::ImageType::e3D ? 0u : slice, 1}; source_copy.imageOffset = {0, static_cast<int32_t>(y), - source.backing.image_type == vk::ImageType::e3D - ? static_cast<int32_t>(slice) - : 0}; - source_copy.imageExtent = {width, copy_height, 1}; + source.backing.image_type == vk::ImageType::e3D + ? static_cast<int32_t>(slice) + : 0}; + source_copy.imageExtent = {width, chunk_height, 1}; auto destination_copy = source_copy; + // The staging buffer holds full source rows, so describe that stride + // explicitly once the uploaded extent is narrower than the download. + destination_copy.bufferRowLength = width; + destination_copy.bufferImageHeight = chunk_height; ``` @⁠theantipopau Thanks for checking the staging layout. The block-rounded strides match the tightly packed source block rows. The clamped `copy_width` and `upload_height` limit the destination upload. This addresses the stride-alignment finding. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: theantipopau Repo: KytyPS5/KytyPS5 PR: 1742 File: src/graphics/host_gpu/renderer/image/image.cpp:0-0 Timestamp: 2026-10-20T07:30:36.857Z Learning: In src/graphics/host_gpu/renderer/image/image.cpp, Image::CopyImageWithBuffer downloads tightly packed source block rows. Explicit upload buffer strides must describe that source layout, independently of the clamped destination extent. The existing source_block != destination_block guard rejects mixed-compression copies. ``` > 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=%40coderabbitai%20caught%20a%20Vulkan%20image-copy%20bug%3A%20block-compressed%20strides%20weren%E2%80%99t%20block-aligned%20when%20extents%20were%20clamped.%20Rounded%20strides%20now%20preserve%20staging%20layout%20and%20correctness.%20Try%20it!%20%F0%9F%9A%80&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1742%23discussion_r4320378973)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠theantipopau on GitHub · 2026-10-20 08:32 UTC · original

Follow-up fixed both Major review findings in d42a484:

  • Source download stays block-aligned: loop now iterates block_rows = ceil(copy_height / source_block) so source_copy.imageExtent uses full source width/chunk height (valid for compressed formats); only the upload is clamped via new upload_height = min(chunk_height, copy_height - y).
  • Strides block-rounded: bufferRowLength/bufferImageHeight rounded up to block multiples from the full source extent — exact because the staging download packs tight block rows. Destination extent uses clamped copy_width/upload_height.

Loop bounds guarantee y < copy_height in-loop, so every upload is non-empty and neither subtraction underflows. Mixed-compression stays guarded by the existing source_block == destination_block check. CI is green and both threads are resolved.

**@⁠theantipopau** on GitHub · 2026-10-20 08:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#issuecomment-6286863728) Follow-up fixed both Major review findings in d42a484: - **Source download stays block-aligned**: loop now iterates `block_rows = ceil(copy_height / source_block)` so `source_copy.imageExtent` uses full source width/chunk height (valid for compressed formats); only the upload is clamped via new `upload_height = min(chunk_height, copy_height - y)`. - **Strides block-rounded**: `bufferRowLength`/`bufferImageHeight` rounded up to block multiples from the full source extent — exact because the staging download packs tight block rows. Destination extent uses clamped `copy_width`/`upload_height`. Loop bounds guarantee `y < copy_height` in-loop, so every upload is non-empty and neither subtraction underflows. Mixed-compression stays guarded by the existing `source_block == destination_block` check. CI is green and both threads are resolved.
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-20 14:16 UTC · original

Sharing measured data in case it helps: I have a small lab copy harness (local, not in upstream) that runs 16 image-copy cases through both the direct path and the buffer path under the Vulkan validation layer, on an RX 9070 XT and a Ryzen 7600X iGPU.

On main e5f0ee7f with this PR's diff applied (run 2026-10-20): buffer cases 0, 1, 4, 5 and 7 go from validation errors on main (07971/00207) to clean, and the texel readbacks are equal (16/16, identical on both GPUs). Case 0 is Jusant's 3D B10G11R11 copy (60x33x26 -> 54x33x26).

Buffer case 6 (BC5 6x6 -> 16x16) still reports VUID-vkCmdCopyBufferToImage-dstImage-00207: the clamp keeps width 6, which is neither a multiple of the 4x4 block nor the destination edge (16).

The direct CopyImage cases that fail on main (5, 7, 9, 11, 13) are unchanged with this diff (expected, it does not touch CopyImage). Those five and buffer case 6 pass with #1176; I posted that matrix on #1176 earlier.

Happy to post the per-case list here if useful.

**@⁠Nawid3333** on GitHub · 2026-10-20 14:16 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#issuecomment-6292981099) Sharing measured data in case it helps: I have a small lab copy harness (local, not in upstream) that runs 16 image-copy cases through both the direct path and the buffer path under the Vulkan validation layer, on an RX 9070 XT and a Ryzen 7600X iGPU. On main e5f0ee7f with this PR's diff applied (run 2026-10-20): buffer cases 0, 1, 4, 5 and 7 go from validation errors on main (07971/00207) to clean, and the texel readbacks are equal (16/16, identical on both GPUs). Case 0 is Jusant's 3D B10G11R11 copy (60x33x26 -> 54x33x26). Buffer case 6 (BC5 6x6 -> 16x16) still reports VUID-vkCmdCopyBufferToImage-dstImage-00207: the clamp keeps width 6, which is neither a multiple of the 4x4 block nor the destination edge (16). The direct CopyImage cases that fail on main (5, 7, 9, 11, 13) are unchanged with this diff (expected, it does not touch CopyImage). Those five and buffer case 6 pass with #1176; I posted that matrix on #1176 earlier. Happy to post the per-case list here if useful.
Author
Owner

@⁠theantipopau on GitHub · 2026-10-22 03:26 UTC · original

@⁠Nawid3333 that per-case data is exactly what this needed — thank you. Case 6 is fixed in 7be529dd: clamping to the destination extent was the wrong shape for a block-compressed destination, because VUID-vkCmdCopyBufferToImage-dstImage-00207 wants imageExtent to be whole blocks (or to reach the mip edge), not just in bounds. A BC5 6x6 source into a 16x16 image kept width 6, which is neither.

The upload extent is now rounded up to the source block size and capped by the destination mip extent and remaining height:

  • BC5 6x6 → 16x16: upload becomes 8x8 (two whole 4x4 blocks in each direction), bufferRowLength 8 texels / 32 bytes, which is exactly the pitch the download already wrote, so no read past the staged data.
  • Compressed mips smaller than one block keep the clamped extent, where imageOffset + imageExtent == imageExtent of the mip is the accepted alternative.
  • Uncompressed paths are unchanged (block size 1).

The source download is untouched, so its extents still end at the source mip edge.

If you can rerun your 16-case matrix against 7be529dd, the thing to look at is buffer case 6 clearing 00207 and its texel readback still matching. The five direct CopyImage cases are outside this PR as you noted — #1176 is where those belong.

**@⁠theantipopau** on GitHub · 2026-10-22 03:26 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#issuecomment-6331923781) @⁠Nawid3333 that per-case data is exactly what this needed — thank you. Case 6 is fixed in 7be529dd: clamping to the destination extent was the wrong shape for a block-compressed destination, because VUID-vkCmdCopyBufferToImage-dstImage-00207 wants `imageExtent` to be whole blocks (or to reach the mip edge), not just in bounds. A BC5 6x6 source into a 16x16 image kept width 6, which is neither. The upload extent is now rounded up to the source block size and capped by the destination mip extent and remaining height: - BC5 6x6 → 16x16: upload becomes 8x8 (two whole 4x4 blocks in each direction), `bufferRowLength` 8 texels / 32 bytes, which is exactly the pitch the download already wrote, so no read past the staged data. - Compressed mips smaller than one block keep the clamped extent, where `imageOffset + imageExtent == imageExtent` of the mip is the accepted alternative. - Uncompressed paths are unchanged (block size 1). The source download is untouched, so its extents still end at the source mip edge. If you can rerun your 16-case matrix against 7be529dd, the thing to look at is buffer case 6 clearing 00207 and its texel readback still matching. The five direct `CopyImage` cases are outside this PR as you noted — #1176 is where those belong.
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-22 21:12 UTC · original

@⁠theantipopau I reran the matrix on 7be529dd (on main e5f0ee7f like the previous run, Windows 11, RX 9070 XT and the Ryzen 7600X iGPU, validation layer on, one copy per process):

  • Buffer case 6 (BC5 6x6 -> 16x16): dstImage-00207 is gone on both GPUs, and the data is right. I added a block check to the matrix for this: the 4 copied blocks match the source blocks exactly, and the 12 destination blocks outside the copied region stay untouched.
  • The other buffer cases are unchanged from your previous head: 0-5, 7 and 13-15 are clean (4, 5 and 7 also pass the block check), and 8-12 still stop at the by-design exit for different block sizes. 44 of 64 runs are clean now, 42 before; the difference is case 6 on both GPUs.
  • The direct CopyImage cases are unchanged, as expected.
**@⁠Nawid3333** on GitHub · 2026-10-22 21:12 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#issuecomment-6351419248) @⁠theantipopau I reran the matrix on 7be529dd (on main e5f0ee7f like the previous run, Windows 11, RX 9070 XT and the Ryzen 7600X iGPU, validation layer on, one copy per process): - Buffer case 6 (BC5 6x6 -> 16x16): `dstImage-00207` is gone on both GPUs, and the data is right. I added a block check to the matrix for this: the 4 copied blocks match the source blocks exactly, and the 12 destination blocks outside the copied region stay untouched. - The other buffer cases are unchanged from your previous head: 0-5, 7 and 13-15 are clean (4, 5 and 7 also pass the block check), and 8-12 still stop at the by-design exit for different block sizes. 44 of 64 runs are clean now, 42 before; the difference is case 6 on both GPUs. - The direct `CopyImage` cases are unchanged, as expected.
Author
Owner

@⁠Nawid3333 on GitHub · 2026-11-08 15:52 UTC · original

Game evidence: Abiotic Factor (#2163). With Vulkan validation on, the game stopped when the camera turned, on vkCmdCopyBufferToImage VUID 07971 (extent.width (128) exceeds imageSubresource width extent (64), a 128-wide source copied into a 64x128 R16_UNORM image). Ekt0re played a build of main 27f290e95 + this PR at 7be529dd (plus the MSVC build fix that is now f47da249b in main) past the same spot, and the stop is gone: #2163

**@⁠Nawid3333** on GitHub · 2026-11-08 15:52 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1742#issuecomment-6723616223) Game evidence: Abiotic Factor (#2163). With Vulkan validation on, the game stopped when the camera turned, on `vkCmdCopyBufferToImage` VUID 07971 (`extent.width (128) exceeds imageSubresource width extent (64)`, a 128-wide source copied into a 64x128 R16_UNORM image). Ekt0re played a build of main 27f290e95 + this PR at 7be529dd (plus the MSVC build fix that is now f47da249b in main) past the same spot, and the stop is gone: https://git.gtahub.st/github/KytyPS5--KytyPS5/issues/2163

Pull request closed

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