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-10-28 13:44:12 -03:00
|
|
|
#include "sirit/sirit.h"
|
2018-08-26 05:01:31 -03:00
|
|
|
|
2020-08-01 01:50:01 -03:00
|
|
|
#include "stream.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) {
|
2020-08-01 01:50:01 -03:00
|
|
|
code->Reserve(5);
|
|
|
|
|
return *code << OpId{spv::Op::OpFunction, result_type} << function_control << function_type
|
|
|
|
|
<< EndOp{};
|
2018-08-26 05:01:31 -03:00
|
|
|
}
|
|
|
|
|
|
2020-08-01 01:50:01 -03:00
|
|
|
void Module::OpFunctionEnd() {
|
|
|
|
|
code->Reserve(1);
|
|
|
|
|
*code << spv::Op::OpFunctionEnd << EndOp{};
|
2019-03-11 03:26:21 -03:00
|
|
|
}
|
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) {
|
2020-08-01 01:50:01 -03:00
|
|
|
code->Reserve(4 + arguments.size());
|
|
|
|
|
return *code << OpId{spv::Op::OpFunctionCall, result_type} << function << arguments << EndOp{};
|
2018-11-01 01:54:10 -03:00
|
|
|
}
|
|
|
|
|
|
2018-08-26 05:01:31 -03:00
|
|
|
} // namespace Sirit
|