Function executionMode [src]

Declare the mode entry point executes in.

Prototype

pub fn executionMode(comptime entry_point: anytype, comptime mode: ExecutionMode) void

Parameters

mode: ExecutionMode

Source

pub fn executionMode(comptime entry_point: anytype, comptime mode: ExecutionMode) void { const cc = @typeInfo(@TypeOf(entry_point)).@"fn".calling_convention; switch (mode) { .origin_upper_left, .origin_lower_left, .depth_replacing, .depth_greater, .depth_less, .depth_unchanged, => { if (cc != .spirv_fragment) { @compileError( \\invalid execution mode ' ++ @tagName(mode) ++ \\' for function with ' ++ @tagName(cc) ++ \\' calling convention ); } asm volatile ( \\OpExecutionMode %entry_point $mode : : [entry_point] "" (entry_point), [mode] "c" (@intFromEnum(mode)), ); }, .local_size => |size| { if (cc != .spirv_kernel) { @compileError( \\invalid execution mode 'local_size' for function with ' ++ @tagName(cc) ++ \\' calling convention ); } asm volatile ( \\OpExecutionMode %entry_point LocalSize $x $y $z : : [entry_point] "" (entry_point), [x] "c" (size.x), [y] "c" (size.y), [z] "c" (size.z), ); }, } }