gpu: cleanup example TODOs
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
6c7ea283fe
commit
d8c48bdad1
1 changed files with 12 additions and 12 deletions
|
|
@ -7,15 +7,16 @@ const objc = @cImport({
|
||||||
@cInclude("objc/message.h");
|
@cInclude("objc/message.h");
|
||||||
});
|
});
|
||||||
|
|
||||||
fn printDeviceError(error_type: c.WGPUErrorType, message: [*c]const u8, _: ?*anyopaque) callconv(.C) void {
|
// TODO: Make gpu.Device implement wgpuDeviceSetUncapturedErrorCallback
|
||||||
switch (error_type) {
|
// fn printDeviceError(error_type: c.WGPUErrorType, message: [*c]const u8, _: ?*anyopaque) callconv(.C) void {
|
||||||
c.WGPUErrorType_Validation => std.debug.print("dawn: validation error: {s}\n", .{message}),
|
// switch (error_type) {
|
||||||
c.WGPUErrorType_OutOfMemory => std.debug.print("dawn: out of memory: {s}\n", .{message}),
|
// c.WGPUErrorType_Validation => std.debug.print("dawn: validation error: {s}\n", .{message}),
|
||||||
c.WGPUErrorType_Unknown => std.debug.print("dawn: unknown error: {s}\n", .{message}),
|
// c.WGPUErrorType_OutOfMemory => std.debug.print("dawn: out of memory: {s}\n", .{message}),
|
||||||
c.WGPUErrorType_DeviceLost => std.debug.print("dawn: device lost: {s}\n", .{message}),
|
// c.WGPUErrorType_Unknown => std.debug.print("dawn: unknown error: {s}\n", .{message}),
|
||||||
else => unreachable,
|
// c.WGPUErrorType_DeviceLost => std.debug.print("dawn: device lost: {s}\n", .{message}),
|
||||||
}
|
// else => unreachable,
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
const Setup = struct {
|
const Setup = struct {
|
||||||
native_instance: gpu.NativeInstance,
|
native_instance: gpu.NativeInstance,
|
||||||
|
|
@ -62,11 +63,10 @@ pub fn setup(allocator: std.mem.Allocator) !Setup {
|
||||||
hints.cocoa_retina_framebuffer = false;
|
hints.cocoa_retina_framebuffer = false;
|
||||||
const window = try glfw.Window.create(640, 480, "Dawn window", null, null, hints);
|
const window = try glfw.Window.create(640, 480, "Dawn window", null, null, hints);
|
||||||
|
|
||||||
const instance = c.machDawnNativeInstance_init();
|
|
||||||
|
|
||||||
const backend_procs = c.machDawnNativeGetProcs();
|
const backend_procs = c.machDawnNativeGetProcs();
|
||||||
c.dawnProcSetProcs(backend_procs);
|
c.dawnProcSetProcs(backend_procs);
|
||||||
|
|
||||||
|
const instance = c.machDawnNativeInstance_init();
|
||||||
var native_instance = gpu.NativeInstance.wrap(c.machDawnNativeInstance_get(instance).?);
|
var native_instance = gpu.NativeInstance.wrap(c.machDawnNativeInstance_get(instance).?);
|
||||||
const gpu_interface = native_instance.interface();
|
const gpu_interface = native_instance.interface();
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ pub fn setup(allocator: std.mem.Allocator) !Setup {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: set wgpuDeviceSetUncapturedErrorCallback
|
// TODO: Make gpu.Device implement wgpuDeviceSetUncapturedErrorCallback
|
||||||
// backend_procs.*.deviceSetUncapturedErrorCallback.?(backend_device, printDeviceError, null);
|
// backend_procs.*.deviceSetUncapturedErrorCallback.?(backend_device, printDeviceError, null);
|
||||||
return Setup{
|
return Setup{
|
||||||
.native_instance = native_instance,
|
.native_instance = native_instance,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue