tombox-xshader: translate domain shaders (hardware VS stage) #301
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!301
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/301/head"
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?
@nickfmbg on GitHub · 2026-11-23 17:04 UTC · original
nickfmbg:tess-ds→main· +616 −7 · 7 files · 2 commits · closed without mergingLibrary / area:
tombox-xshader(newhlsl/tess.rs;hlsl.rs:Stage::Domainprofile, entry point, input-register seeding, PS linkage). New WARP test filetests/tess.rs.Exports changed (exports.txt rows): None.
Source of the behaviour:
v0tess u,v1tess v,v2rel patch id,v3patch id. From Mesasrc/amd/vulkan/radv_shader_args.c,declare_tes_input_vgprs(MIT), used byMESA_SHADER_TESS_EVALwhen notas_es. Same order on GFX6–10, so it also fits Durango.[domain],SV_DomainLocationfloat2/float3,OutputPatch, patch-constant struct withSV_TessFactor/SV_InsideTessFactorarrays): the D3D11/12 domain shader definition.Step 2 of #294, stacked on #295 (uses
GsInfo::tess). Only the last commit is new here.What it does
Stage::Domaintranslates tods_5_0(compiled asds_6_2). The domain attribute and theOutputPatchsize come from PSV0. The patch-constant input comes from PSG1 (prim_sig), with tess factors grouped into arrays by semantic name. The control-point struct is the input signature.v0 = asuint(SV_DomainLocation.x),v1 = asuint(.y),v2 = v3 = SV_PrimitiveID. Only registers that are live at entry are seeded. Outputs use the existing VS export path. A DS output feeding a PS gets the same interpolation linkage as a VS.rel patch id = patch id: in the #294 design the off-chip ring holds every patch of the draw, so the patch's index within the ring is its global id.What it does not do (refused, unchanged)
OutputPatchandSPatchparameters are declared only so the PC pipeline links. Open question 1 in #294.stage Hull not supported yet, so no title PSO with tessellation is built yet. Runtime behaviour in d3d12_xs is unchanged.SV_DomainLocation.x/.ystraight fromv0/v1, with no swizzle. The hardware tessellator is D3D's, so this is the natural mapping, but no console fixture has confirmed it yet.Tests (
tests/tess.rs)gpu_translated_domain_shader_matches_native_hlsl_on_a_tessellated_quad, on WARP. A hand-assembled console DS (v_cvt_f32_u32,v_add_f32,exp pos0,exp param0) is translated and drawn as 2 quad patches at tess factor 4, with a PC VS + HS + PS. The 16x16 target is compared bit-exact with the same pipeline using a native HLSL DS of the same maths. It also checks per pixel that:SV_PrimitiveID;Mutation checks, done locally: flipping the patch id, swapping u and v, and mirroring v each make the test fail.
Translation tests: the quad entry point and seeding (unread
v2is not seeded), triangle (float3, patch data element), isoline (no control points, noOutputPatch). All compile with DXC.Refusals: no PSV0 tess info, hull tess info on a DS, a DS without outputs, and Hull still unsupported.
cargo test -p tombox-xshaderpassesNo game or console files and no binaries included
No fake success; anything not possible is left
missingwith a note🤖 Generated with Claude Code
@omonkeyz on GitHub · 2026-11-25 13:48 UTC · original
Applied on main in
3e70f78(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.Pull request closed