Repository navigation
Conversation
… without a mesh tier Cards with Shader Model 6.6 but D3D12_MESH_SHADER_TIER_NOT_SUPPORTED (or VICTORY_MESH_EMULATION=1) now run mesh stages as a cs_6_6 that writes packed vertices and primitives to a shared UAV, followed by a generated vs_6_6 that unpacks them by SV_VertexID and culls flagged primitives with a NaN position. Direct DispatchMesh is chunked by group_cap; ExecuteIndirect(MESH) goes through a GPU prep pass that sums the group counts and builds a slot map. The shader cache moves to VSH2 with a separate mesh-emu converter key.
|
Ran this on the hardware it targets: GTX 1060 6 GB (Pascal, SM 6.6 through the Agility runtime, no mesh shader tier), Windows 10 19045. I merged
For reviewers: #961 (towards #3) covers the same ground, a mesh program lowered to
Both approaches work. Since they would conflict, it may help to settle on one and fold the other's useful parts into it. I'm glad to help whichever way the maintainers prefer. Disclosure: I wrote #961. AI-assisted (Claude Code). |
|
Thanks for running this on the Pascal card — that's exactly the class of machine it targets, and good to see the suite green there. Confirming the table from this side:
On the #189 row — I checked, and there are two concrete interaction points, both real:
On settling on one approach — that's the maintainers' call, and happy to help either way. From this PR, the parts that would survive a fold-in regardless of direction: the GPU side (group-cap chunking, the ExecuteIndirect prep pass and slot map, the shared output buffer and its UAV/SRV state machine), and the VSH2 cache split. If #189 lands first I'm glad to rebase on it and wire the two modes together. |
D3D12's Close returns E_FAIL for an already-closed list as well as for an invalid recorded command, and a world frame closed a sealed list again: the run ended at the first emulated mesh dispatch with 'a host command list did not close (0x80004005)', which read as an invalid command (frame 29347 on an RX 580, mesh d4111a6e6ea49d91 + pixel c0a7fe77b1862e10). The console API tolerates re-closing a sealed list, so the host now tracks closed-ness per list: a second close warns once and does nothing, and reset reopens it. Reproduced with the real containers from the title's archive through new local-only tests: extract_containers pulls them out of shaders.rpf, emulated_mesh_dispatch_closes drives the direct and indirect emulated dispatches with them end to end (the failure reproduces as a double close and passes with the fix), and dump_cached_mesh_entries prints a run's cached mesh bindings.
|
Root cause found for the world-entry crash on a mesh-less card ("a host command list did not close (Unspecified error (0x80004005)): a command recorded into it was invalid", frame 29347 on an RX 580, this branch's first emulated mesh frame), and fixed in c6ec4ad. Diagnosis. That message was read as "an invalid command was recorded", but D3D12's How it was pinned down. The exact shader pair from the log ( Fix. The three new tests are |
Resolve conflicts against main (70564ae): move MESH_EMU_SPACE from 2 to 3 to avoid main's MEMORY_SPACE = 2, wire emulated mesh pipelines through root_uavs/title-memory/depth-twins/atomics64/pipeline-library tag, keep non-mesh shaders on shader.dxil during translate --cache, and preserve VSH2 cache encoding.
Resolve conflicts against latest main: align indirect::clamp_only with single-group tiled clamp (Marvisak#1510), mask emulated mesh primitive vertex indices to 9 bits to drop edge flags (c0228d9 parity), pass OPTIONS19 aniso point-mip support through push_stage_params and emit::host, and keep library/host/draw/translate updates.
Resolve conflicts with view_marks (cd94d35) and hardware_adapter test updates (ccfb029): unify emit::Options with MeshMode, preserve view_marks in shader_cache VSH2 encoding and translate.rs, and wire view_marks root descriptors into both halves of EmulatedMeshPipeline and draw.rs bind_pipeline/bind_stage.
|
Automated triage for the maintainers. This pull request no longer merges cleanly into Generated by Claude Code |
Summary
Cards that support Shader Model 6.6 but report
D3D12_MESH_SHADER_TIER_NOT_SUPPORTED(Polaris/Vega/RDNA1, Pascal, Xe-LP, WARP, …) can now run mesh stages. Nothing is vendor-specific: the path is picked fromD3D12_FEATURE_SHADER_MODELandD3D12_OPTIONS7::MeshShaderTier, and can be forced withVICTORY_MESH_EMULATION=1(or disabled with=0).A mesh stage is lowered to a
cs_6_6that writes packed vertices and primitives into a shared UAV, followed by a generatedvs_6_6that reads them back bySV_VertexIDand drawn as a plain triangle list.victory-shader
MeshMode::Emulate:HwStage::Mslowers to[numthreads(n,1,1)]cs_6_6with LDS instead ofms_6_6. Emulation resources live inspace 2(MESH_EMU_SPACE):u0intermediateRWByteAddressBuffer,b0base_group/INDIRECT_SLOT_MAP_FLAG,t0slot map / unpack input.emit_indices_emuwrites packed indices and the cull flag; vertex (OSG1) and per-primitive (PSG1) outputs are stored as contiguous 4-dword groups.Input::MeshGroupreadsbase_group + local_group, orslot_map[local_group]for indirect dispatches.unpack_vertex_shaderbuilds thevs_6_6container: culled primitives get a quiet-NaNSV_Position, and the PS input signature /PSV0linkage (incl.nointerpolationper-primitive data and depth-only passes) is preserved.victory-gpu
MeshSupport::{Native, Emulate, Unsupported}detection inhost.rs.mesh_emu.rs: shared VRAM intermediate buffer (VICTORY_MESH_BUFFER_MB, default 128 MiB with a 16 MiB fallback), slot map, indirect args, and acs_5_1prep pass that sums/clamps group counts acrossExecuteIndirect(MESH)records and builds the slot map.EmulatedMeshPipeline: cached CS + cached VS/PS graphics PSO pair.draw.rs:dispatch_mesh_emulatedchunks directDispatchMeshbygroup_cap(CS → UAV→SRV barrier →DrawInstanced→ SRV→UAV);execute_indirect_mesh_emulateddoes clamp → prep → indirect dispatch → indirect draw. Topology and root/pipeline cache state are restored afterwards.VSH2with a separateshader.dxil.mesh-emuconverter key.CLI / docs
apps/victory translatepicksMeshMode::Emulatewhen forced or when the device lacks mesh shaders, validates both the CS and the unpack VS, and test-builds the pipelines.docs/architecture.mddocument the path and env vars.Testing
cargo clippy --workspace --all-targets --locked -- -D warnings✅cargo clippy --workspace --all-targets --all-features --locked -- -D warnings✅cargo test --workspace --locked✅cargo test -p victory-shader mesh_emu: 5 passed — triangle draws on a hardware GPU and WARP, bit-31 and unexported-primitive culling,base_group/ slot-map indexing,PSG1per-primitivenointerpolation, LDS +s_barrier+ds_swizzle_b32.cargo test -p victory-gpu mesh_emu: indirect prep shader builds and runs on GPU.cargo xtask policy✅Note:
dxil.dllwasn't available locally, so static validation was skipped; PSO creation and execution were verified on real hardware and WARP. The full in-gamedraw.rsflow wasn't exercised since game files aren't in the repo.