sysgpu: linux: fix spir-v generation in hardware test example (#1323)
This commit is contained in:
parent
d62650276f
commit
a350ae9ee9
1 changed files with 32 additions and 29 deletions
|
|
@ -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,19 +652,21 @@ 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 => {
|
.matrix => {
|
||||||
try spv.annotations_section.emit(.OpMemberDecorate, .{
|
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,
|
.structure_type = struct_type_id,
|
||||||
.member = 0,
|
.member = 0,
|
||||||
.decoration = .{ .MatrixStride = .{
|
.decoration = .{ .MatrixStride = .{
|
||||||
.matrix_stride = spv.getStride(inst.type, true),
|
.matrix_stride = spv.getStride(current_type, true),
|
||||||
} },
|
} },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
else => {},
|
else => {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue