test: fix victory-metal/tests/resources.rs pool sizes for 16KB pages #77

Manually merged
github merged 2 commits from github-bot/gh-77 into main 2026-11-26 17:09:34 +00:00 AGit
Owner

@⁠ShivamCodesBS on GitHub · 2026-11-26 13:42 UTC · original
ShivamCodesBS:fix/test-pool-sizes-16kb-pages-v2 → main · +23 −5 · 3 files · 2 commits · merged 2026-11-26 17:08 UTC

Derive page count from actual buffer sizes instead of fixed pages:

  • srv_and_uav_through_a_descriptor_table: 2 buffers × 16 KiB = 32 KiB → pages = ceil(32 KiB / page_size())
  • texture_over_zero_copy_memory: 4x4 RGBA8Unorm texture → 1 page (smallest)

Also add sentence to existing Rosetta alignment note in docs/native-host.md (~239): two reported 4 KiB pages cannot hold the two 16 KiB buffers; test helpers clamp allocation unit to 16 KiB via page_size().max(16384). Note that the 16 KiB clamp lives in the GPU test helpers, not victory-metal::mem.

This addresses reviewer feedback from PR #48:

  • Reverts victory-gpu pool changes (already handled by main's page_size().max(16384))
  • Fixes victory-metal/tests/resources.rs to derive pages from buffer sizes
  • Adds Rosetta page_size() note to docs/native-host.md in existing alignment note

What this changes

How it was tested

  • cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings
  • Ran the game (say how far it got), or not needed

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md
  • New diagnostics are behind a VICTORY_* variable and documented
**@⁠ShivamCodesBS** on GitHub · 2026-11-26 13:42 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/77) `ShivamCodesBS:fix/test-pool-sizes-16kb-pages-v2` → `main` · +23 −5 · 3 files · 2 commits · merged 2026-11-26 17:08 UTC Derive page count from actual buffer sizes instead of fixed pages: - srv_and_uav_through_a_descriptor_table: 2 buffers × 16 KiB = 32 KiB → pages = ceil(32 KiB / page_size()) - texture_over_zero_copy_memory: 4x4 RGBA8Unorm texture → 1 page (smallest) Also add sentence to existing Rosetta alignment note in docs/native-host.md (~239): two reported 4 KiB pages cannot hold the two 16 KiB buffers; test helpers clamp allocation unit to 16 KiB via page_size().max(16384). Note that the 16 KiB clamp lives in the GPU test helpers, not victory-metal::mem. This addresses reviewer feedback from PR #48: - Reverts victory-gpu pool changes (already handled by main's page_size().max(16384)) - Fixes victory-metal/tests/resources.rs to derive pages from buffer sizes - Adds Rosetta page_size() note to docs/native-host.md in existing alignment note ## What this changes <!-- One change per pull request. Link the issue or ROADMAP item. --> ## How it was tested - [ ] `cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory` - [ ] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` - [ ] Ran the game (say how far it got), or not needed ## Checklist - [ ] No game files, game code, disassembly listings or SDK files are included - [ ] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md - [ ] New diagnostics are behind a `VICTORY_*` variable and documented
Derive page count from actual buffer sizes instead of fixed pages:
- srv_and_uav_through_a_descriptor_table: 2 buffers × 16 KiB = 32 KiB → pages = ceil(32 KiB / page_size())
- texture_over_zero_copy_memory: 4x4 RGBA8Unorm texture → 1 page (smallest)

Also add sentence to existing Rosetta alignment note in docs/native-host.md (~239): two reported 4 KiB pages cannot hold the two 16 KiB buffers; test helpers clamp allocation unit to 16 KiB via page_size().max(16384). Note that the 16 KiB clamp lives in the GPU test helpers, not victory-metal::mem.

This addresses reviewer feedback from PR #48:
- Reverts victory-gpu pool changes (already handled by main's page_size().max(16384))
- Fixes victory-metal/tests/resources.rs to derive pages from buffer sizes
- Adds Rosetta page_size() note to docs/native-host.md in existing alignment note
The present pass shader uses a sampler (), but the
sampler was never bound at draw time. The constexpr sampler in the original
MSL was not being recognized by Metal because it wasn't bound via the
encoder.

Fix: Change the shader to use a regular sampler argument ()
and bind a matching MTLSamplerState at draw time in try_present().

This fixes the black screen issue where the present pass couldn't sample
the source texture because no sampler was bound.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:45:23 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 14:55 UTC · original · requested changes

Thanks, this supersedes #48 once trimmed. Please drop the present.rs sampler hunk (out of scope; #91 fixes the black window), revert the unrequested arena change in texture_over_zero_copy_memory, and make the docs sentence agree with the test (the doc says the helpers clamp with page_size().max(16384), the test uses plain page_size()).

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 14:55 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/77#pullrequestreview-6076254534) · **requested changes** Thanks, this supersedes #48 once trimmed. Please drop the present.rs sampler hunk (out of scope; #91 fixes the black window), revert the unrequested arena change in texture_over_zero_copy_memory, and make the docs sentence agree with the test (the doc says the helpers clamp with `page_size().max(16384)`, the test uses plain `page_size()`).
github manually merged commit 4114e81770 into main 2026-11-26 17:09:34 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 17:08 UTC · original

Merged in 8c47ddd, with a small fix commit on top. I dropped the present.rs sampler change, since it's out of scope and the black window is #91. I also restored the two-page arena in texture_over_zero_copy_memory and rewrote the doc sentence to match the test. Thanks!

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 17:08 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/77#issuecomment-7198563079) Merged in 8c47ddd, with a small fix commit on top. I dropped the `present.rs` sampler change, since it's out of scope and the black window is #91. I also restored the two-page arena in `texture_over_zero_copy_memory` and rewrote the doc sentence to match the test. Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.