1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
#[cfg(target_arch = "spirv")]
use core::arch::asm;
/// Emits the current values of all output variables to the current output
/// primitive. After execution, the values of all output variables
/// are undefined. Requires capability `Geometry`.
///
/// # Safety
/// This instruction must only be used when only one stream is present.
#[spirv_std_macros::gpu_only]
#[doc(alias = "OpEmitVertex")]
#[inline]
pub unsafe fn emit_vertex() {
asm! {
"OpEmitVertex",
}
}
/// Finish the current primitive and start a new one. No vertex is emitted.
/// Requires capability `Geometry`.
///
/// # Safety
/// This instruction must only be used when only one stream is present.
#[spirv_std_macros::gpu_only]
#[doc(alias = "OpEndPrimitive")]
#[inline]
pub unsafe fn end_primitive() {
asm! {
"OpEndPrimitive",
}
}
/// Emits the current values of all output variables to the current output
/// primitive. After execution, the values of all output variables
/// are undefined.
///
/// `STREAM` is the output-primitive stream number.
///
/// Requires capability `GeometryStreams`.
///
/// # Safety
/// This instruction must only be used when multiple streams are present.
#[spirv_std_macros::gpu_only]
#[doc(alias = "OpEmitStreamVertex")]
#[inline]
pub unsafe fn emit_stream_vertex<const STREAM: i64>() {
asm! {
"%i64 = OpTypeInt 64 1",
"%stream = OpConstant %i64 {stream}",
"OpEmitStreamVertex %stream",
stream = const STREAM,
}
}
/// Finish the current primitive and start a new one. No vertex is emitted.
///
/// `STREAM` is the output-primitive stream number.
///
/// Requires capability `GeometryStreams`.
///
/// # Safety
/// This instruction must only be used when multiple streams are present.
#[spirv_std_macros::gpu_only]
#[doc(alias = "OpEndStreamPrimitive")]
#[inline]
pub unsafe fn end_stream_primitive<const STREAM: i64>() {
asm! {
"%i64 = OpTypeInt 64 1",
"%stream = OpConstant %i64 {stream}",
"OpEndStreamPrimitive %stream",
stream = const STREAM,
}
}