initial commit

This commit is contained in:
2025-12-22 23:04:20 +01:00
parent 5821a7f929
commit 977d05f15d
13 changed files with 320 additions and 0 deletions

20
example/main.zig git.filemode.normal_file
View File

@@ -0,0 +1,20 @@
const std = @import("std");
const spv = @import("spv");
const shader_source = @embedFile("shader");
pub fn main() !void {
{
var gpa: std.heap.DebugAllocator(.{}) = .init;
defer _ = gpa.deinit();
const allocator = gpa.allocator();
const ctx = try spv.Interpreter.init();
defer ctx.deinit();
const module = try spv.Module.init(allocator, &ctx, @ptrCast(@alignCast(shader_source)));
defer module.deinit(allocator);
}
std.log.info("Successfully executed", .{});
}

10
example/shader.zig git.filemode.normal_file
View File

@@ -0,0 +1,10 @@
const std = @import("std");
const gpu = std.gpu;
extern var frag_color: @Vector(4, f32) addrspace(.output);
export fn main() callconv(.spirv_fragment) void {
gpu.location(&frag_color, 0);
frag_color = .{ 1.0, 1.0, 1.0, 1.0 };
}