[Phi] adding basic host emulation for development without access to a
Xeon Phi
This commit is contained in:
+13
-1
@@ -61,7 +61,8 @@ fn destroy(interface: *Interface, allocator: std.mem.Allocator) VkError!void {
|
||||
self.threaded.deinit();
|
||||
allocator.destroy(self);
|
||||
|
||||
mic.unload();
|
||||
if (comptime !lib.config.phi_host_emulation)
|
||||
mic.unload();
|
||||
}
|
||||
|
||||
fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator, _: []base.drm.Card) VkError!void {
|
||||
@@ -69,6 +70,17 @@ fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator, _
|
||||
return;
|
||||
}
|
||||
|
||||
if (comptime lib.config.phi_host_emulation) {
|
||||
const physical_device = try PhiPhysicalDevice.createEmulated(allocator, interface);
|
||||
errdefer physical_device.interface.release(allocator) catch @panic("Caught an error while handling an error");
|
||||
|
||||
const dispatchable = try Dispatchable(base.PhysicalDevice).wrap(allocator, &physical_device.interface);
|
||||
errdefer dispatchable.destroy(allocator);
|
||||
|
||||
interface.physical_devices.append(allocator, dispatchable) catch return VkError.OutOfHostMemory;
|
||||
return;
|
||||
}
|
||||
|
||||
mic.load() catch |err| {
|
||||
std.log.scoped(.MIC).err("Failed to load libmicmgmt: {s}", .{@errorName(err)});
|
||||
return VkError.InitializationFailed;
|
||||
|
||||
Reference in New Issue
Block a user