aboutsummaryrefslogtreecommitdiff
path: root/externals/sirit/src/instructions/group.cpp
blob: b8532847a16bc52fdd27a316b73f3b472930c18c (plain) (blame)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* This file is part of the sirit project.
 * Copyright (c) 2019 sirit
 * This software may be used and distributed according to the terms of the
 * 3-Clause BSD License
 */

#include "sirit/sirit.h"

#include "stream.h"

namespace Sirit {

Id Module::OpSubgroupBallotKHR(Id result_type, Id predicate) {
    code->Reserve(4);
    return *code << OpId{spv::Op::OpSubgroupBallotKHR, result_type} << predicate << EndOp{};
}

Id Module::OpSubgroupReadInvocationKHR(Id result_type, Id value, Id index) {
    code->Reserve(5);
    return *code << OpId{spv::Op::OpSubgroupReadInvocationKHR, result_type} << value << index
                 << EndOp{};
}

Id Module::OpSubgroupAllKHR(Id result_type, Id predicate) {
    code->Reserve(4);
    return *code << OpId{spv::Op::OpSubgroupAllKHR, result_type} << predicate << EndOp{};
}

Id Module::OpSubgroupAnyKHR(Id result_type, Id predicate) {
    code->Reserve(4);
    return *code << OpId{spv::Op::OpSubgroupAnyKHR, result_type} << predicate << EndOp{};
}

Id Module::OpSubgroupAllEqualKHR(Id result_type, Id predicate) {
    code->Reserve(4);
    return *code << OpId{spv::Op::OpSubgroupAllEqualKHR, result_type} << predicate << EndOp{};
}

Id Module::OpGroupNonUniformElect(Id result_type, Id scope) {
    code->Reserve(4);
    return *code << OpId{spv::Op::OpGroupNonUniformElect, result_type} << scope << EndOp{};
}

Id Module::OpGroupNonUniformBroadcastFirst(Id result_type, Id scope, Id value) {
    code->Reserve(5);
    return *code << OpId{spv::Op::OpGroupNonUniformBroadcastFirst, result_type} << scope << value
                 << EndOp{};
}

Id Module::OpGroupNonUniformBroadcast(Id result_type, Id scope, Id value, Id id) {
    code->Reserve(6);
    return *code << OpId{spv::Op::OpGroupNonUniformBroadcast, result_type} << scope << value
                 << id << EndOp{};
}

Id Module::OpGroupNonUniformShuffle(Id result_type, Id scope, Id value, Id id) {
    code->Reserve(6);
    return *code << OpId{spv::Op::OpGroupNonUniformShuffle, result_type} << scope << value << id
                  << EndOp{};
}

Id Module::OpGroupNonUniformShuffleXor(Id result_type, Id scope, Id value, Id mask) {
    code->Reserve(6);
    return *code << OpId{spv::Op::OpGroupNonUniformShuffleXor, result_type} << scope << value
                 << mask << EndOp{};
}

Id Module::OpGroupNonUniformAll(Id result_type, Id scope, Id predicate) {
   code->Reserve(5);
   return *code << OpId{spv::Op::OpGroupNonUniformAll, result_type} << scope << predicate << EndOp{};
}

Id Module::OpGroupNonUniformAny(Id result_type, Id scope, Id predicate) {
   code->Reserve(5);
   return *code << OpId{spv::Op::OpGroupNonUniformAny, result_type} << scope << predicate << EndOp{};
}

Id Module::OpGroupNonUniformAllEqual(Id result_type, Id scope, Id value) {
   code->Reserve(5);
   return *code << OpId{spv::Op::OpGroupNonUniformAllEqual, result_type} << scope << value << EndOp{};
}

Id Module::OpGroupNonUniformBallot(Id result_type, Id scope, Id predicate) {
   code->Reserve(5);
   return *code << OpId{spv::Op::OpGroupNonUniformBallot, result_type} << scope << predicate << EndOp{};
}

} // namespace Sirit