sysgpu: linux: fix spir-v generation in hardware test example (#1323)

This commit is contained in:
Aeden McClain 2024-12-29 10:54:05 -08:00 committed by GitHub
parent d62650276f
commit a350ae9ee9
Failed to generate hash of commit

View file

@ -625,7 +625,7 @@ fn emitVarProto(spv: *SpirV, section: *Section, inst_idx: InstIndex) !IdRef {
break :sti struct_type_id;
} else type_id;
if (spv.decorated.get(type_id) == null) {
if (spv.decorated.get(struct_type_id) == null) {
try spv.annotations_section.emit(.OpDecorate, .{
.target = struct_type_id,
.decoration = .Block,
@ -652,19 +652,21 @@ fn emitVarProto(spv: *SpirV, section: *Section, inst_idx: InstIndex) !IdRef {
.decoration = .{ .Offset = .{ .byte_offset = 0 } },
});
switch (spv.air.getInst(inst.type)) {
.array => {
const arr_ty = spv.air.getInst(inst.type).array;
sw: switch (inst.type) {
else => |current_type| switch (spv.air.getInst(current_type)) {
.array => |arr_ty| {
if (spv.air.getInst(arr_ty.elem_type) == .@"struct") {
try spv.decorateStruct(arr_ty.elem_type);
}
if (spv.decorated.get(type_id) == null) {
try spv.annotations_section.emit(.OpDecorate, .{
.target = type_id,
.decoration = .{ .ArrayStride = .{
.array_stride = spv.getStride(inst.type, true),
.array_stride = spv.getStride(current_type, true),
} },
});
}
continue :sw arr_ty.elem_type;
},
.matrix => {
try spv.annotations_section.emit(.OpMemberDecorate, .{
@ -676,11 +678,12 @@ fn emitVarProto(spv: *SpirV, section: *Section, inst_idx: InstIndex) !IdRef {
.structure_type = struct_type_id,
.member = 0,
.decoration = .{ .MatrixStride = .{
.matrix_stride = spv.getStride(inst.type, true),
.matrix_stride = spv.getStride(current_type, true),
} },
});
},
else => {},
},
}
}