mirror of
https://github.com/yuzu-emu/sirit.git
synced 2024-12-22 14:35:29 +00:00
sirit: Add TypeSInt/TypeUInt helpers
Provides shorthands for specific signedness, so that usage code doesn't need to explicitly use raw booleans. TypeUInt(32), is easier to gloss than TypeInt(32, false), especially for those not familiar with the API.
This commit is contained in:
parent
a39596358a
commit
8cfe8badf7
|
@ -125,6 +125,12 @@ public:
|
|||
/// Returns type integer.
|
||||
Id TypeInt(int width, bool is_signed);
|
||||
|
||||
/// Returns type signed integer.
|
||||
Id TypeSInt(int width);
|
||||
|
||||
/// Returns type unsigned integer.
|
||||
Id TypeUInt(int width);
|
||||
|
||||
/// Returns type float.
|
||||
Id TypeFloat(int width);
|
||||
|
||||
|
|
|
@ -28,6 +28,14 @@ Id Module::TypeInt(int width, bool is_signed) {
|
|||
return *declarations << OpId{spv::Op::OpTypeInt} << width << is_signed << EndOp{};
|
||||
}
|
||||
|
||||
Id Module::TypeSInt(int width) {
|
||||
return TypeInt(width, true);
|
||||
}
|
||||
|
||||
Id Module::TypeUInt(int width) {
|
||||
return TypeInt(width, false);
|
||||
}
|
||||
|
||||
Id Module::TypeFloat(int width) {
|
||||
declarations->Reserve(3);
|
||||
return *declarations << OpId{spv::Op::OpTypeFloat} << width << EndOp{};
|
||||
|
|
Loading…
Reference in a new issue