2018-08-27 00:35:48 +02: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-08-27 04:28:39 +02:00
|
|
|
* Lesser General Public License version 2.1 or any later version.
|
2018-08-27 00:35:48 +02:00
|
|
|
*/
|
|
|
|
|
|
2018-08-28 09:05:47 +02:00
|
|
|
#include "insts.h"
|
2018-10-28 17:44:12 +01:00
|
|
|
#include "sirit/sirit.h"
|
|
|
|
|
#include <cassert>
|
2018-08-27 00:35:48 +02:00
|
|
|
|
|
|
|
|
namespace Sirit {
|
|
|
|
|
|
2018-11-01 01:22:00 +01:00
|
|
|
Ref Module::OpConstantTrue(Ref result_type) {
|
2018-08-27 00:35:48 +02:00
|
|
|
return AddDeclaration(new Op(spv::Op::OpConstantTrue, bound, result_type));
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-01 01:22:00 +01:00
|
|
|
Ref Module::OpConstantFalse(Ref result_type) {
|
2018-08-27 00:35:48 +02:00
|
|
|
return AddDeclaration(new Op(spv::Op::OpConstantFalse, bound, result_type));
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-01 01:22:00 +01:00
|
|
|
Ref Module::OpConstant(Ref result_type, const Literal& literal) {
|
2018-10-23 10:05:40 +02:00
|
|
|
auto op{new Op(spv::Op::OpConstant, bound, result_type)};
|
2018-08-27 05:29:40 +02:00
|
|
|
op->Add(literal);
|
|
|
|
|
return AddDeclaration(op);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-01 01:22:00 +01:00
|
|
|
Ref Module::OpConstantComposite(Ref result_type,
|
|
|
|
|
const std::vector<Ref>& constituents) {
|
2018-10-23 10:05:40 +02:00
|
|
|
auto op{new Op(spv::Op::OpConstantComposite, bound, result_type)};
|
2018-08-27 05:38:25 +02:00
|
|
|
op->Add(constituents);
|
|
|
|
|
return AddDeclaration(op);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-01 01:22:00 +01:00
|
|
|
Ref Module::OpConstantSampler(Ref result_type,
|
|
|
|
|
spv::SamplerAddressingMode addressing_mode,
|
|
|
|
|
bool normalized,
|
|
|
|
|
spv::SamplerFilterMode filter_mode) {
|
2018-08-28 09:41:42 +02:00
|
|
|
AddCapability(spv::Capability::LiteralSampler);
|
|
|
|
|
AddCapability(spv::Capability::Kernel);
|
2018-10-23 10:05:40 +02:00
|
|
|
auto op{new Op(spv::Op::OpConstantSampler, bound, result_type)};
|
2018-08-28 09:41:42 +02:00
|
|
|
AddEnum(op, addressing_mode);
|
|
|
|
|
op->Add(normalized ? 1 : 0);
|
|
|
|
|
AddEnum(op, filter_mode);
|
|
|
|
|
return AddDeclaration(op);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-01 01:22:00 +01:00
|
|
|
Ref Module::OpConstantNull(Ref result_type) {
|
2018-08-28 09:46:18 +02:00
|
|
|
return AddDeclaration(new Op(spv::Op::OpConstantNull, bound, result_type));
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-27 00:35:48 +02:00
|
|
|
} // namespace Sirit
|