2018-08-26 05:01:31 -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-08-26 05:01:31 -03:00
|
|
|
*/
|
|
|
|
|
|
2018-11-01 00:02:45 -03:00
|
|
|
#include "common_types.h"
|
|
|
|
|
#include "op.h"
|
2018-10-28 13:44:12 -03:00
|
|
|
#include "sirit/sirit.h"
|
2018-08-26 05:01:31 -03:00
|
|
|
|
|
|
|
|
namespace Sirit {
|
|
|
|
|
|
2019-03-11 03:26:21 -03:00
|
|
|
Id Module::OpFunction(Id result_type, spv::FunctionControlMask function_control, Id function_type) {
|
2018-11-01 00:02:45 -03:00
|
|
|
auto op{std::make_unique<Op>(spv::Op::OpFunction, bound++, result_type)};
|
2018-08-26 05:01:31 -03:00
|
|
|
op->Add(static_cast<u32>(function_control));
|
|
|
|
|
op->Add(function_type);
|
2018-11-01 00:02:45 -03:00
|
|
|
return AddCode(std::move(op));
|
2018-08-26 05:01:31 -03:00
|
|
|
}
|
|
|
|
|
|
2019-03-11 03:26:21 -03:00
|
|
|
Id Module::OpFunctionEnd() {
|
|
|
|
|
return AddCode(spv::Op::OpFunctionEnd);
|
|
|
|
|
}
|
2018-08-26 05:01:31 -03:00
|
|
|
|
2020-07-29 05:46:50 -03:00
|
|
|
Id Module::OpFunctionCall(Id result_type, Id function, std::span<const Id> arguments) {
|
2019-03-11 03:26:21 -03:00
|
|
|
auto op{std::make_unique<Op>(spv::Op::OpFunctionCall, bound++, result_type)};
|
2018-11-01 01:54:10 -03:00
|
|
|
op->Add(function);
|
|
|
|
|
op->Add(arguments);
|
|
|
|
|
return AddCode(std::move(op));
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-26 05:01:31 -03:00
|
|
|
} // namespace Sirit
|