feat(agc): sample depth plane arrays from a later base slice #1186

Merged
MichonGoddijn231849 merged 3 commits from upstream-pr/1186 into main 2026-10-14 17:04:53 +00:00
MichonGoddijn231849 commented 2026-10-07 16:45:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T16:45:33Z.


What

A T# that reads a depth surface's planes as a 2D array whose BASE_ARRAY is past slice 0 views the plane copy from that slice, instead of being refused (the copy holds slices 0 to LAST_ARRAY). A 2D binding of such a plane array reads its base slice through a one-slice view.

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB, MinGW-w64 GCC 15.2.0.

  • GTA V PPSA04264 (01.005) runs with this change on the combined gta-v/testing branch (Performance mode, the prologue).
  • On main 0214069e3 (2026-10-13): agc_driver_depth_plane_sampling passes with its base-slice cases (a D32 2D array from base slice 1 through an array and a 2D image, and a D16 plane read as R16_UINT from base slice 1), which replace main's refusal case. The whole agc_* suite passes on Windows (483 tests).
  • Resident Evil Village (PPSA01556) gets past its first-scene stop with this change (EagleBearerYS), and Diablo II: Resurrected (PPSA03912) reaches its main menu with the same change (mrfelek).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (#425 is merged)
  • AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4775689340 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-07T16:45:33Z. --- ### What A T# that reads a depth surface's planes as a 2D array whose BASE_ARRAY is past slice 0 views the plane copy from that slice, instead of being refused (the copy holds slices 0 to LAST_ARRAY). A 2D binding of such a plane array reads its base slice through a one-slice view. ### Tested Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB, MinGW-w64 GCC 15.2.0. - GTA V PPSA04264 (01.005) runs with this change on the combined [`gta-v/testing`](https://github.com/MichonGoddijn231849/AnyPS5-fork/tree/gta-v/testing) branch (Performance mode, the prologue). - On `main` 0214069e3 (2026-10-13): `agc_driver_depth_plane_sampling` passes with its base-slice cases (a D32 2D array from base slice 1 through an array and a 2D image, and a D16 plane read as `R16_UINT` from base slice 1), which replace `main`'s refusal case. The whole `agc_*` suite passes on Windows (483 tests). - Resident Evil Village (PPSA01556) gets past its first-scene stop with this change (EagleBearerYS), and Diablo II: Resurrected (PPSA03912) reaches its main menu with the same change (mrfelek). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#425 is merged) - [x] AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fisherjoey commented 2026-10-08 21:43:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T21:43:33Z.


A case for this from Demon's Souls (PPSA01341 v1.07) on Linux (Nobara 44, RTX 5070 Ti, 595.91.07). Since #1086 and #1346 merged, the title's shadow pass renders, and after NEW GAME a compute shader reads the 1024x1024 D32 shadow map as a one-slice 2D array. On main 4b005b22 (plus #861, which this title needs to start on Linux) that aborts:

compute shader 0x2488ab600: AGC graphics: sampling the depth plane of depth surface 0x2a4700000 (1024x1024, vk format 126)
as a 1024x1024 texture of guest format 22 (vk 100), tile mode 4, dimension 2, levels 0-0, slice 0 is not implemented
(T# 02a47000 c1600000 00ffc0ff d1800924 0000004f 00700000 ...)

Dimension 2 is k2DArray, base slice 0, same extent and format as the plane. With this PR merged on the same base (clean merge), the abort is gone. The title goes from the main menu through NEW GAME to character creation and exits 0 when the window is closed. One run per arm.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6069625909 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6069625909). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-08T21:43:33Z. --- A case for this from Demon's Souls (PPSA01341 v1.07) on Linux (Nobara 44, RTX 5070 Ti, 595.91.07). Since #1086 and #1346 merged, the title's shadow pass renders, and after NEW GAME a compute shader reads the 1024x1024 D32 shadow map as a one-slice 2D array. On `main` 4b005b22 (plus #861, which this title needs to start on Linux) that aborts: ``` compute shader 0x2488ab600: AGC graphics: sampling the depth plane of depth surface 0x2a4700000 (1024x1024, vk format 126) as a 1024x1024 texture of guest format 22 (vk 100), tile mode 4, dimension 2, levels 0-0, slice 0 is not implemented (T# 02a47000 c1600000 00ffc0ff d1800924 0000004f 00700000 ...) ``` Dimension 2 is `k2DArray`, base slice 0, same extent and format as the plane. With this PR merged on the same base (clean merge), the abort is gone. The title goes from the main menu through NEW GAME to character creation and exits 0 when the window is closed. One run per arm.
MichonGoddijn231849 commented 2026-10-09 08:33:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T08:33:36Z.


@fisherjoey thanks, a shadow-map read from a later base slice after NEW GAME is exactly the case this is for.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077400300 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6077400300). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-09T08:33:36Z. --- @fisherjoey thanks, a shadow-map read from a later base slice after NEW GAME is exactly the case this is for.
adriadam10 commented 2026-10-11 10:40:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:40:55Z.

Review: DISMISSED


Thanks, the diagnosis in the thread (a one-slice D32 shadow map read as a 2D array from a later base slice) matches the change. This PR is stacked on #419/#425/#454, so I reviewed only the last commit (fd0ddc6a6). One thing blocks it:

  • No test covers the new path. The commit touches DepthSurface.cpp/Texture.cpp but adds nothing under libSceAgcDriver/tests. Please add a case that samples a depth plane array with BASE_ARRAY > 0 (array view and the 2D one-slice view), pinning the slice values read, and that fails without the change. Also pin the cases that must keep throwing (BASE_ARRAY > DEPTH, cube with BASE_ARRAY != 0, non-array with BASE_ARRAY != 0).
  • Add a line under "Unknown function info" in docs/dev/TechnicalDebt.md saying the base-slice semantics of depth plane arrays come from the title's usage and were not measured on hardware. Do not put it at the end of the section.

It also conflicts with main (DepthFastClearHarness.hpp, DepthFastClearSubmit.cpp, TechnicalDebt.md); that should resolve once the bases land and this is rebased.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5482988066 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#pullrequestreview-5482988066). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T10:40:55Z. **Review:** DISMISSED --- Thanks, the diagnosis in the thread (a one-slice D32 shadow map read as a 2D array from a later base slice) matches the change. This PR is stacked on #419/#425/#454, so I reviewed only the last commit (`fd0ddc6a6`). One thing blocks it: - No test covers the new path. The commit touches `DepthSurface.cpp`/`Texture.cpp` but adds nothing under `libSceAgcDriver/tests`. Please add a case that samples a depth plane array with `BASE_ARRAY > 0` (array view and the 2D one-slice view), pinning the slice values read, and that fails without the change. Also pin the cases that must keep throwing (`BASE_ARRAY > DEPTH`, cube with `BASE_ARRAY != 0`, non-array with `BASE_ARRAY != 0`). - Add a line under "Unknown function info" in `docs/dev/TechnicalDebt.md` saying the base-slice semantics of depth plane arrays come from the title's usage and were not measured on hardware. Do not put it at the end of the section. It also conflicts with `main` (`DepthFastClearHarness.hpp`, `DepthFastClearSubmit.cpp`, `TechnicalDebt.md`); that should resolve once the bases land and this is rebased.
MichonGoddijn231849 commented 2026-10-11 12:14:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T12:14:59Z.


@adriadam10 thanks. I'll add the test (array view and one-slice 2D view of a depth plane array with BASE_ARRAY > 0, pinning the slices read and failing without the change, plus the three cases that keep throwing) and the TechnicalDebt line under "Unknown function info", then rebase once #419 and #425 are on main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108911870 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6108911870). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-11T12:14:59Z. --- @adriadam10 thanks. I'll add the test (array view and one-slice 2D view of a depth plane array with `BASE_ARRAY > 0`, pinning the slices read and failing without the change, plus the three cases that keep throwing) and the TechnicalDebt line under "Unknown function info", then rebase once #419 and #425 are on `main`.
MichonGoddijn231849 commented 2026-10-11 15:28:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T15:28:47Z.


@adriadam10 the test and the TechnicalDebt line are in (fd140d1ab). The branch is now stacked on the rebased #425 (6d59983d3), so it no longer conflicts with main. The last two commits are this PR.

  • Test: depthPlaneArrayBaseSliceTests in tests/Recorder.cpp, registered as the agc_depth_plane_array_base_slice ctest. It uses a three-slice 128x128 D32 surface: slice 0 is a live depth surface, and slices 1 and 2 hold 0.5 and 0.75 in guest memory. A 2D-array T# with BASE_ARRAY 1 and then 2 reads each slice's value at every array layer, and its one-slice 2D view reads the base slice.
  • Negative checks:
    • With the change reverted, the case throws "base slice 1 is not implemented".
    • With the view's base layer forced to 0, it reads 1.0 (slice 0's clear value) instead of 0.5.
  • Cases that keep throwing: BASE_ARRAY past LAST_ARRAY, a cube with BASE_ARRAY 1, and a 2D T# with BASE_ARRAY 1.
  • TechnicalDebt: "Depth plane arrays from a later base slice" under "Unknown function info", placed after the HTILE array-slice entry rather than at the end of the section. It says the semantics follow colour 2D arrays and the title's usage, and were not measured on hardware.
  • Test size: the surface is 128x128 because at 64x64 the tiled layout pads the linear pitch, and the plane copy refuses that geometry (it throws).

Once #425 merges, I'll rebase this so only these two commits remain.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110600371 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6110600371). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-11T15:28:47Z. --- @adriadam10 the test and the TechnicalDebt line are in (`fd140d1ab`). The branch is now stacked on the rebased #425 (`6d59983d3`), so it no longer conflicts with `main`. The last two commits are this PR. - **Test:** `depthPlaneArrayBaseSliceTests` in `tests/Recorder.cpp`, registered as the `agc_depth_plane_array_base_slice` ctest. It uses a three-slice 128x128 D32 surface: slice 0 is a live depth surface, and slices 1 and 2 hold 0.5 and 0.75 in guest memory. A 2D-array T# with `BASE_ARRAY` 1 and then 2 reads each slice's value at every array layer, and its one-slice 2D view reads the base slice. - **Negative checks:** - With the change reverted, the case throws "base slice 1 is not implemented". - With the view's base layer forced to 0, it reads 1.0 (slice 0's clear value) instead of 0.5. - **Cases that keep throwing:** `BASE_ARRAY` past `LAST_ARRAY`, a cube with `BASE_ARRAY` 1, and a 2D T# with `BASE_ARRAY` 1. - **TechnicalDebt:** "Depth plane arrays from a later base slice" under "Unknown function info", placed after the HTILE array-slice entry rather than at the end of the section. It says the semantics follow colour 2D arrays and the title's usage, and were not measured on hardware. - **Test size:** the surface is 128x128 because at 64x64 the tiled layout pads the linear pitch, and the plane copy refuses that geometry (it throws). Once #425 merges, I'll rebase this so only these two commits remain.
oneandonlydean commented 2026-10-13 08:05:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T08:05:07Z.


#419 and #425 are on main now, so this conflicts through the carried commits. Please rebase down to the last two (d02585cba, fd140d1ab).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141138184 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6141138184). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T08:05:07Z. --- #419 and #425 are on main now, so this conflicts through the carried commits. Please rebase down to the last two (`d02585cba`, `fd140d1ab`).
EagleBearerYS commented 2026-10-13 13:41:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-13T13:41:03Z.


Resident Evil Village (PPSA01556, 01.210.000) stops on this while loading its first scene, on a local branch past its earlier stops (on main it stops at its first frame, #4949):

[videoout] presentation failed: compute shader 0x203f1ea700: AGC graphics: sampling the depth planes of depth surface 0x2056800000 (1024x1024, vk format 126) as a 1024x1024 texture of guest format 22 (vk 100), dimension 2, 2 slices, levels 0-0, base slice 1 is not implemented

A compute pass reads slice 1 of a two-slice 1024x1024 D32 array as an R32F 2D-array texture with BASE_ARRAY 1 and LAST_ARRAY 1. d02585cba gets the title past it. I applied it by hand to the current DepthPlaneCopy, which has changed since.

On a rebase, note that main's DepthPlaneSampling test now has a RefusalCase that asserts this refusal. I replaced it with a base-slice case: a view from base slice 1 reads slices 1 and 2, and a 2D image reads slice 1. The adapted change is below, in case it saves you time. Setup: Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 3070 Laptop.

d02585cba adapted to current main
diff --git a/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp b/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
index 6dafa8345..bc1d57ff4 100644
--- a/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
@@ -61,7 +61,7 @@ public:
     // compute pass writing it and the next pass sampling it share one image and copy nothing.
     // CanCopyFrom says whether the two descriptors address the same surface compatibly.
     Texture(const Context& context, const std::shared_ptr<StorageTexture>& source, const GuestTextureResource& descriptor, VkComponentMapping components);
-    Texture(const Context& context, VkImage depthImage, VkFormat depthFormat, VkImageAspectFlags aspect, VkComponentMapping components, VkImageViewType viewType = VK_IMAGE_VIEW_TYPE_2D);
+    Texture(const Context& context, VkImage depthImage, VkFormat depthFormat, VkImageAspectFlags aspect, VkComponentMapping components, VkImageViewType viewType = VK_IMAGE_VIEW_TYPE_2D, std::uint32_t baseLayer = 0);
     struct DepthCopyTag {};
     Texture(const Context& context, const std::shared_ptr<StorageTexture>& source, const GuestTextureResource& descriptor, VkComponentMapping components, DepthCopyTag);
     static VkFormat DepthCopyFormat(VkFormat colorFormat);
diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
index d8968b069..c982cf1db 100644
--- a/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
@@ -296,7 +296,7 @@ public:
     DepthPlaneCopy(const DepthPlaneCopy&) = delete;
     DepthPlaneCopy& operator=(const DepthPlaneCopy&) = delete;
 
-    std::shared_ptr<Texture> Refresh(std::span<const DepthPlaneSlice> slices, const GuestTextureResource& resource, VkComponentMapping components, VkImageViewType viewType) {
+    std::shared_ptr<Texture> Refresh(std::span<const DepthPlaneSlice> slices, const GuestTextureResource& resource, VkComponentMapping components, VkImageViewType viewType, std::uint32_t baseLayer) {
         Require(slices.size() == layers, "depth plane copy slices do not match its layers");
         const auto geometry = DescribeSurface(resource);
         Require(geometry.layers == layers && geometry.sliceLinearBytes == sliceBytes() && !geometry.mips.empty(), "depth plane copy geometry does not match its layers");
@@ -326,10 +326,10 @@ public:
             held = current;
         }
         if (!copiedLayers.empty() || !uploads.empty()) record(slices, resource, geometry, copiedLayers, uploads, uploadLayers);
-        const std::array<std::uint32_t, 5> key{static_cast<std::uint32_t>(components.r), static_cast<std::uint32_t>(components.g), static_cast<std::uint32_t>(components.b), static_cast<std::uint32_t>(components.a), static_cast<std::uint32_t>(viewType)};
+        const std::array<std::uint32_t, 6> key{static_cast<std::uint32_t>(components.r), static_cast<std::uint32_t>(components.g), static_cast<std::uint32_t>(components.b), static_cast<std::uint32_t>(components.a), static_cast<std::uint32_t>(viewType), baseLayer};
         auto& texture = textures[key];
         if (texture == nullptr) {
-            texture = std::make_shared<Texture>(context, image, format, aspect(), components, viewType);
+            texture = std::make_shared<Texture>(context, image, format, aspect(), components, viewType, baseLayer);
             texture->MarkRefreshedPerUse();
         }
         return texture;
@@ -352,7 +352,7 @@ private:
     VkImage image = VK_NULL_HANDLE;
     VkDeviceMemory memory = VK_NULL_HANDLE;
     std::unique_ptr<DeviceBuffer> staging;
-    std::map<std::array<std::uint32_t, 5>, std::shared_ptr<Texture>> textures;
+    std::map<std::array<std::uint32_t, 6>, std::shared_ptr<Texture>> textures;
     std::vector<GuestLayer> guestLayers;
     std::vector<DepthPlaneSlice> surfaceLayers;
     bool filled = false;
@@ -607,7 +607,7 @@ std::shared_ptr<Texture> DepthSurfaceTexture(const Context& context, std::span<c
     Require((*found)->hostFormat == base.format, "sampling several slices or an integer view of a depth plane that the device stores in another depth format is not implemented");
     const auto copyFormat = integer ? VK_FORMAT_R16_UINT : d16 ? VK_FORMAT_R16_UNORM : VK_FORMAT_R32_SFLOAT;
     const auto layers = cube ? 6u : layered ? resource.depthOrLastArray + 1u : 1u;
-    if ((format != copyFormat && !depthBits) || resource.width != base.extent.width || resource.height != base.extent.height || resource.baseLevel != 0 || resource.lastLevel != 0 || resource.baseArray != 0 || (cube && resource.depthOrLastArray != 0 && resource.depthOrLastArray != 5) || (resource.dimension != TextureDimension::k2D && resource.dimension != TextureDimension::k2DArray && !cube)) {
+    if ((format != copyFormat && !depthBits) || resource.width != base.extent.width || resource.height != base.extent.height || resource.baseLevel != 0 || resource.lastLevel != 0 || (resource.baseArray != 0 && (cube || !layered || resource.baseArray > resource.depthOrLastArray)) || (cube && resource.depthOrLastArray != 0 && resource.depthOrLastArray != 5) || (resource.dimension != TextureDimension::k2D && resource.dimension != TextureDimension::k2DArray && !cube)) {
         char text[320];
         std::snprintf(text, sizeof(text), "AGC graphics: sampling the depth planes of depth surface 0x%llx (%ux%u, vk format %d) as a %ux%u texture of guest format %u (vk %d), dimension %d, %u slices, levels %u-%u, base slice %u is not implemented", static_cast<unsigned long long>(base.address), base.extent.width, base.extent.height, static_cast<int>(base.format), resource.width, resource.height, resource.format, static_cast<int>(format), static_cast<int>(resource.dimension), layers, resource.baseLevel, resource.lastLevel, resource.baseArray);
         throw std::runtime_error(text);
@@ -625,7 +625,7 @@ std::shared_ptr<Texture> DepthSurfaceTexture(const Context& context, std::span<c
     if (copy == nullptr) {
         copy = std::make_unique<DepthPlaneCopy>(context, base.extent, imageFormat, layers);
     }
-    return copy->Refresh(slices, resource, components, cube || resource.dimension == TextureDimension::k2DArray ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D);
+    return copy->Refresh(slices, resource, components, cube || resource.dimension == TextureDimension::k2DArray ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D, layered && !cube ? resource.baseArray : 0u);
 }
 
 bool DepthSurfaceHolds(const Context& context, const GuestTextureResource& resource, const Texture* texture) {
diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
index 1f904ebf3..7fffb7925 100644
--- a/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
@@ -660,7 +660,7 @@ Texture::Texture(const Context& context, const std::shared_ptr<StorageTexture>&
     }
 }
 
-Texture::Texture(const Context& context, VkImage depthImage, VkFormat depthFormat, VkImageAspectFlags aspect, VkComponentMapping components, VkImageViewType viewType) : context(context) {
+Texture::Texture(const Context& context, VkImage depthImage, VkFormat depthFormat, VkImageAspectFlags aspect, VkComponentMapping components, VkImageViewType viewType, std::uint32_t baseLayer) : context(context) {
     layout = VK_IMAGE_LAYOUT_GENERAL;
     VkImageViewCreateInfo viewInfo{VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO};
     viewInfo.image = depthImage;
@@ -668,7 +668,7 @@ Texture::Texture(const Context& context, VkImage depthImage, VkFormat depthForma
     viewInfo.format = depthFormat;
     viewFormat = depthFormat;
     viewInfo.components = components;
-    viewInfo.subresourceRange = {aspect, 0, 1, 0, viewType == VK_IMAGE_VIEW_TYPE_2D ? 1u : VK_REMAINING_ARRAY_LAYERS};
+    viewInfo.subresourceRange = {aspect, 0, 1, baseLayer, viewType == VK_IMAGE_VIEW_TYPE_2D ? 1u : VK_REMAINING_ARRAY_LAYERS};
     Check(context.Function<PFN_vkCreateImageView>("vkCreateImageView")(context.device, &viewInfo, nullptr, &view), "vkCreateImageView depth plane");
     viewRange = {viewInfo.viewType, viewInfo.subresourceRange.levelCount, viewInfo.subresourceRange.layerCount};
     if (viewType != VK_IMAGE_VIEW_TYPE_2D_ARRAY) return;
diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp
index 2cdf03f88..2e12ab73d 100644
--- a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp
+++ b/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp
@@ -316,18 +316,16 @@ void FirstSliceCase(AgcDriver::VulkanDevice& device, GuestBlock& block, std::spa
     Expect(output, Bits(DrawnDepth), "3-slice D32 2D array through a 2D shader image");
 }
 
-// A plane array from a later base slice is still refused (its slice offsets are not modeled here).
-void RefusalCase(AgcDriver::VulkanDevice& device, GuestBlock& block, std::span<std::uint32_t> output) {
-    bool refused = false;
-    try {
-        Shape shape{Format32Float, 128, 128, Type2DArray, 2, Swizzle64KbZX};
-        shape.baseArray = 1;
-        Load(device, block.At(ArrayOffset), shape, 0, output);
-    } catch (const std::runtime_error& error) {
-        refused = std::string(error.what()).find("sampling the depth planes of depth surface") != std::string::npos;
-        if (!refused) throw;
-    }
-    Require(refused, "a depth plane array from base slice 1 was not refused");
+void BaseSliceCase(AgcDriver::VulkanDevice& device, GuestBlock& block, std::span<std::uint32_t> output) {
+    auto* base = block.At(ArrayOffset);
+    Shape shape{Format32Float, 128, 128, Type2DArray, 2, Swizzle64KbZX};
+    shape.baseArray = 1;
+    Load(device, base, shape, 0, output);
+    Expect(output, Bits(0.5f), "D32 2D array from base slice 1, slice 0");
+    Load(device, base, shape, 1, output);
+    Expect(output, Bits(0.75f), "D32 2D array from base slice 1, slice 1");
+    Load(device, base, shape, 0, output, true);
+    Expect(output, Bits(0.5f), "D32 2D array from base slice 1 through a 2D shader image");
 }
 
 }
@@ -343,7 +341,7 @@ int main() {
         IntegerCase(*device, block, output);
         DepthBitsArrayCase(*device, block, output);
         FirstSliceCase(*device, block, output);
-        RefusalCase(*device, block, output);
+        BaseSliceCase(*device, block, output);
         std::puts("depth plane sampling tests passed");
         return 0;
     } catch (const std::exception& error) {
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6146894375 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6146894375). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-13T13:41:03Z. --- Resident Evil Village (PPSA01556, 01.210.000) stops on this while loading its first scene, on a local branch past its earlier stops (on `main` it stops at its first frame, #4949): ``` [videoout] presentation failed: compute shader 0x203f1ea700: AGC graphics: sampling the depth planes of depth surface 0x2056800000 (1024x1024, vk format 126) as a 1024x1024 texture of guest format 22 (vk 100), dimension 2, 2 slices, levels 0-0, base slice 1 is not implemented ``` A compute pass reads slice 1 of a two-slice 1024x1024 D32 array as an R32F 2D-array texture with BASE_ARRAY 1 and LAST_ARRAY 1. d02585cba gets the title past it. I applied it by hand to the current `DepthPlaneCopy`, which has changed since. On a rebase, note that `main`'s `DepthPlaneSampling` test now has a `RefusalCase` that asserts this refusal. I replaced it with a base-slice case: a view from base slice 1 reads slices 1 and 2, and a 2D image reads slice 1. The adapted change is below, in case it saves you time. Setup: Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 3070 Laptop. <details><summary>d02585cba adapted to current main</summary> ```diff diff --git a/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp b/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp index 6dafa8345..bc1d57ff4 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp @@ -61,7 +61,7 @@ public: // compute pass writing it and the next pass sampling it share one image and copy nothing. // CanCopyFrom says whether the two descriptors address the same surface compatibly. Texture(const Context& context, const std::shared_ptr<StorageTexture>& source, const GuestTextureResource& descriptor, VkComponentMapping components); - Texture(const Context& context, VkImage depthImage, VkFormat depthFormat, VkImageAspectFlags aspect, VkComponentMapping components, VkImageViewType viewType = VK_IMAGE_VIEW_TYPE_2D); + Texture(const Context& context, VkImage depthImage, VkFormat depthFormat, VkImageAspectFlags aspect, VkComponentMapping components, VkImageViewType viewType = VK_IMAGE_VIEW_TYPE_2D, std::uint32_t baseLayer = 0); struct DepthCopyTag {}; Texture(const Context& context, const std::shared_ptr<StorageTexture>& source, const GuestTextureResource& descriptor, VkComponentMapping components, DepthCopyTag); static VkFormat DepthCopyFormat(VkFormat colorFormat); diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp index d8968b069..c982cf1db 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp @@ -296,7 +296,7 @@ public: DepthPlaneCopy(const DepthPlaneCopy&) = delete; DepthPlaneCopy& operator=(const DepthPlaneCopy&) = delete; - std::shared_ptr<Texture> Refresh(std::span<const DepthPlaneSlice> slices, const GuestTextureResource& resource, VkComponentMapping components, VkImageViewType viewType) { + std::shared_ptr<Texture> Refresh(std::span<const DepthPlaneSlice> slices, const GuestTextureResource& resource, VkComponentMapping components, VkImageViewType viewType, std::uint32_t baseLayer) { Require(slices.size() == layers, "depth plane copy slices do not match its layers"); const auto geometry = DescribeSurface(resource); Require(geometry.layers == layers && geometry.sliceLinearBytes == sliceBytes() && !geometry.mips.empty(), "depth plane copy geometry does not match its layers"); @@ -326,10 +326,10 @@ public: held = current; } if (!copiedLayers.empty() || !uploads.empty()) record(slices, resource, geometry, copiedLayers, uploads, uploadLayers); - const std::array<std::uint32_t, 5> key{static_cast<std::uint32_t>(components.r), static_cast<std::uint32_t>(components.g), static_cast<std::uint32_t>(components.b), static_cast<std::uint32_t>(components.a), static_cast<std::uint32_t>(viewType)}; + const std::array<std::uint32_t, 6> key{static_cast<std::uint32_t>(components.r), static_cast<std::uint32_t>(components.g), static_cast<std::uint32_t>(components.b), static_cast<std::uint32_t>(components.a), static_cast<std::uint32_t>(viewType), baseLayer}; auto& texture = textures[key]; if (texture == nullptr) { - texture = std::make_shared<Texture>(context, image, format, aspect(), components, viewType); + texture = std::make_shared<Texture>(context, image, format, aspect(), components, viewType, baseLayer); texture->MarkRefreshedPerUse(); } return texture; @@ -352,7 +352,7 @@ private: VkImage image = VK_NULL_HANDLE; VkDeviceMemory memory = VK_NULL_HANDLE; std::unique_ptr<DeviceBuffer> staging; - std::map<std::array<std::uint32_t, 5>, std::shared_ptr<Texture>> textures; + std::map<std::array<std::uint32_t, 6>, std::shared_ptr<Texture>> textures; std::vector<GuestLayer> guestLayers; std::vector<DepthPlaneSlice> surfaceLayers; bool filled = false; @@ -607,7 +607,7 @@ std::shared_ptr<Texture> DepthSurfaceTexture(const Context& context, std::span<c Require((*found)->hostFormat == base.format, "sampling several slices or an integer view of a depth plane that the device stores in another depth format is not implemented"); const auto copyFormat = integer ? VK_FORMAT_R16_UINT : d16 ? VK_FORMAT_R16_UNORM : VK_FORMAT_R32_SFLOAT; const auto layers = cube ? 6u : layered ? resource.depthOrLastArray + 1u : 1u; - if ((format != copyFormat && !depthBits) || resource.width != base.extent.width || resource.height != base.extent.height || resource.baseLevel != 0 || resource.lastLevel != 0 || resource.baseArray != 0 || (cube && resource.depthOrLastArray != 0 && resource.depthOrLastArray != 5) || (resource.dimension != TextureDimension::k2D && resource.dimension != TextureDimension::k2DArray && !cube)) { + if ((format != copyFormat && !depthBits) || resource.width != base.extent.width || resource.height != base.extent.height || resource.baseLevel != 0 || resource.lastLevel != 0 || (resource.baseArray != 0 && (cube || !layered || resource.baseArray > resource.depthOrLastArray)) || (cube && resource.depthOrLastArray != 0 && resource.depthOrLastArray != 5) || (resource.dimension != TextureDimension::k2D && resource.dimension != TextureDimension::k2DArray && !cube)) { char text[320]; std::snprintf(text, sizeof(text), "AGC graphics: sampling the depth planes of depth surface 0x%llx (%ux%u, vk format %d) as a %ux%u texture of guest format %u (vk %d), dimension %d, %u slices, levels %u-%u, base slice %u is not implemented", static_cast<unsigned long long>(base.address), base.extent.width, base.extent.height, static_cast<int>(base.format), resource.width, resource.height, resource.format, static_cast<int>(format), static_cast<int>(resource.dimension), layers, resource.baseLevel, resource.lastLevel, resource.baseArray); throw std::runtime_error(text); @@ -625,7 +625,7 @@ std::shared_ptr<Texture> DepthSurfaceTexture(const Context& context, std::span<c if (copy == nullptr) { copy = std::make_unique<DepthPlaneCopy>(context, base.extent, imageFormat, layers); } - return copy->Refresh(slices, resource, components, cube || resource.dimension == TextureDimension::k2DArray ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D); + return copy->Refresh(slices, resource, components, cube || resource.dimension == TextureDimension::k2DArray ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D, layered && !cube ? resource.baseArray : 0u); } bool DepthSurfaceHolds(const Context& context, const GuestTextureResource& resource, const Texture* texture) { diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp index 1f904ebf3..7fffb7925 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp @@ -660,7 +660,7 @@ Texture::Texture(const Context& context, const std::shared_ptr<StorageTexture>& } } -Texture::Texture(const Context& context, VkImage depthImage, VkFormat depthFormat, VkImageAspectFlags aspect, VkComponentMapping components, VkImageViewType viewType) : context(context) { +Texture::Texture(const Context& context, VkImage depthImage, VkFormat depthFormat, VkImageAspectFlags aspect, VkComponentMapping components, VkImageViewType viewType, std::uint32_t baseLayer) : context(context) { layout = VK_IMAGE_LAYOUT_GENERAL; VkImageViewCreateInfo viewInfo{VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO}; viewInfo.image = depthImage; @@ -668,7 +668,7 @@ Texture::Texture(const Context& context, VkImage depthImage, VkFormat depthForma viewInfo.format = depthFormat; viewFormat = depthFormat; viewInfo.components = components; - viewInfo.subresourceRange = {aspect, 0, 1, 0, viewType == VK_IMAGE_VIEW_TYPE_2D ? 1u : VK_REMAINING_ARRAY_LAYERS}; + viewInfo.subresourceRange = {aspect, 0, 1, baseLayer, viewType == VK_IMAGE_VIEW_TYPE_2D ? 1u : VK_REMAINING_ARRAY_LAYERS}; Check(context.Function<PFN_vkCreateImageView>("vkCreateImageView")(context.device, &viewInfo, nullptr, &view), "vkCreateImageView depth plane"); viewRange = {viewInfo.viewType, viewInfo.subresourceRange.levelCount, viewInfo.subresourceRange.layerCount}; if (viewType != VK_IMAGE_VIEW_TYPE_2D_ARRAY) return; diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp index 2cdf03f88..2e12ab73d 100644 --- a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp @@ -316,18 +316,16 @@ void FirstSliceCase(AgcDriver::VulkanDevice& device, GuestBlock& block, std::spa Expect(output, Bits(DrawnDepth), "3-slice D32 2D array through a 2D shader image"); } -// A plane array from a later base slice is still refused (its slice offsets are not modeled here). -void RefusalCase(AgcDriver::VulkanDevice& device, GuestBlock& block, std::span<std::uint32_t> output) { - bool refused = false; - try { - Shape shape{Format32Float, 128, 128, Type2DArray, 2, Swizzle64KbZX}; - shape.baseArray = 1; - Load(device, block.At(ArrayOffset), shape, 0, output); - } catch (const std::runtime_error& error) { - refused = std::string(error.what()).find("sampling the depth planes of depth surface") != std::string::npos; - if (!refused) throw; - } - Require(refused, "a depth plane array from base slice 1 was not refused"); +void BaseSliceCase(AgcDriver::VulkanDevice& device, GuestBlock& block, std::span<std::uint32_t> output) { + auto* base = block.At(ArrayOffset); + Shape shape{Format32Float, 128, 128, Type2DArray, 2, Swizzle64KbZX}; + shape.baseArray = 1; + Load(device, base, shape, 0, output); + Expect(output, Bits(0.5f), "D32 2D array from base slice 1, slice 0"); + Load(device, base, shape, 1, output); + Expect(output, Bits(0.75f), "D32 2D array from base slice 1, slice 1"); + Load(device, base, shape, 0, output, true); + Expect(output, Bits(0.5f), "D32 2D array from base slice 1 through a 2D shader image"); } } @@ -343,7 +341,7 @@ int main() { IntegerCase(*device, block, output); DepthBitsArrayCase(*device, block, output); FirstSliceCase(*device, block, output); - RefusalCase(*device, block, output); + BaseSliceCase(*device, block, output); std::puts("depth plane sampling tests passed"); return 0; } catch (const std::exception& error) { ``` </details>
mrfelek commented 2026-10-13 14:35:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-13T14:35:48Z.


Data point from another title that needs this. Diablo II: Resurrected (PPSA03912, 01.039.000), Linux, RTX 3080 Ti (NVIDIA 615.71.09), main 0f2683cb7, aborts at the main menu with:

sampling the depth planes of depth surface 0x25f630000 (512x512, vk format 124) as a 512x512 texture of guest format 11 (vk 74), dimension 2, 2 slices, levels 0-0, base slice 1 is not implemented

It is a D16 surface read through an R16_UINT 2D array T# with BASE_ARRAY=1 and LAST_ARRAY=1, so it takes the integer-view path of the plane copy with a base slice above 0. If #1186 covers that path too, it would unblock this title.

I wrote the same change independently before finding this PR (a view over the copy of slices 0..LAST starting at BASE_ARRAY) and it gets the title past this point; the tests I wrote for it (BASE_ARRAY 1 and 2 on a 3-slice D32 array, read through image_load of the view's slices, failing without the change) are on https://github.com/mrfelek/AnyPS5/tree/pr/depth-plane-base-slice if they help with the review request for a test. Written with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6148012184 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6148012184). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-13T14:35:48Z. --- Data point from another title that needs this. Diablo II: Resurrected (PPSA03912, 01.039.000), Linux, RTX 3080 Ti (NVIDIA 615.71.09), main 0f2683cb7, aborts at the main menu with: sampling the depth planes of depth surface 0x25f630000 (512x512, vk format 124) as a 512x512 texture of guest format 11 (vk 74), dimension 2, 2 slices, levels 0-0, base slice 1 is not implemented It is a D16 surface read through an R16_UINT 2D array T# with BASE_ARRAY=1 and LAST_ARRAY=1, so it takes the integer-view path of the plane copy with a base slice above 0. If #1186 covers that path too, it would unblock this title. I wrote the same change independently before finding this PR (a view over the copy of slices 0..LAST starting at BASE_ARRAY) and it gets the title past this point; the tests I wrote for it (BASE_ARRAY 1 and 2 on a 3-slice D32 array, read through `image_load` of the view's slices, failing without the change) are on https://github.com/mrfelek/AnyPS5/tree/pr/depth-plane-base-slice if they help with the review request for a test. Written with AI assistance (Claude Code).
MichonGoddijn231849 commented 2026-10-13 16:10:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-13T16:10:48Z.


@oneandonlydean rebased down to the change and its test on current main (0214069e3), now that #419 and #425 are in.

@EagleBearerYS your adaptation to the current DepthPlaneCopy is what the change is now (co-author), and so is your BaseSliceCase in place of main's refusal case. @mrfelek I added your Diablo II shape as a case too, a D16 plane read as R16_UINT from base slice 1 (co-author on the test). It takes the same path, so this should cover that title as well. agc_driver_depth_plane_sampling and the rest of the agc_* suite pass on Windows. The debt entry in docs/dev/debt/libSceAgcDriver.md says what still throws.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6149898201 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6149898201). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-13T16:10:48Z. --- @oneandonlydean rebased down to the change and its test on current `main` (0214069e3), now that #419 and #425 are in. @EagleBearerYS your adaptation to the current `DepthPlaneCopy` is what the change is now (co-author), and so is your `BaseSliceCase` in place of `main`'s refusal case. @mrfelek I added your Diablo II shape as a case too, a D16 plane read as `R16_UINT` from base slice 1 (co-author on the test). It takes the same path, so this should cover that title as well. `agc_driver_depth_plane_sampling` and the rest of the `agc_*` suite pass on Windows. The debt entry in `docs/dev/debt/libSceAgcDriver.md` says what still throws.
oneandonlydean commented 2026-10-13 19:35:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T19:35:17Z.


Thanks, the base-slice cases and the debt line are what was needed. One part of the 10-11 review is still open: please pin the depth-plane views that must keep throwing (BASE_ARRAY past LAST_ARRAY, a cube with BASE_ARRAY != 0, a 2D view with BASE_ARRAY != 0) in DepthPlaneSampling.cpp.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153602046 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6153602046). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T19:35:17Z. --- Thanks, the base-slice cases and the debt line are what was needed. One part of the 10-11 review is still open: please pin the depth-plane views that must keep throwing (`BASE_ARRAY` past `LAST_ARRAY`, a cube with `BASE_ARRAY != 0`, a 2D view with `BASE_ARRAY != 0`) in `DepthPlaneSampling.cpp`.
mrfelek commented 2026-10-13 21:08:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-13T21:08:02Z.


@MichonGoddijn231849 @oneandonlydean for the open point in the 10-11 review (pin the depth-plane views that must keep throwing in DepthPlaneSampling.cpp), I wrote the cases on top of this PR's head (db77358c6): https://github.com/mrfelek/AnyPS5/tree/pr/depth-plane-refusals (one commit, bda61af82, +29 lines in DepthPlaneSampling.cpp only). Take it with git cherry-pick bda61af82 if it is useful.

A new RefusalCase builds the resource from a T# with DecodeTextureResource, sets the base slice and calls DepthSurfaceTexture directly (so it pins this code's own checks and not the descriptor parser's, which already rejects some of these shapes earlier), and expects the refusal message:

  • a 2D array with its base slice past its last slice (base 3, last 2);
  • a cube from base slice 1;
  • a 2D view with base slice 1.

Checked on Linux (RTX 3080 Ti, GCC 15.3.0): agc_driver_depth_plane_sampling_tests passes with it, check_conventions passes, and removing each production check in turn (the baseArray > depthOrLastArray term, the cube || term of the base-slice condition, and the baseArray != 0 term of the one-slice refusal in Sampled) makes the matching case fail with "was not refused".

AI-assisted; I reviewed the change and ran the tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155225281 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6155225281). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-13T21:08:02Z. --- @MichonGoddijn231849 @oneandonlydean for the open point in the 10-11 review (pin the depth-plane views that must keep throwing in `DepthPlaneSampling.cpp`), I wrote the cases on top of this PR's head (db77358c6): https://github.com/mrfelek/AnyPS5/tree/pr/depth-plane-refusals (one commit, bda61af82, +29 lines in `DepthPlaneSampling.cpp` only). Take it with `git cherry-pick bda61af82` if it is useful. A new `RefusalCase` builds the resource from a T# with `DecodeTextureResource`, sets the base slice and calls `DepthSurfaceTexture` directly (so it pins this code's own checks and not the descriptor parser's, which already rejects some of these shapes earlier), and expects the refusal message: - a 2D array with its base slice past its last slice (base 3, last 2); - a cube from base slice 1; - a 2D view with base slice 1. Checked on Linux (RTX 3080 Ti, GCC 15.3.0): `agc_driver_depth_plane_sampling_tests` passes with it, `check_conventions` passes, and removing each production check in turn (the `baseArray > depthOrLastArray` term, the `cube ||` term of the base-slice condition, and the `baseArray != 0` term of the one-slice refusal in `Sampled`) makes the matching case fail with "was not refused". AI-assisted; I reviewed the change and ran the tests.
oneandonlydean commented 2026-10-14 01:24:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T01:24:22Z.


@MichonGoddijn231849 mrfelek's bda61af82 (https://github.com/mrfelek/AnyPS5/tree/pr/depth-plane-refusals) covers the open point: it pins the three refusals and each case fails when its check is removed. Please cherry-pick it onto this branch.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6158784215 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6158784215). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T01:24:22Z. --- @MichonGoddijn231849 mrfelek's `bda61af82` (https://github.com/mrfelek/AnyPS5/tree/pr/depth-plane-refusals) covers the open point: it pins the three refusals and each case fails when its check is removed. Please cherry-pick it onto this branch.
github-actions[bot] commented 2026-10-14 01:36:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T01:36:14Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#454 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L789
docs/dev/debt/libSceAgcDriver.md L36-37
#4722 core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp L318-321, L344-346
#4873 core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L384-385
core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp L318-321, L344-346
#5467 core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp L318-321
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6158923635 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6158923635). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T01:36:14Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #454 | `core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp` [L789](https://github.com/boykopovar/AnyPS5/blob/e34c479210c78d7b160d7054f3e72de422b23d7a/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L789)<br>`docs/dev/debt/libSceAgcDriver.md` [L36-37](https://github.com/boykopovar/AnyPS5/blob/e34c479210c78d7b160d7054f3e72de422b23d7a/docs/dev/debt/libSceAgcDriver.md#L36-L37) | | | | #4722 | `core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp` [L318-321](https://github.com/boykopovar/AnyPS5/blob/e34c479210c78d7b160d7054f3e72de422b23d7a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp#L318-L321), [L344-346](https://github.com/boykopovar/AnyPS5/blob/e34c479210c78d7b160d7054f3e72de422b23d7a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp#L344-L346) | | | | #4873 | `core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp` [L384-385](https://github.com/boykopovar/AnyPS5/blob/e34c479210c78d7b160d7054f3e72de422b23d7a/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L384-L385)<br>`core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp` [L318-321](https://github.com/boykopovar/AnyPS5/blob/e34c479210c78d7b160d7054f3e72de422b23d7a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp#L318-L321), [L344-346](https://github.com/boykopovar/AnyPS5/blob/e34c479210c78d7b160d7054f3e72de422b23d7a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp#L344-L346) | | | | #5467 | `core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp` [L318-321](https://github.com/boykopovar/AnyPS5/blob/e34c479210c78d7b160d7054f3e72de422b23d7a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp#L318-L321) | | |
MichonGoddijn231849 commented 2026-10-14 08:32:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-14T08:32:55Z.


Cherry-picked @mrfelek's bda61af82 onto the branch (now its head, authorship kept). agc_driver_depth_plane_sampling passes on Windows with it (RTX 5080). That should close the last open point of the 10-11 review.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6164272001 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6164272001). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-14T08:32:55Z. --- Cherry-picked @mrfelek's `bda61af82` onto the branch (now its head, authorship kept). `agc_driver_depth_plane_sampling` passes on Windows with it (RTX 5080). That should close the last open point of the 10-11 review.
mrfelek commented 2026-10-14 13:11:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-14T13:11:11Z.


Heads-up for the rebase: against current main (63fb0cd92) the only conflict is one hunk in docs/dev/debt/libSceAgcDriver.md; the code merges cleanly. main added the "SW_64KB_Z_X color targets" bullet directly under "Depth plane copies", so the resolution is to keep this PR's edited "Depth plane copies" bullet (the unchanged main version of it differs from the old base only by what this PR rewrites) followed by main's new bullet.

I merged this head locally on main 3e577edac for a Diablo II: Resurrected run (Linux, RTX 3080 Ti): it builds and the nine depth ctest tests pass with it, and it is the step that takes the title past the base-slice sampling refusal. Just the docs line needs the rebase.

AI-assisted; the runs are from my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169148988 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6169148988). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-14T13:11:11Z. --- Heads-up for the rebase: against current `main` (63fb0cd92) the only conflict is one hunk in `docs/dev/debt/libSceAgcDriver.md`; the code merges cleanly. `main` added the "SW_64KB_Z_X color targets" bullet directly under "Depth plane copies", so the resolution is to keep this PR's edited "Depth plane copies" bullet (the unchanged `main` version of it differs from the old base only by what this PR rewrites) followed by `main`'s new bullet. I merged this head locally on `main` 3e577edac for a Diablo II: Resurrected run (Linux, RTX 3080 Ti): it builds and the nine `depth` ctest tests pass with it, and it is the step that takes the title past the base-slice sampling refusal. Just the docs line needs the rebase. AI-assisted; the runs are from my machine.
oneandonlydean commented 2026-10-14 13:31:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T13:31:45Z.


Rebased onto main: only the debt file conflicted; kept your depth-plane copies bullet before main's SW_64KB_Z_X one. Full ctest passes here; the full build runs once main's agc_driver_waterfall_images fix is in.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169546806 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1186#issuecomment-6169546806). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T13:31:45Z. --- Rebased onto main: only the debt file conflicted; kept your depth-plane copies bullet before main's SW_64KB_Z_X one. Full `ctest` passes here; the full build runs once main's `agc_driver_waterfall_images` fix is in.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1186
No description provided.