tombox-xshader: GS output stream != 0 rejected #104

Open
opened 2026-11-26 06:10:33 +00:00 by github-bot · 1 comment
Owner

@⁠Trwthh on GitHub · 2026-11-22 09:16 UTC · original

Component: crates/tombox-xshader/src/hlsl.rs

What happens: The EXP handler at line 5203-5204 rejects geometry shader exports with stream != 0:

if stream != 0 {
    return Err("GS output stream != 0 unsupported".into());
}

Impact: Games using multi-stream geometry shaders (stream-out for particle systems, shadow volume extrusion, GPU-driven culling feedback) will fail shader translation. The RDNA2 EXP instruction encodes the stream index in bits [25:26], and GS shaders can emit to up to 4 output streams.

ISA reference: RDNA2 ISA manual, section 12.1 (EXP), stream field.

Suggested fix: Map each stream to a separate SV_RenderTargetArrayIndex output or use D3D12 stream-output declarations. The HLSL [maxvertexcount] and stream append semantics need to route each stream index to the correct OutputStream<T>.

**@⁠Trwthh** on GitHub · 2026-11-22 09:16 UTC · [original](https://github.com/omonkeyz/xbox-emulator/issues/104) **Component:** `crates/tombox-xshader/src/hlsl.rs` **What happens:** The EXP handler at line 5203-5204 rejects geometry shader exports with stream != 0: ```rust if stream != 0 { return Err("GS output stream != 0 unsupported".into()); } ``` **Impact:** Games using multi-stream geometry shaders (stream-out for particle systems, shadow volume extrusion, GPU-driven culling feedback) will fail shader translation. The RDNA2 EXP instruction encodes the stream index in bits [25:26], and GS shaders can emit to up to 4 output streams. **ISA reference:** RDNA2 ISA manual, section 12.1 (EXP), stream field. **Suggested fix:** Map each stream to a separate `SV_RenderTargetArrayIndex` output or use D3D12 stream-output declarations. The HLSL `[maxvertexcount]` and stream append semantics need to route each stream index to the correct `OutputStream<T>`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:10:33 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-22 14:05 UTC · original

Confirmed as a gap, but the stream index comes from the s_sendmsg GS message (imm bits [9:8]) in emit_sendmsg, not from EXP. Streams 1-3 only feed stream-out, and the D3D12 layer has no stream-out path yet, so mapping them to SV_RenderTargetArrayIndex would be wrong. Until stream-out exists (PSO StreamOutput translation plus per-stream PointStream outputs), the translator keeps the explicit error rather than dropping those emits. The only GS among the 3515 cached title shaders uses stream 0. Tracked in docs/BLOCKERS.md (d585b945). Leaving this open for the stream-out work.

**@⁠omonkeyz** on GitHub · 2026-11-22 14:05 UTC · [original](https://github.com/omonkeyz/xbox-emulator/issues/104#issuecomment-7080283380) Confirmed as a gap, but the stream index comes from the s_sendmsg GS message (imm bits [9:8]) in emit_sendmsg, not from EXP. Streams 1-3 only feed stream-out, and the D3D12 layer has no stream-out path yet, so mapping them to SV_RenderTargetArrayIndex would be wrong. Until stream-out exists (PSO StreamOutput translation plus per-stream PointStream outputs), the translator keeps the explicit error rather than dropping those emits. The only GS among the 3515 cached title shaders uses stream 0. Tracked in docs/BLOCKERS.md (d585b945). Leaving this open for the stream-out work.
This discussion has been locked. Commenting is limited to contributors.
No description provided.