authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2023-05-29 17:44:51+02:00
committergravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2023-05-30 19:43:37+02:00
log05f1392d8bd1e5dc2e05bf21ba64111b02fdc51e
tree06011defef1e7db64b3f8e451bec5b7015580343
parentf13a6ee19edb756977e7ef83aa7a7d9b155427eb
signaturelock-open Commit is signed but in an unrecognized format.

spirv: translate vectors to cache key


1 files changed, 15 insertions(+), 0 deletions(-)

src/codegen/spirv.zig+15
...@@ -1345,6 +1345,21 @@ pub const DeclGen = struct {...@@ -1345,6 +1345,21 @@ pub const DeclGen = struct {
1345 }1345 }
1346 unreachable; // TODO1346 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 },
13481363
1349 else => unreachable, // TODO1364 else => unreachable, // TODO
1350 }1365 }