aboutsummaryrefslogtreecommitdiff
path: root/externals/sirit/src/instructions/annotation.cpp
blob: e3524bb83a1e5b5ecdfc077bf2d9bdb7adeae567 (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
/* 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 <span>

#include "sirit/sirit.h"

#include "stream.h"

namespace Sirit {

Id Module::Decorate(Id target, spv::Decoration decoration, std::span<const Literal> literals) {
    annotations->Reserve(3 + literals.size());
    return *annotations << spv::Op::OpDecorate << target << decoration << literals << EndOp{};
}

Id Module::MemberDecorate(Id structure_type, Literal member, spv::Decoration decoration,
                          std::span<const Literal> literals) {
    annotations->Reserve(4 + literals.size());
    return *annotations << spv::Op::OpMemberDecorate << structure_type << member << decoration
                        << literals << EndOp{};
}

} // namespace Sirit