diff --git a/src/GpuRender.zig b/src/GpuRender.zig index 1f704ba..3f31ab8 100644 --- a/src/GpuRender.zig +++ b/src/GpuRender.zig @@ -4,6 +4,7 @@ const sv = @import("utils.zig").sv; const GpuAllocator = @import("GpuAllocator.zig"); const GpuBuffer = @import("GpuBuffer.zig"); const GpuDevice = @import("GpuDevice.zig"); +const GpuTextureFormat = @import("lib.zig").GpuTextureFormat; pub const Binding = struct { element_size: u32 = 0, @@ -12,7 +13,7 @@ pub const Binding = struct { pub const RenderDef = struct { bindings: []const Binding = &.{}, /// The surface texture format we are rendering to (e.g., BGRA8Unorm) - texture_format: c.WGPUTextureFormat, + texture_format: GpuTextureFormat, /// The names of the entry points inside your WGSL code vertex_entry: []const u8 = "vs_main", fragment_entry: []const u8 = "fs_main", @@ -40,7 +41,7 @@ pub fn init(device: GpuDevice, wgsl: []const u8, def: RenderDef) !@This() { }; const color_target = c.WGPUColorTargetState{ - .format = def.texture_format, + .format = @intCast(@intFromEnum(def.texture_format)), .blend = &blend, .writeMask = c.WGPUColorWriteMask_All, }; diff --git a/src/circle.zig b/src/circle.zig index fc537be..6d4d35d 100644 --- a/src/circle.zig +++ b/src/circle.zig @@ -21,7 +21,6 @@ pub fn main(init: std.process.Init) !void { const width: u32 = 512; const height: u32 = 512; - const render_format = c.WGPUTextureFormat_RGBA8Unorm; // 2. Load our Render Pipeline (Procedural Triangle Strip) const circle_rp = try GpuRender.init( @@ -29,7 +28,7 @@ pub fn main(init: std.process.Init) !void { @embedFile("shaders/circle.wgsl"), .{ .bindings = &.{}, - .texture_format = render_format, + .texture_format = .RGBA8Unorm, .topology = c.WGPUPrimitiveTopology_TriangleStrip, }, );