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