fixing recurrent panic
All checks were successful
Build / build (push) Successful in 2m14s
Test / build (push) Successful in 7m13s

This commit is contained in:
2026-01-27 22:55:02 +01:00
parent 1ad7b644c4
commit 57de432d0b
7 changed files with 639 additions and 304 deletions

View File

@@ -15,27 +15,27 @@ pub fn main() !void {
var module = try spv.Module.init(allocator, @ptrCast(@alignCast(shader_source)), .{});
defer module.deinit(allocator);
//var rt = try spv.Runtime.init(allocator, &module);
//defer rt.deinit(allocator);
var rt = try spv.Runtime.init(allocator, &module);
defer rt.deinit(allocator);
//const entry = try rt.getEntryPointByName("main");
//const color = try rt.getResultByName("color");
//const time = try rt.getResultByName("time");
//const pos = try rt.getResultByName("pos");
//const res = try rt.getResultByName("res");
const entry = try rt.getEntryPointByName("main");
const color = try rt.getResultByName("color");
const time = try rt.getResultByName("time");
const pos = try rt.getResultByName("pos");
const res = try rt.getResultByName("res");
//var output: [4]f32 = undefined;
var output: [4]f32 = undefined;
//try rt.writeInput(f32, &.{@as(f32, @floatFromInt(std.time.milliTimestamp()))}, time);
//try rt.writeInput(f32, &.{ 1250.0, 720.0 }, res);
//try rt.writeInput(f32, &.{ 0.0, 0.0 }, pos);
try rt.writeInput(f32, &.{@as(f32, @floatFromInt(std.time.milliTimestamp()))}, time);
try rt.writeInput(f32, &.{ 1250.0, 720.0 }, res);
try rt.writeInput(f32, &.{ 0.0, 0.0 }, pos);
//try rt.callEntryPoint(allocator, entry);
try rt.callEntryPoint(allocator, entry);
//try rt.readOutput(f32, output[0..output.len], color);
//std.log.info("Output: Vec4{any}", .{output});
try rt.readOutput(f32, output[0..output.len], color);
std.log.info("Output: Vec4{any}", .{output});
std.log.info("Total memory used: {d:.3} MB\n", .{@as(f32, @floatFromInt(gpa.total_requested_bytes)) / 1000.0});
std.log.info("\nTotal memory used: {d:.3} KB\n", .{@as(f32, @floatFromInt(gpa.total_requested_bytes)) / 1000.0});
}
std.log.info("Successfully executed", .{});
}