mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2024-12-23 04:32:04 +00:00
Add types
This commit is contained in:
parent
3adb45138b
commit
7580d729c6
2 changed files with 46 additions and 6 deletions
|
@ -105,6 +105,21 @@ public:
|
||||||
/// Returns type function.
|
/// Returns type function.
|
||||||
const Op* TypeFunction(const Op* return_type, const std::vector<const Op*>& arguments = {});
|
const Op* TypeFunction(const Op* return_type, const std::vector<const Op*>& arguments = {});
|
||||||
|
|
||||||
|
/// Returns type event.
|
||||||
|
const Op* TypeEvent();
|
||||||
|
|
||||||
|
/// Returns type device event.
|
||||||
|
const Op* TypeDeviceEvent();
|
||||||
|
|
||||||
|
/// Returns type reserve id.
|
||||||
|
const Op* TypeReserveId();
|
||||||
|
|
||||||
|
/// Returns type queue.
|
||||||
|
const Op* TypeQueue();
|
||||||
|
|
||||||
|
/// Returns type pipe.
|
||||||
|
const Op* TypePipe(spv::AccessQualifier access_qualifier);
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
|
|
||||||
/// Emits a function.
|
/// Emits a function.
|
||||||
|
|
|
@ -198,12 +198,37 @@ const Op* Module::TypePointer(spv::StorageClass storage_class, const Op* type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const Op* Module::TypeFunction(const Op* return_type, const std::vector<const Op*>& arguments) {
|
const Op* Module::TypeFunction(const Op* return_type, const std::vector<const Op*>& arguments) {
|
||||||
Op* type_func{new Op(spv::Op::OpTypeFunction, bound)};
|
Op* op{new Op(spv::Op::OpTypeFunction, bound)};
|
||||||
type_func->Add(return_type);
|
op->Add(return_type);
|
||||||
for (const Op* arg : arguments) {
|
op->Add(arguments);
|
||||||
type_func->Add(arg);
|
return AddDeclaration(op);
|
||||||
}
|
}
|
||||||
return AddDeclaration(type_func);
|
|
||||||
|
const Op* Module::TypeEvent() {
|
||||||
|
AddCapability(spv::Capability::Kernel);
|
||||||
|
return AddDeclaration(new Op(spv::Op::OpTypeEvent, bound));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Op* Module::TypeDeviceEvent() {
|
||||||
|
AddCapability(spv::Capability::DeviceEnqueue);
|
||||||
|
return AddDeclaration(new Op(spv::Op::OpTypeDeviceEvent, bound));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Op* Module::TypeReserveId() {
|
||||||
|
AddCapability(spv::Capability::Pipes);
|
||||||
|
return AddDeclaration(new Op(spv::Op::OpTypeReserveId, bound));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Op* Module::TypeQueue() {
|
||||||
|
AddCapability(spv::Capability::DeviceEnqueue);
|
||||||
|
return AddDeclaration(new Op(spv::Op::OpTypeQueue, bound));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Op* Module::TypePipe(spv::AccessQualifier access_qualifier) {
|
||||||
|
AddCapability(spv::Capability::Pipes);
|
||||||
|
Op* op{new Op(spv::Op::OpTypePipe, bound)};
|
||||||
|
op->Add(static_cast<u32>(access_qualifier);
|
||||||
|
return AddDeclaration(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Sirit
|
} // namespace Sirit
|
||||||
|
|
Loading…
Reference in a new issue