| ... | @@ -1345,6 +1345,21 @@ pub const DeclGen = struct { | ... | @@ -1345,6 +1345,21 @@ pub const DeclGen = struct { |
| 1345 | } | 1345 | } |
| 1346 | unreachable; // TODO | 1346 | unreachable; // TODO |
| 1347 | }, | 1347 | }, |
| | 1348 | .Vector => { |
| | 1349 | // Although not 100% the same, Zig vectors map quite neatly to SPIR-V vectors (including many integer and float operations |
| | 1350 | // which work on them), so simply use those. |
| | 1351 | // Note: SPIR-V vectors only support bools, ints and floats, so pointer vectors need to be supported another way. |
| | 1352 | // "composite integers" (larger than the largest supported native type) can probably be represented by an array of vectors. |
| | 1353 | // TODO: The SPIR-V spec mentions that vector sizes may be quite restricted! look into which we can use, and whether OpTypeVector |
| | 1354 | // is adequate at all for this. |
| | 1355 | |
| | 1356 | // TODO: Properly verify sizes and child type. |
| | 1357 | |
| | 1358 | return try self.spv.resolve(.{ .vector_type = .{ |
| | 1359 | .component_type = try self.resolveType2(ty.elemType(), repr), |
| | 1360 | .component_count = @intCast(u32, ty.vectorLen()), |
| | 1361 | } }); |
| | 1362 | }, |
| 1348 | | 1363 | |
| 1349 | else => unreachable, // TODO | 1364 | else => unreachable, // TODO |
| 1350 | } | 1365 | } |