initial commit
This commit is contained in:
20
example/main.zig
git.filemode.normal_file
20
example/main.zig
git.filemode.normal_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
10
example/shader.zig
git.filemode.normal_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 };
|
||||
}
|
||||
Reference in New Issue
Block a user