adding result get from location
Build / build (push) Successful in 1m46s
Test / build (push) Successful in 7m49s

This commit is contained in:
2026-04-26 02:39:21 +02:00
parent ab34c3b49a
commit 147126c06f
3 changed files with 35 additions and 4 deletions
+16 -4
View File
@@ -99,7 +99,7 @@ pub fn addSpecializationInfo(self: *Self, allocator: std.mem.Allocator, entry: S
self.specialization_constants.put(allocator, entry.id, slice) catch return RuntimeError.OutOfMemory;
}
pub fn getEntryPointByName(self: *const Self, name: []const u8) error{NotFound}!SpvWord {
pub fn getEntryPointByName(self: *const Self, name: []const u8) RuntimeError!SpvWord {
for (self.mod.entry_points.items, 0..) |entry_point, i| {
if (blk: {
// Not using std.mem.eql as entry point names may have longer size than their content
@@ -112,10 +112,10 @@ pub fn getEntryPointByName(self: *const Self, name: []const u8) error{NotFound}!
break :blk true;
}) return @intCast(i);
}
return error.NotFound;
return RuntimeError.NotFound;
}
pub fn getResultByName(self: *const Self, name: []const u8) error{NotFound}!SpvWord {
pub fn getResultByName(self: *const Self, name: []const u8) RuntimeError!SpvWord {
for (self.results, 0..) |result, i| {
if (result.name) |result_name| {
if (blk: {
@@ -127,7 +127,19 @@ pub fn getResultByName(self: *const Self, name: []const u8) error{NotFound}!SpvW
}) return @intCast(i);
}
}
return error.NotFound;
return RuntimeError.NotFound;
}
pub fn getResultByLocation(self: *const Self, location: SpvWord, kind: enum { input, output }) RuntimeError!SpvWord {
switch (kind) {
.input => if (location < self.mod.input_locations.len) {
return self.mod.input_locations[location];
},
.output => if (location < self.mod.output_locations.len) {
return self.mod.output_locations[location];
},
}
return RuntimeError.NotFound;
}
pub fn dumpResultsTable(self: *Self, allocator: std.mem.Allocator, writer: *std.Io.Writer) RuntimeError!void {