Shaders: lower full-mask pos1 layer and viewport exports #3489
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3489"
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 Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T08:34:46Z.
Change
Handle vertex shaders that export render-target layer and viewport index in
pos1.zwhile enabling all four channels. The console compiler uses zero padding in X, Y and W in the two cases reported in #1417. Accept the padding only if the lowering proves that it is zero. Decode the two indices as before and keep clip/cull data inpos2andpos3when the misc export is present.Fixes #914. This replaces the closed #1417 and retains the original implementation commit and author. Closing review and prior verification
Verification
2a60d82atpos1. With the follow-up onmain63bcca4it passes on app-local WARP with DXIL validation.Please retain the original Git authors if reusing these commits. If folding the full-mask follow-up into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex. Synthetic shaders and textures only.
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-27T09:37:34Z.
Independent Windows/WARP verification of #3489 at
7987ba80ebcafb7c6d6a78336b9652af4e89eca8Environment: Windows 11 Pro build 10.0.26200, rustc 1.98.1, no physical GPU:
VICTORY_WARP=1andVICTORY_D3D12_WARP=1(WARP only),dxil.dll1.8.2502.11 from the Windows SDK 10.0.26100.0. (An older 10.0.19041dxil.dllrejects SM 6.6: the new test fails withUnknown shader model 'ps_6_6'and many GPU tests crash with an access violation; those runs are discarded.) Base ismain63bcca43c6; all three PR heads (#3487, #3488, #3489) sit directly on it.--locked, separate worktrees for base and head. Claim: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7214169025AI-assisted (Claude); I read the diff and the logs before posting. No game files were used. WARP is not hardware, so this says nothing about driver behaviour on AMD or NVIDIA.
Result: no regression found on WARP; the new render test passes and actually draws. I ran every
victory-shaderlib test in its own process (--exact, 4 at a time, samedxil.dll) on both sides:emit::valu_tests::vs_rt_and_viewport_array_index_exports_render_across_slices_and_viewports, which passes. WARP reportssupported=truefor VP/RT array index from a VS, so the test takes the draw path (3 slices, 2 viewports) instead of skipping.synthetic_tests::a_mask_joined_with_data_at_a_uniform_loop_is_its_number,gathers_at_a_level_match_the_hardware,permutes_mask_high_address_bits_and_divergent_branches,permutes_read_the_lane_named_and_zero_from_lanes_left_out. They concern lane/wave behaviour on WARP, which this PR does not touch.tests/resource_tracking.rspasses on both (3 passed, 1 ignored).Diff read (no defect found):
pos1.zis split into render-target index (low 16 bits) and viewport index (high 16 bits) and sets a newVIEWPORT_RT_INDEXflag (shader feature bit0x2000) for non-mesh stages. Clip/cull exports move frompos1/pos2topos2/pos3when the misc vector exists. A non-zeropos1.x/y/wstill returns"clip, cull or point-size exports"(the test asserts it), so a point-size export stays unsupported, as before. Hosts withoutVPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulationare skipped by the test, and a real AMD or NVIDIA driver was not checked here; that needs hardware.Imported from Marvisak/VIctory. Originally posted by AurumCarlos on 2026-11-27T14:06:05Z.
Review: COMMENTED
The full-mask handling is right: the padding is accepted only when
konstproves it zero,pos1.zsplits into layer (low 16) and viewport (high 16), and the clip/cull distances move topos2/pos3with the misc vector. But #1417 was closed for two reasons, and only the first is answered here. The triage's second one still holds: "No title program reaches this path onmain." The new evidence is again synthetic (WARP readback of a hand-written export), so this is likely to be closed the same way.Suggested next step, which settles it either way: on
63bcca4, run the translator over the title's shaders and look formain's refusal for this path (lower.rs:10002):and look for
render-target or viewport index exportsin the summary (or per program with--list). If it is there, quote the count (and a container hash from--list) in the description and the triage objection goes away. If it is absent, nothing in the title needs this yet, and it would be better parked until a program does.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.