Skip to content

Commit 96b6dba

Browse files
spirv: enhance assembler to support OpTypeArray
1 parent a230da2 commit 96b6dba

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/codegen/spirv/Assembler.zig

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,18 @@ fn processTypeInstruction(self: *Assembler) !AsmValue {
381381
const child_type = try self.resolveRefId(operands[1].ref_id);
382382
break :blk try self.spv.vectorType(operands[2].literal32, child_type);
383383
},
384-
.OpTypeArray => {
384+
.OpTypeArray => blk: {
385385
// TODO: The length of an OpTypeArray is determined by a constant (which may be a spec constant),
386386
// and so some consideration must be taken when entering this in the type system.
387-
return self.todo("process OpTypeArray", .{});
387+
const element_type = try self.resolveRefId(operands[1].ref_id);
388+
const length = try self.resolveRefId(operands[2].ref_id);
389+
const result_id = self.spv.allocId();
390+
try section.emit(self.spv.gpa, .OpTypeArray, .{
391+
.id_result = result_id,
392+
.element_type = element_type,
393+
.length = length,
394+
});
395+
break :blk result_id;
388396
},
389397
.OpTypeRuntimeArray => blk: {
390398
const element_type = try self.resolveRefId(operands[1].ref_id);

0 commit comments

Comments
 (0)