fix(gpu): declare dual-source blending to the Metal converter #239
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/239"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by ShadyUnderLight on 2026-11-27T03:09:53Z.
What this changes
Two pixel pipelines at the first world frame were refused by Metal Shader Converter on every run:
Both pipelines blend with the pixel shader's second output (
SRC1_*factors inCB_BLEND), so the shader writes twoSV_Targets for a singleRgba16Floatattachment. Metal spells that as[[color(0) index(1)]], and the converter only emits it whenIRCompilerSetDualSourceBlendingConfigurationenables dual-source blending for that shader. Without it the pipeline is refused and every draw that uses it is dropped, so those surfaces never appear.state::pixel_targetsreads theSV_Targetindices and write masks from the pixel shader'sOSG1part.state::dual_sourcedecides per pipeline: one more shader output than colour targets, indices0..nin order, and target 0's blend reading the second source.RenderPipelineDesc::dual_sourcecarries that tomsc::convert_with, which sets the converter option before compiling. The option is looked up withdlsym; a converter without it keeps its previous behaviour.docs/native-host.mdrecords the rule next to the blend-register notes.The branch carries one tooling commit as well, kept separate:
tools/macos/run-summary.shstripped colours withs/\x1b\[...m//g, which BSD sed reads as a literalx1b, so no timestamp ever matched and every summary printedlines 0 / last frame 0. The escape is built withprintfnow, and the self-test's synthetic log carries colours, so it fails without the strip.How it was tested
cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory— 369 passed, 0 failedcargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings— cleanrun-native.sh --headless --seconds 170), same build, before and afterBefore: two pipelines refused per run (
vertex 55ccb5c3c932717d+pixel c2979cccbbac7e8c,vertex 62148192acfb1bb1+pixel aa9cb047b21b22b1), both guessed ascolor: [Rgba16Float],depth: D32FloatS8.After: no refusals of that kind in the whole run, and the first pipeline builds. The second now stops at a different, pre-existing check —
Fragment input(s) 'user(half10)' mismatching vertex shader output type(s) or not written by vertex shader— which it could not reach while the pipeline was refused. That is a mismatch between the vertex output and pixel input signatures and is not addressed here.Unit tests cover the decision matrix and each of the four factors on its own.
run-summary.sh --self-testpasses, and a real log now summarises tolines 2110, log span 111.0s, last frame 2116instead of zeros.Checklist
VICTORY_*variable and documented — none addedImported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T03:29:44Z.
Review: APPROVED
Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!