OUT : Output Token

Format:

SPA 5.0:
        {@{!}Pg}   OUT.type   Rd,Ra,Sb   {&req_6}   {&rdN}   {&wrN}   {?sched}   ;   

       .type:  { .EMIT, .CUT, .EMIT_THEN_CUT, INVALID } 
               .EMIT:
                   Finalizes currently emitting vertex. The vertex is sent to the stream
                   indexed by the lower two bits of Sb.
               .CUT:
                   Ends current output strip at last emitted vertex. If current output
                   primitive is incomplete (due to insufficient vertex count) the primitive
                   is discarded.
               .EMIT_THEN_CUT:
                   Finalizes currently emitting vertex, then ends current output strip.
                   If current output primitive is incomplete (due to insufficient vertex
                   count) the primitive is discarded.
       


The following source Sb is allowed:
    Sb(register)
    Sb(#IMM20)

Description:

Geometry shader output token. For regular geometry shader, allows completion of currently emitting vertex, and restart of output strip. For fast geometry shader, treated as NOP.

The state machine register Ra gets updated by the OUT instruction, and written back to Rd. The state machine register must be initialized to 0 by the program at the start of the geometry shader. The shader program should not attempt to change the contents of the state machine register as it is deemed an opaque value.

Note that if the GS register has become corrupted and an error is raised, Rd will not be updated. This error will only occur if something other than the OUT instruction has been manipulating the state machine register and has not been doing it properly.

IMPORTANT: When a regular (non-fast) GS program terminates, the SM hw will auto-generate a final OUT instruction that will source R0 as the final state machine. This final OUT instruction will not emit a vertex, and only exists to mark where the shader stopped writing to its declared output buffer. Any GS program must have R0 up-to-date with the current state machine whenever the thread can possibly terminate. If this is not done, GS output will be corrupted/lost. It is strongly recommended that all GS programs just reserve R0 as the state machine register. If OUT encounters a corrupted register, it will leave the register as is and signal an optional trap. If AST encounters a corrupted state machine register, the ISBE write will be suppressed and an optional trap will be raised. For fast geometry shaders, no final OUT instruction is generated and it's not necessary to keep any special value in R0

The state machine register must be sourced by AST for Geometry Shaders.

SM hw will prevent a bad state machine register from causing writes outside the valid ISBE boundary.

Source Sb contains an index to a stream, and is only used with OUT.EMIT and OUT.EMIT_THEN_CUT. For OUT.CUT operations, Sb must be Rz. Only the lower 2 bits of Sb will be used to direct the vertex to one of the 4 streams, the upper 30 bits are ignored.

If the stream index changes between OUT.EMIT instructions, the HW will automatically insert a CUT at the transition point. Even if one of the stream indices that a vertex is sent to is disabled, the change in stream index will still be treated like a CUT.

Examples:

OUT.EMIT R0,R0,0x1;
OUT.CUT  R0,R0,RZ;

back to Index of Instructions