GpuRender now take a GpuTextureFormat and not a c.WGPUTextureFormat
This commit is contained in:
parent
32f5d2b828
commit
bcb1b1e98b
@ -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,
|
||||
};
|
||||
|
||||
@ -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,
|
||||
},
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user