fix(agc): bound sampled array views to guest allocations #9318

Open
MarcZX10 wants to merge 4 commits from upstream-pr/9318 into main
MarcZX10 commented 2026-10-21 18:18:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T18:18:50Z.


What

Issue #9295 reports sampled 2D-array descriptors naming 6,145 slices when only 90 complete slices fit in the contiguous mapped guest range. Building the full sampled image can request more than 100 GiB of host image memory and abort with std::bad_alloc.

Cap sampled 1D-array, 2D-array and cube views to complete slices in the mapped range before creating the cached image. If the requested starting slice is outside the range, use slice 0 alone when at least one complete slice fits; throw when none fit. Storage views are unchanged. Regression cases cover the 90-of-6,145 boundary, an in-range starting slice and the fallback/error cases.

This addresses only the oversized sampled-view allocation described in #9295. It does not establish what the console does with out-of-range descriptors and does not resolve the issue's other stops or black frames. Related open work #6481 validates image-table entries; #6977 adds GCN tiling. Neither implements allocation-bounded sampled array views.

Tested

Linux x86_64, GCC 12.2, Release. ninja -C build agc_driver_graphics_tests passed after rebasing on main 6b6c701636. The focused RunTextureTilingTests suite passed in a standalone runner linked from the project-built objects.

The registered agc_driver_graphics_maps_fallback CTest could not reach its test body: startup rejected this host's Intel Xeon E5-1620 v2 because it lacks LZCNT, BMI1, BMI2, MOVBE, AVX2 and FMA. No Vulkan or GPU test is claimed. python3 tools/check_conventions.py --base upstream/main passed.

Checklist

  • Based on current main; no other open PR implements the same behavior
  • One topic per PR; follow-ups go in a new pull request
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in technical debt
  • No notes, investigation files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behavior, not specific to one title
  • Depends on: none
  • Fixes: none (related to #9295; the issue has other unresolved stops and black frames)
  • Unblocks: none demonstrated
  • GPUs tested: none; the test runner could not start on this host CPU
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4956304401 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9318). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T18:18:50Z. --- ### What Issue #9295 reports sampled 2D-array descriptors naming 6,145 slices when only 90 complete slices fit in the contiguous mapped guest range. Building the full sampled image can request more than 100 GiB of host image memory and abort with `std::bad_alloc`. Cap sampled 1D-array, 2D-array and cube views to complete slices in the mapped range before creating the cached image. If the requested starting slice is outside the range, use slice 0 alone when at least one complete slice fits; throw when none fit. Storage views are unchanged. Regression cases cover the 90-of-6,145 boundary, an in-range starting slice and the fallback/error cases. This addresses only the oversized sampled-view allocation described in #9295. It does not establish what the console does with out-of-range descriptors and does not resolve the issue's other stops or black frames. Related open work #6481 validates image-table entries; #6977 adds GCN tiling. Neither implements allocation-bounded sampled array views. ### Tested Linux x86_64, GCC 12.2, Release. `ninja -C build agc_driver_graphics_tests` passed after rebasing on `main` `6b6c701636`. The focused `RunTextureTilingTests` suite passed in a standalone runner linked from the project-built objects. The registered `agc_driver_graphics_maps_fallback` CTest could not reach its test body: startup rejected this host's Intel Xeon E5-1620 v2 because it lacks LZCNT, BMI1, BMI2, MOVBE, AVX2 and FMA. No Vulkan or GPU test is claimed. `python3 tools/check_conventions.py --base upstream/main` passed. ### Checklist - [x] Based on current `main`; no other open PR implements the same behavior - [x] One topic per PR; follow-ups go in a new pull request - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are listed in technical debt - [x] No notes, investigation files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behavior, not specific to one title - [x] Depends on: none - [x] Fixes: none (related to #9295; the issue has other unresolved stops and black frames) - [x] Unblocks: none demonstrated - [x] GPUs tested: none; the test runner could not start on this host CPU - [x] AI-assisted: yes
simonbbby commented 2026-10-21 18:28:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-21T18:28:32Z.


Independent native Linux check at exact head b21d32e41d8488b7557a0556bd9141de3f8fae3e: the registered tests reach their bodies on this CPU, and a bounded-array execution diagnostic passes on NVIDIA, RADV and lavapipe.

  • Built agc_driver_graphics_tests; both registered tests, agc_driver_graphics and agc_driver_graphics_maps_fallback, pass. This runs the new BoundArrayWindow assertions in the normal executable, beyond the standalone runner reported above. These are CPU/mock-Vulkan tests; their pass is not a GPU claim. The unrelated heap-mirror cases explicitly report unavailable/unwatched memory.
  • Built the existing agc_driver_image_array_window_past_layer_limit_tests; its stock form passes on all three ICDs.
  • For a separate full-path check, I temporarily adapted that fixture to a linear 1D-array descriptor with baseArray=0, lastArray=6144 (6,145 declared slices), over host-mapped memory registered through GuestAllocations::Mutation::Add for only 90 × 256 = 23,040 bytes. Width is 8, format 56. The descriptor still describes all 6,145 slices; no call to BoundArrayWindow was added to the test. Logs show layers=90 in the texture actually created by the sampled-resource path.
  • It dispatches the existing shader twice per process, checking both image_sample_lz and image_load results for 32 lanes against exact RGBA texels. The load inputs include slice 89; sample inputs include 89, 89.6 and 90, checking the final registered slice and the sampler's clamp. The adapted fixture passes 3/3 fresh processes on RTX 3090, 3/3 on gfx1036/RADV and 3/3 on lavapipe.

Integration negative control: keeping that diagnostic and the PR's helper/tests, but replacing only Graphics/src/ShaderResources.cpp with merge-base 6b6c7016365271245e8b81c1b734cac2d65f664d, makes all three ICDs exit 1 with an image view of more array slices than maxImageArrayLayers is not implemented. Restoring the PR's file makes all three pass again. This checks that bounding is connected to the sampled-resource path; it does not reproduce the title's >100-GiB allocation attempt.

All temporary edits were then removed, the stock graphics and array-window targets rebuilt, both registered graphics tests rerun successfully, and the stock GPU fixture rerun successfully on all three ICDs. Checkout is clean at the tested head.

Ubuntu 24.04.3, GCC 13.3, Release; RTX 3090 / NVIDIA 595.99.02, gfx1036 (1002:13c0) / RADV Mesa 25.2.8, lavapipe Mesa 25.2.8 / LLVM 20.1.2. Each GPU process pins its ICD and uses ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1. No Khronos validation layer is installed here. The GPU diagnostic covers the shared bounding path through a 1D array, not a 2D-array/cube title render, and does not establish the console's out-of-range behavior or resolve #9295's black frames.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6323482295 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9318#issuecomment-6323482295). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-21T18:28:32Z. --- Independent native Linux check at exact head `b21d32e41d8488b7557a0556bd9141de3f8fae3e`: the registered tests reach their bodies on this CPU, and a bounded-array execution diagnostic passes on NVIDIA, RADV and lavapipe. - Built `agc_driver_graphics_tests`; both registered tests, `agc_driver_graphics` and `agc_driver_graphics_maps_fallback`, pass. This runs the new `BoundArrayWindow` assertions in the normal executable, beyond the standalone runner reported above. These are CPU/mock-Vulkan tests; their pass is not a GPU claim. The unrelated heap-mirror cases explicitly report unavailable/unwatched memory. - Built the existing `agc_driver_image_array_window_past_layer_limit_tests`; its stock form passes on all three ICDs. - For a separate full-path check, I temporarily adapted that fixture to a linear 1D-array descriptor with `baseArray=0`, `lastArray=6144` (6,145 declared slices), over host-mapped memory registered through `GuestAllocations::Mutation::Add` for only **90 × 256 = 23,040 bytes**. Width is 8, format 56. The descriptor still describes all 6,145 slices; no call to `BoundArrayWindow` was added to the test. Logs show `layers=90` in the texture actually created by the sampled-resource path. - It dispatches the existing shader twice per process, checking both `image_sample_lz` and `image_load` results for 32 lanes against exact RGBA texels. The load inputs include slice 89; sample inputs include 89, 89.6 and 90, checking the final registered slice and the sampler's clamp. The adapted fixture passes **3/3 fresh processes on RTX 3090, 3/3 on gfx1036/RADV and 3/3 on lavapipe**. Integration negative control: keeping that diagnostic and the PR's helper/tests, but replacing only `Graphics/src/ShaderResources.cpp` with merge-base `6b6c7016365271245e8b81c1b734cac2d65f664d`, makes all three ICDs exit 1 with `an image view of more array slices than maxImageArrayLayers is not implemented`. Restoring the PR's file makes all three pass again. This checks that bounding is connected to the sampled-resource path; it does not reproduce the title's >100-GiB allocation attempt. All temporary edits were then removed, the stock graphics and array-window targets rebuilt, both registered graphics tests rerun successfully, and the stock GPU fixture rerun successfully on all three ICDs. Checkout is clean at the tested head. Ubuntu 24.04.3, GCC 13.3, Release; RTX 3090 / NVIDIA 595.99.02, gfx1036 (`1002:13c0`) / RADV Mesa 25.2.8, lavapipe Mesa 25.2.8 / LLVM 20.1.2. Each GPU process pins its ICD and uses `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`. No Khronos validation layer is installed here. The GPU diagnostic covers the shared bounding path through a **1D array**, not a 2D-array/cube title render, and does not establish the console's out-of-range behavior or resolve #9295's black frames.
wachi35676 commented 2026-10-21 22:59:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-21T22:59:34Z.


Windows run of the full sampled path on NVIDIA and AMD, plus one problem in the cube fallback. Head b21d32e merged onto main a6dcea927 (clean merge, 17c1e949b).

Host: Windows 11 (10.0.26300), Ryzen 5 9600X, WinLibs GCC 15.2.0, Release. GPUs: NVIDIA RTX 5070 Ti (617.42) and AMD Radeon RDNA2 iGPU 1002:13c0 (proprietary 32.0.21042.62, ANYPS5_GPU=AMD). ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1.

Registered tests. The 81-test related set (agc_driver_graphics*, image_*array*/*cube*, array_layer_target*, layered draws and others) matches main on both GPUs. ImageArrayWindowPastLayerLimit.cpp does not compile under MinGW on main (alignas(65536): "requested alignment exceeds object file maximum 8192"), so it cannot run here as committed.

Local GPU probe (not for the PR). I adapted that fixture to build here: alignas(256), linear 1D array, width 8, format 56, descriptor slices 0..6144, and GuestAllocations::Mutation::Add registers only 90 × 256 bytes. image_sample_lz and image_load run on 32 lanes. Same results on both GPUs:

  • base 0: texture created with layers=90; all 32 lanes return the slice clamped to 0..89 (sample layers 0, 1, 45, 88.4, 89, 89.6, 90, 3000).
  • base 6: layers=84; sample layer 0→slice 6, 1→7, 45→51, 88.4→89; load layer 0→slice 6. Lanes stay inside the registered range.
  • base 100 (past the range): layers=1; every lane returns slice 0. This is the documented fallback, not the requested slices.
  • Negative control: with ShaderResources.cpp from main, NVIDIA throws an image view of more array slices than maxImageArrayLayers is not implemented for all three bases. AMD does not throw: it creates layers=6145/6139/6045 textures and reads past the registered range. So on this AMD driver the PR changes behaviour from "whole descriptor" to "bounded".

Cube fallback. BoundArrayWindow treats kCube like an array of single faces. I added a unit probe to RunTextureTilingTests (16×16, format 56, 64 KiB standard tiling):

  • cube faces 6..11 with 6 faces mapped → baseArray=0 lastArray=0, a 1-face view.
  • faces 0..11 with 4 faces mapped → lastArray=3, 4 faces.

The texture path then requires at least 6 slices for a cube (Texture.cpp, "guest cube texture view holds fewer than 6 array slices"). So a cube whose base cube lies past the range, or whose range holds fewer than 6 faces from the base, now throws. On main it builds the full view. For kCube, rounding the available faces down to whole cubes and falling back to faces 0..5 would avoid that. I did not run a cube draw on the GPU.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6328444184 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9318#issuecomment-6328444184). Originally posted by [wachi35676](https://github.com/wachi35676) on 2026-10-21T22:59:34Z. --- Windows run of the full sampled path on NVIDIA and AMD, plus one problem in the cube fallback. Head `b21d32e` merged onto main `a6dcea927` (clean merge, `17c1e949b`). Host: Windows 11 (10.0.26300), Ryzen 5 9600X, WinLibs GCC 15.2.0, Release. GPUs: NVIDIA RTX 5070 Ti (617.42) and AMD Radeon RDNA2 iGPU `1002:13c0` (proprietary 32.0.21042.62, `ANYPS5_GPU=AMD`). `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`. **Registered tests.** The 81-test related set (`agc_driver_graphics*`, `image_*array*`/`*cube*`, `array_layer_target*`, layered draws and others) matches main on both GPUs. `ImageArrayWindowPastLayerLimit.cpp` does not compile under MinGW on main (`alignas(65536)`: "requested alignment exceeds object file maximum 8192"), so it cannot run here as committed. **Local GPU probe** (not for the PR). I adapted that fixture to build here: `alignas(256)`, linear 1D array, width 8, format 56, descriptor slices 0..6144, and `GuestAllocations::Mutation::Add` registers only 90 × 256 bytes. `image_sample_lz` and `image_load` run on 32 lanes. Same results on both GPUs: - base 0: texture created with `layers=90`; all 32 lanes return the slice clamped to 0..89 (sample layers 0, 1, 45, 88.4, 89, 89.6, 90, 3000). - base 6: `layers=84`; sample layer 0→slice 6, 1→7, 45→51, 88.4→89; load layer 0→slice 6. Lanes stay inside the registered range. - base 100 (past the range): `layers=1`; every lane returns slice 0. This is the documented fallback, not the requested slices. - Negative control: with `ShaderResources.cpp` from main, NVIDIA throws `an image view of more array slices than maxImageArrayLayers is not implemented` for all three bases. AMD does not throw: it creates `layers=6145`/`6139`/`6045` textures and reads past the registered range. So on this AMD driver the PR changes behaviour from "whole descriptor" to "bounded". **Cube fallback.** `BoundArrayWindow` treats `kCube` like an array of single faces. I added a unit probe to `RunTextureTilingTests` (16×16, format 56, 64 KiB standard tiling): - cube faces 6..11 with 6 faces mapped → `baseArray=0 lastArray=0`, a 1-face view. - faces 0..11 with 4 faces mapped → `lastArray=3`, 4 faces. The texture path then requires at least 6 slices for a cube (`Texture.cpp`, "guest cube texture view holds fewer than 6 array slices"). So a cube whose base cube lies past the range, or whose range holds fewer than 6 faces from the base, now throws. On main it builds the full view. For `kCube`, rounding the available faces down to whole cubes and falling back to faces 0..5 would avoid that. I did not run a cube draw on the GPU. AI-assisted: yes (Claude Code); results above were run on this machine.
CnRJay commented 2026-11-01 19:50:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:50:55Z.

Review: COMMENTED


Correction (2026-11-01): the title-ID/log demand below is not a CONTRIBUTING requirement; Unblocks: none is allowed. The technical points below are unaffected.

This is an approximation of what the hardware does with an out-of-range descriptor, and the PR says so itself ("does not establish what the console does with out-of-range descriptors"). Under the exact-or-throw rule that is the part that should not merge as written.

  1. BoundArrayWindow invents a view. When the requested range runs past the registered allocation it silently shrinks depthOrLastArray to the last whole slice, and when baseArray is past the end it rewrites the view to slice 0 (or cube 0). A guest that really samples slice 5000 of a 90-slice allocation gets slice 0 back with no log and no throw. Nothing in the description says the console returns slice 0, or that the descriptor's slice count is meant to be clamped by the allocation size at all. If the general behaviour is unknown, the choices are to throw (as the availableLayers == 0 case already does) and record the gap in docs/dev/debt/libSceAgcDriver.md, not to pick a substitute view. The 6,145 versus 90 case in #9295 is a case where the descriptor probably does not mean what the code assumes; a throw naming the descriptor fields would show that, a clamp hides it.

  2. The clamp is keyed to registered allocations, not to what is mapped. GuestAllocationsLookup_nid_postfix(baseAddress, false) decides the limit. A texture whose layers span two adjacent registered allocations, or memory mapped outside the registered list, gets truncated at the first allocation's end, which would produce a wrong image for a valid descriptor rather than an out-of-range one. Is the lookup guaranteed to return the whole contiguous mapping? The PR text says "contiguous mapped guest range", the code uses the registration.

  3. Per-view cost. The lookup and DescribeSurface now run on every sampled 1D/2D array and cube view built, not only on the oversized ones, and guestBytes = 0 is set whenever the window changes. Please state how often this path runs per draw in a real scene, or gate the lookup behind the existing size check (layers * layerBytes against a cheap bound) so the common case does not pay for it.

  4. Evidence. No title ID and log line showing a title reaches this on main; the justification is issue #9295 only. The regression cases test the clamp's arithmetic, but nothing checks that an in-range descriptor on an allocation that is not the first registered one is left alone.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729927136 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9318#pullrequestreview-5729927136). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:50:55Z. **Review:** COMMENTED --- **Correction (2026-11-01):** the title-ID/log demand below is not a CONTRIBUTING requirement; `Unblocks: none` is allowed. The technical points below are unaffected. This is an approximation of what the hardware does with an out-of-range descriptor, and the PR says so itself ("does not establish what the console does with out-of-range descriptors"). Under the exact-or-throw rule that is the part that should not merge as written. 1. **`BoundArrayWindow` invents a view.** When the requested range runs past the registered allocation it silently shrinks `depthOrLastArray` to the last whole slice, and when `baseArray` is past the end it rewrites the view to slice 0 (or cube 0). A guest that really samples slice 5000 of a 90-slice allocation gets slice 0 back with no log and no throw. Nothing in the description says the console returns slice 0, or that the descriptor's slice count is meant to be clamped by the allocation size at all. If the general behaviour is unknown, the choices are to throw (as the `availableLayers == 0` case already does) and record the gap in `docs/dev/debt/libSceAgcDriver.md`, not to pick a substitute view. The 6,145 versus 90 case in #9295 is a case where the descriptor probably does not mean what the code assumes; a throw naming the descriptor fields would show that, a clamp hides it. 2. **The clamp is keyed to registered allocations, not to what is mapped.** `GuestAllocationsLookup_nid_postfix(baseAddress, false)` decides the limit. A texture whose layers span two adjacent registered allocations, or memory mapped outside the registered list, gets truncated at the first allocation's end, which would produce a wrong image for a valid descriptor rather than an out-of-range one. Is the lookup guaranteed to return the whole contiguous mapping? The PR text says "contiguous mapped guest range", the code uses the registration. 3. **Per-view cost.** The lookup and `DescribeSurface` now run on every sampled 1D/2D array and cube view built, not only on the oversized ones, and `guestBytes = 0` is set whenever the window changes. Please state how often this path runs per draw in a real scene, or gate the lookup behind the existing size check (`layers * layerBytes` against a cheap bound) so the common case does not pay for it. 4. **Evidence.** No title ID and log line showing a title reaches this on main; the justification is issue #9295 only. The regression cases test the clamp's arithmetic, but nothing checks that an in-range descriptor on an allocation that is not the first registered one is left alone.
MarcZX10 commented 2026-11-02 04:57:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:57:05Z.

Review: COMMENTED


Reviewed — four review points checked, clamp reaches every array view

Three of CnRJay's four technical points are confirmed by the code at head 8ed6ddb40781, and the fourth is only partly checked.

What I ran

Head 8ed6ddb40781f559cf60b855a99c1e794147b42d (live, OPEN). Read-only: gh pr view, gh api GET on comments and reviews, git grep and git show at the head. Nothing was built or run.

Results

Check Result Note
Hosted checks 4 success, none failing NVIDIA run by TechLevelZero passed on this head
Code reads (points 1-3) Confirmed Read at head, lines below
Test coverage (point 4) Partly checked Arithmetic tests found, placement not checked

Findings

  • Point 1, the window invents a view: confirmed. TextureTiling.cpp:523-526 resets baseArray to 0 when the start is past the available layers, and :528 shrinks depthOrLastArray to the last whole slice. No log or throw on those paths. The only throw is for zero layers (:521).
  • Point 2, registration-based limit: confirmed. ShaderResources.cpp:714 calls GuestAllocationsLookup_nid_postfix(resource.baseAddress, false) and clamps to range->bytes - offset (:716). The limit is the registered range, not the mapping.
  • Point 3, per-view cost: confirmed. The lookup at ShaderResources.cpp:714 runs for every 1D or 2D array or cube view, with no size check first. :720 sets guestBytes = 0 when the window changes. How often this runs per draw in a real scene is not measured.
  • Point 4, evidence: tests/TextureTiling.cpp:535-564 cover the clamp arithmetic on a 90-layer allocation and cube cases. I did not confirm whether any test puts an in-range view on a non-first registered allocation. Not verified.

Sources

Not verified

  • Console behavior for out-of-range descriptors (no hardware).
  • Whether the lookup always returns the full contiguous mapping (point 2 asks this; the code only shows the registration is used).
  • The #9295 descriptor values and any title log.
  • Per-draw frequency of the lookup (point 3).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732247248 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9318#pullrequestreview-5732247248). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T04:57:05Z. **Review:** COMMENTED --- # Reviewed — four review points checked, clamp reaches every array view Three of CnRJay's four technical points are confirmed by the code at head 8ed6ddb40781, and the fourth is only partly checked. ## What I ran Head `8ed6ddb40781f559cf60b855a99c1e794147b42d` (live, OPEN). Read-only: `gh pr view`, `gh api` GET on comments and reviews, `git grep` and `git show` at the head. Nothing was built or run. ## Results | Check | Result | Note | |---|---|---| | Hosted checks | 4 success, none failing | NVIDIA run by TechLevelZero passed on this head | | Code reads (points 1-3) | Confirmed | Read at head, lines below | | Test coverage (point 4) | Partly checked | Arithmetic tests found, placement not checked | ## Findings - Point 1, the window invents a view: confirmed. `TextureTiling.cpp:523-526` resets `baseArray` to 0 when the start is past the available layers, and `:528` shrinks `depthOrLastArray` to the last whole slice. No log or throw on those paths. The only throw is for zero layers (`:521`). - Point 2, registration-based limit: confirmed. `ShaderResources.cpp:714` calls `GuestAllocationsLookup_nid_postfix(resource.baseAddress, false)` and clamps to `range->bytes - offset` (`:716`). The limit is the registered range, not the mapping. - Point 3, per-view cost: confirmed. The lookup at `ShaderResources.cpp:714` runs for every 1D or 2D array or cube view, with no size check first. `:720` sets `guestBytes = 0` when the window changes. How often this runs per draw in a real scene is not measured. - Point 4, evidence: `tests/TextureTiling.cpp:535-564` cover the clamp arithmetic on a 90-layer allocation and cube cases. I did not confirm whether any test puts an in-range view on a non-first registered allocation. Not verified. ## Sources - https://github.com/boykopovar/AnyPS5/blob/8ed6ddb40781f559cf60b855a99c1e794147b42d/core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp#L511-L530 - https://github.com/boykopovar/AnyPS5/blob/8ed6ddb40781f559cf60b855a99c1e794147b42d/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L711-L720 - https://github.com/boykopovar/AnyPS5/blob/8ed6ddb40781f559cf60b855a99c1e794147b42d/core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp#L535-L564 ## Not verified - Console behavior for out-of-range descriptors (no hardware). - Whether the lookup always returns the full contiguous mapping (point 2 asks this; the code only shows the registration is used). - The #9295 descriptor values and any title log. - Per-draw frequency of the lookup (point 3).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/9318:upstream-pr/9318'
git switch 'upstream-pr/9318'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/9318'
git switch 'upstream-pr/9318'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/9318'
git switch 'upstream-pr/9318'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/9318'
git switch 'main'
git merge --squash 'upstream-pr/9318'
git switch 'main'
git merge --ff-only 'upstream-pr/9318'
git switch 'main'
git merge 'upstream-pr/9318'
git push origin 'main'
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!9318
No description provided.