[pr-fix][rendering][memory] Measure texture holes after aligning their starts #194

Open
tyr0nsur wants to merge 1 commit from tyr0nsur/Darner:codex/aligned-texture-holes into main
Contributor

Contributor role (optional)

  • Fluxer ID:

What it changes

The parking admission check took the widest raw free range in each texture pool and subtracted the maximum possible padding. On ad070f0 it reported 61,441 usable bytes for a 65,536-byte hole whose start was already aligned to 4 KiB.

Measure each retained range from its actual aligned start when texture parking controls growth. The estimate still uses each bank's alignment and the smaller of the two widths when the request size cannot identify its bank. The check keeps the existing padding when parking is disabled. It estimates available space from the title's requested size and does not reserve a range.

How it was tested

  • Tested revision: 3c7cfefa2e80125557a6467b4d0686c5a6a1469b, based on ad070f073168c893a0afb00e0cd5d2ad35309ae0. Windows 11 Pro build 26300, RTX 4060 8 GiB, NVIDIA driver 621.40.
  • Commands and results:
    • On ad070f0 with the regression tests added, both cargo +1.98.1 test --locked --offline -j 2 -p darner-gpu --lib an_aligned_small_hole_predicts_an_exact_fit -- --nocapture and the same command with the_host_can_place_a_small_texture_in_an_exact_fit reproduced 61,441 versus 65,536 bytes. The RTX 4060 successfully placed the texture before the admission assertion failed.
    • On the candidate, cargo +1.98.1 test --locked --offline -j 2 -p darner-gpu --lib pool::tests:: -- --test-threads=1 --nocapture passed 62 tests, including the native placement. Three benchmarks were ignored by the existing harness.
    • cargo +1.98.1 clippy --locked --offline -p darner-gpu --all-targets --all-features -j 2 -- -D warnings passed.
    • cargo +1.98.1 run --locked --offline -j 2 --quiet --package xtask -- policy checked 555 files. The staged variant checked the one changed file. git diff --check origin/main...HEAD passed.
  • Changes a default: no switch defaults changed. The normal darner play configuration uses the corrected calculation through texture parking.
  • A/B result: the same synthetic RGBA8 128×128 texture with one mip used a 65,536-byte allocation at offset 4,096. D3D12 accepted the placement on both revisions. Main reported 61,441 usable bytes. The candidate reported all 65,536.
  • Gates run on that revision: targeted GPU Clippy and pool tests, plus the asset policy. Workspace gates were outside this run.
  • Gameplay and shader wave sizes: isolated D3D12 placement and allocator tests.
  • Hardware dependence: the range calculation covers 4 KiB and 64 KiB in the unit tests. The native placement was tested on the RTX 4060.
  • Coverage gaps: gameplay, texture quality, frame times and other adapters.

Checklist

  • Tested in the allocator and with an isolated D3D12 placed resource.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #151 enables separate small placement by default on discrete NVIDIA. Open #52, #57, and #59 also touch pool.rs for the buffer reserve, test setup, and spare retention.
  • Replaces or overlaps: no other change to the aligned-hole calculation found.
## Contributor role (optional) - Fluxer ID: ## What it changes The parking admission check took the widest raw free range in each texture pool and subtracted the maximum possible padding. On `ad070f0` it reported 61,441 usable bytes for a 65,536-byte hole whose start was already aligned to 4 KiB. Measure each retained range from its actual aligned start when texture parking controls growth. The estimate still uses each bank's alignment and the smaller of the two widths when the request size cannot identify its bank. The check keeps the existing padding when parking is disabled. It estimates available space from the title's requested size and does not reserve a range. ## How it was tested - Tested revision: `3c7cfefa2e80125557a6467b4d0686c5a6a1469b`, based on `ad070f073168c893a0afb00e0cd5d2ad35309ae0`. Windows 11 Pro build 26300, RTX 4060 8 GiB, NVIDIA driver 621.40. - Commands and results: - On `ad070f0` with the regression tests added, both `cargo +1.98.1 test --locked --offline -j 2 -p darner-gpu --lib an_aligned_small_hole_predicts_an_exact_fit -- --nocapture` and the same command with `the_host_can_place_a_small_texture_in_an_exact_fit` reproduced 61,441 versus 65,536 bytes. The RTX 4060 successfully placed the texture before the admission assertion failed. - On the candidate, `cargo +1.98.1 test --locked --offline -j 2 -p darner-gpu --lib pool::tests:: -- --test-threads=1 --nocapture` passed 62 tests, including the native placement. Three benchmarks were ignored by the existing harness. - `cargo +1.98.1 clippy --locked --offline -p darner-gpu --all-targets --all-features -j 2 -- -D warnings` passed. - `cargo +1.98.1 run --locked --offline -j 2 --quiet --package xtask -- policy` checked 555 files. The staged variant checked the one changed file. `git diff --check origin/main...HEAD` passed. - Changes a default: no switch defaults changed. The normal `darner play` configuration uses the corrected calculation through texture parking. - A/B result: the same synthetic RGBA8 128×128 texture with one mip used a 65,536-byte allocation at offset 4,096. D3D12 accepted the placement on both revisions. Main reported 61,441 usable bytes. The candidate reported all 65,536. - Gates run on that revision: targeted GPU Clippy and pool tests, plus the asset policy. Workspace gates were outside this run. - Gameplay and shader wave sizes: isolated D3D12 placement and allocator tests. - Hardware dependence: the range calculation covers 4 KiB and 64 KiB in the unit tests. The native placement was tested on the RTX 4060. - Coverage gaps: gameplay, texture quality, frame times and other adapters. ## Checklist - [x] Tested in the allocator and with an isolated D3D12 placed resource. - [x] This PR contains one change based on main. - [x] The diff follows docs/asset-policy.md. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #151 enables separate small placement by default on discrete NVIDIA. Open #52, #57, and #59 also touch `pool.rs` for the buffer reserve, test setup, and spare retention. - Replaces or overlaps: no other change to the aligned-hole calculation found.
First-time contributor

Independently tested 3c7cfefa2e80 on Windows 11 build 26300, NVIDIA driver 621.24 and Rust 1.98.1. In the same test process, DXGI identified the device as NVIDIA GeForce RTX 3060 Laptop GPU and D3D12 successfully placed the 65,536-byte texture at offset 4,096 with 4,096-byte alignment. Both the adapter diagnostic and the exact-fit test passed. The full pool test group passed 62 tests, with 3 ignored. This covers native placement on a second adapter. I did not run gameplay.

Independently tested `3c7cfefa2e80` on Windows 11 build 26300, NVIDIA driver 621.24 and Rust 1.98.1. In the same test process, DXGI identified the device as NVIDIA GeForce RTX 3060 Laptop GPU and D3D12 successfully placed the 65,536-byte texture at offset 4,096 with 4,096-byte alignment. Both the adapter diagnostic and the exact-fit test passed. The full pool test group passed 62 tests, with 3 ignored. This covers native placement on a second adapter. I did not run gameplay.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'codex/aligned-texture-holes:tyr0nsur-codex/aligned-texture-holes'
git switch 'tyr0nsur-codex/aligned-texture-holes'

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 'tyr0nsur-codex/aligned-texture-holes'
git switch 'tyr0nsur-codex/aligned-texture-holes'
git rebase 'main'
git switch 'main'
git merge --ff-only 'tyr0nsur-codex/aligned-texture-holes'
git switch 'tyr0nsur-codex/aligned-texture-holes'
git rebase 'main'
git switch 'main'
git merge --no-ff 'tyr0nsur-codex/aligned-texture-holes'
git switch 'main'
git merge --squash 'tyr0nsur-codex/aligned-texture-holes'
git switch 'main'
git merge --ff-only 'tyr0nsur-codex/aligned-texture-holes'
git switch 'main'
git merge 'tyr0nsur-codex/aligned-texture-holes'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!194
No description provided.