2018-10-23 04:45:56 -03:00
|
|
|
/* This file is part of the sirit project.
|
|
|
|
|
* Copyright (c) 2018 ReinUsesLisp
|
|
|
|
|
* This software may be used and distributed according to the terms of the GNU
|
2018-11-16 04:10:10 -03:00
|
|
|
* Lesser General Public License version 3 or any later version.
|
2018-10-23 04:45:56 -03:00
|
|
|
*/
|
|
|
|
|
|
2018-11-01 00:02:45 -03:00
|
|
|
#include "common_types.h"
|
|
|
|
|
#include "op.h"
|
2018-10-23 04:45:56 -03:00
|
|
|
#include "sirit/sirit.h"
|
2018-11-01 00:02:45 -03:00
|
|
|
#include <memory>
|
|
|
|
|
#include <vector>
|
2018-10-23 04:45:56 -03:00
|
|
|
|
|
|
|
|
namespace Sirit {
|
|
|
|
|
|
2018-10-31 22:20:49 -03:00
|
|
|
Id Module::Decorate(Id target, spv::Decoration decoration,
|
2018-11-01 00:02:45 -03:00
|
|
|
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);
|
2018-11-01 00:02:45 -03:00
|
|
|
op->Add(static_cast<u32>(decoration));
|
2018-10-28 13:44:12 -03:00
|
|
|
op->Add(literals);
|
2018-11-06 04:47:40 -03:00
|
|
|
AddAnnotation(std::move(op));
|
|
|
|
|
return target;
|
2018-10-23 04:45:56 -03:00
|
|
|
}
|
|
|
|
|
|
2018-10-31 22:20:49 -03:00
|
|
|
Id Module::MemberDecorate(Id structure_type, Literal member,
|
2018-11-01 00:02:45 -03:00
|
|
|
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);
|
2018-10-28 13:44:12 -03:00
|
|
|
op->Add(member);
|
2018-11-01 00:02:45 -03:00
|
|
|
op->Add(static_cast<u32>(decoration));
|
2018-10-28 13:44:12 -03:00
|
|
|
op->Add(literals);
|
2018-11-06 04:47:40 -03:00
|
|
|
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
|