metal: fix present pass black screen by binding sampler at draw time #89

Closed
github-bot wants to merge 1 commit from github-bot/gh-89 into main AGit
Owner

@⁠ShivamCodesBS on GitHub · 2026-11-26 14:01 UTC · original
ShivamCodesBS:fix/black-screen-present-pass → main · +16 −2 · 1 files · 1 commits · closed without merging

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.

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 14:01 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/89) `ShivamCodesBS:fix/black-screen-present-pass` → `main` · +16 −2 · 1 files · 1 commits · closed without merging 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. ## 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 - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md - [x] New diagnostics are behind a `VICTORY_*` variable and documented
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:42 +00:00
github-bot closed this pull request 2026-11-26 15:00:24 +00:00
Author
Owner

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

Thanks for digging into the black window. #91 fixes the root cause (the converter's static-sampler table was never written), confirmed on M2 Max in #99; the present pass's constexpr sampler is valid MSL, so this change isn't needed. Closing in favour of #91.

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 14:55 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/89#issuecomment-7195519954) Thanks for digging into the black window. #91 fixes the root cause (the converter's static-sampler table was never written), confirmed on M2 Max in #99; the present pass's constexpr sampler is valid MSL, so this change isn't needed. Closing in favour of #91.

Pull request closed

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