mach: platform/libmach: update to latest mach/core API

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2023-01-17 09:18:00 -07:00 committed by Stephen Gutekanst
parent a15b9bb5f6
commit 0eaa56b4ad

View file

@ -24,7 +24,13 @@ const allocator = gpa.allocator();
// Will return a null pointer if an error occurred while initializing Core // Will return a null pointer if an error occurred while initializing Core
pub export fn mach_core_init() ?*native.Core { pub export fn mach_core_init() ?*native.Core {
gpu.Impl.init(); gpu.Impl.init();
const core = native.Core.init(allocator, .{}) catch { // TODO(libmach): eliminate this allocation
var core = allocator.create(native.Core) catch {
return @intToPtr(?*native.Core, 0);
};
// TODO(libmach): allow passing init options
core.init(allocator, .{}) catch {
// TODO(libmach): better error handling
return @intToPtr(?*native.Core, 0); return @intToPtr(?*native.Core, 0);
}; };
return core; return core;