spirv: make IdResultType and IdRef weak aliases of IdResult

Previously they were strong aliases, but as these types are used quite
intermittendly it resulted in a lot of toRef() calls. Removing them
improves readability a bit.
This commit is contained in:
Robin Voetter
2022-11-28 19:14:16 +01:00
parent 0c2526b18e
commit 700dee34d5
6 changed files with 73 additions and 95 deletions

View File

@@ -122,7 +122,7 @@ fn writeOperands(section: *Section, comptime Operands: type, operands: Operands)
pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand) void {
switch (Operand) {
spec.IdResultType, spec.IdResult, spec.IdRef => section.writeWord(operand.id),
spec.IdResult => section.writeWord(operand.id),
spec.LiteralInteger => section.writeWord(operand),
@@ -258,9 +258,7 @@ fn operandsSize(comptime Operands: type, operands: Operands) usize {
fn operandSize(comptime Operand: type, operand: Operand) usize {
return switch (Operand) {
spec.IdResultType,
spec.IdResult,
spec.IdRef,
spec.LiteralInteger,
spec.LiteralExtInstInteger,
=> 1,
@@ -382,7 +380,9 @@ test "SPIR-V Section emit() - string" {
}, section.instructions.items);
}
test "SPIR-V Section emit()- extended mask" {
test "SPIR-V Section emit() - extended mask" {
if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
var section = Section{};
defer section.deinit(std.testing.allocator);