Load Metal shader libraries from memory #650

Open
fruvs wants to merge 1 commit from upstream-pr/650 into main
fruvs commented 2026-11-29 04:10:00 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by fruvs on 2026-11-29T04:10:00Z.


Refs #649

Load metallib bytes with MTLDevice.newLibraryWithData using an owned dispatch-data buffer. The common loader no longer creates a temporary file for vertex, pixel, mesh or compute libraries. The existing compiled-library cache and Metal error reporting still apply.

Verification

Verified on an Apple M5 Pro using an upstream main control and the three-file patch applied to the same revision.

  • The synthetic metal::tests::queue_b_waits_for_queue_a_over_the_same_buffer test passed on main with a writable temporary directory and failed with Operation not permitted (os error 1) when process writes were denied.
  • Under the same write restriction, the patch passed the compute test and indexed_draw_with_depth_test_and_depth_sampling. Both tests check GPU outputs.

To reproduce, build the existing synthetic tests with cargo test --locked --release -p victory-metal --lib --test render --no-run. Set VICTORY_MSC_DYLIB to the installed Metal Shader Converter and VICTORY_NO_PIPELINE_ARCHIVE=1. Invoke each test executable through sandbox-exec -p '(version 1) (allow default) (deny file-write*)', passing the corresponding test name and --exact.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5547434100 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/650). Originally posted by [fruvs](https://github.com/fruvs) on 2026-11-29T04:10:00Z. --- Refs #649 Load metallib bytes with `MTLDevice.newLibraryWithData` using an owned dispatch-data buffer. The common loader no longer creates a temporary file for vertex, pixel, mesh or compute libraries. The existing compiled-library cache and Metal error reporting still apply. ### Verification Verified on an Apple M5 Pro using an upstream main control and the three-file patch applied to the same revision. - The synthetic `metal::tests::queue_b_waits_for_queue_a_over_the_same_buffer` test passed on main with a writable temporary directory and failed with `Operation not permitted (os error 1)` when process writes were denied. - Under the same write restriction, the patch passed the compute test and `indexed_draw_with_depth_test_and_depth_sampling`. Both tests check GPU outputs. To reproduce, build the existing synthetic tests with `cargo test --locked --release -p victory-metal --lib --test render --no-run`. Set `VICTORY_MSC_DYLIB` to the installed Metal Shader Converter and `VICTORY_NO_PIPELINE_ARCHIVE=1`. Invoke each test executable through `sandbox-exec -p '(version 1) (allow default) (deny file-write*)'`, passing the corresponding test name and `--exact`.
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/650:upstream-pr/650'
git switch 'upstream-pr/650'

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/650'
git switch 'upstream-pr/650'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/650'
git switch 'upstream-pr/650'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/650'
git switch 'main'
git merge --squash 'upstream-pr/650'
git switch 'main'
git merge --ff-only 'upstream-pr/650'
git switch 'main'
git merge 'upstream-pr/650'
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
LakshanSivakumar/Native-Victory-macOS!650
No description provided.