executionMode
Declare the mode entry point executes in.
Function parameters
Parameters
- entry_point:anytype
Type definitions in this namespace
Types
Forms the main linkage for `input` and `output` address spaces.
Functions
- location
- Forms the main linkage for `input` and `output` address spaces.
- binding
- Forms the main linkage for `input` and `output` address spaces.
- executionMode
- Declare the mode entry point executes in.
= @extern(*addrspace(.input) @Vector(4, f32), .{ .name = "position" })
Values
- position_in
- = @extern(*addrspace(.input) @Vector(4, f32), .{ .name = "position" })
- position_out
- = @extern(*addrspace(.output) @Vector(4, f32), .{ .name = "position" })
- point_size_in
- = @extern(*addrspace(.input) f32, .{ .name = "point_size" })
- point_size_out
- = @extern(*addrspace(.output) f32, .{ .name = "point_size" })
Source
Implementation
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),
);
},
}
}