Files
sirit/src/instructions/annotation.cpp

36 lines
1014 B
C++
Raw Normal View History

2018-10-23 04:45:56 -03:00
/* This file is part of the sirit project.
2019-07-14 18:48:59 -03:00
* Copyright (c) 2019 sirit
* This software may be used and distributed according to the terms of the
* 3-Clause BSD License
2018-10-23 04:45:56 -03:00
*/
2019-03-11 03:26:21 -03:00
#include <memory>
#include <vector>
#include "common_types.h"
#include "op.h"
2018-10-23 04:45:56 -03:00
#include "sirit/sirit.h"
namespace Sirit {
2019-03-11 03:26:21 -03:00
Id Module::Decorate(Id target, spv::Decoration decoration, const std::vector<Literal>& literals) {
auto op{std::make_unique<Op>(spv::Op::OpDecorate)};
2018-10-23 04:45:56 -03:00
op->Add(target);
op->Add(static_cast<u32>(decoration));
op->Add(literals);
AddAnnotation(std::move(op));
return target;
2018-10-23 04:45:56 -03:00
}
2019-03-11 03:26:21 -03:00
Id Module::MemberDecorate(Id structure_type, Literal member, spv::Decoration decoration,
const std::vector<Literal>& literals) {
auto op{std::make_unique<Op>(spv::Op::OpMemberDecorate)};
2018-10-28 05:38:10 -03:00
op->Add(structure_type);
op->Add(member);
op->Add(static_cast<u32>(decoration));
op->Add(literals);
AddAnnotation(std::move(op));
return structure_type;
2018-10-28 05:38:10 -03:00
}
2018-10-23 04:45:56 -03:00
} // namespace Sirit