adding sandbox
This commit is contained in:
25
sandbox/main.zig
git.filemode.normal_file
25
sandbox/main.zig
git.filemode.normal_file
@@ -0,0 +1,25 @@
|
||||
const std = @import("std");
|
||||
const spv = @import("spv");
|
||||
|
||||
const shader_source = @embedFile("shader.spv");
|
||||
|
||||
pub fn main() !void {
|
||||
{
|
||||
var gpa: std.heap.DebugAllocator(.{}) = .init;
|
||||
defer _ = gpa.deinit();
|
||||
|
||||
const allocator = gpa.allocator();
|
||||
|
||||
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);
|
||||
|
||||
try rt.callEntryPoint(allocator, try rt.getEntryPointByName("main"));
|
||||
var output: [4]f32 = undefined;
|
||||
try rt.readOutput(f32, output[0..output.len], try rt.getResultByName("color"));
|
||||
std.log.info("Output: Vec4{any}", .{output});
|
||||
}
|
||||
std.log.info("Successfully executed", .{});
|
||||
}
|
||||
Reference in New Issue
Block a user