yes
This commit is contained in:
@@ -26,13 +26,21 @@ pub fn build(b: *std.Build) !void {
|
|||||||
.link_libc = true,
|
.link_libc = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const interface_dependency = b.dependency("interface", .{
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
|
|
||||||
const vulkan_headers = b.dependency("vulkan_headers", .{});
|
const vulkan_headers = b.dependency("vulkan_headers", .{});
|
||||||
|
|
||||||
const vulkan = b.dependency("vulkan_zig", .{
|
const vulkan = b.dependency("vulkan_zig", .{
|
||||||
.registry = vulkan_headers.path("registry/vk.xml"),
|
.registry = vulkan_headers.path("registry/vk.xml"),
|
||||||
}).module("vulkan-zig");
|
}).module("vulkan-zig");
|
||||||
|
|
||||||
|
const interface_mod = interface_dependency.module("interface");
|
||||||
|
|
||||||
common_mod.addImport("vulkan", vulkan);
|
common_mod.addImport("vulkan", vulkan);
|
||||||
|
common_mod.addImport("interface", interface_mod);
|
||||||
common_mod.addSystemIncludePath(vulkan_headers.path("include"));
|
common_mod.addSystemIncludePath(vulkan_headers.path("include"));
|
||||||
|
|
||||||
for (implementations) |impl| {
|
for (implementations) |impl| {
|
||||||
@@ -44,6 +52,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
.imports = &.{
|
.imports = &.{
|
||||||
.{ .name = "common", .module = common_mod },
|
.{ .name = "common", .module = common_mod },
|
||||||
.{ .name = "vulkan", .module = vulkan },
|
.{ .name = "vulkan", .module = vulkan },
|
||||||
|
.{ .name = "interface", .module = interface_mod },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
.hash = "cpuinfo-0.1.0-V7dMLcghAADJuG7dkd3MnwDPZ232pBK_8uGjxY43eP5u",
|
.hash = "cpuinfo-0.1.0-V7dMLcghAADJuG7dkd3MnwDPZ232pBK_8uGjxY43eP5u",
|
||||||
.lazy = true,
|
.lazy = true,
|
||||||
},
|
},
|
||||||
|
.interface = .{
|
||||||
|
.url = "git+https://github.com/nilslice/zig-interface#19f2c937b77e42b15bc8cacaa2894ce5b783d94d",
|
||||||
|
.hash = "interface-0.0.2-GFlWJ7KOAQAkHikqZU0XV86AhX7R9jCyGza85lTIqcEU",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
.paths = .{
|
.paths = .{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const vk = @import("vulkan");
|
|||||||
const Instance = @import("Instance.zig");
|
const Instance = @import("Instance.zig");
|
||||||
const common = @import("common");
|
const common = @import("common");
|
||||||
const root = @import("root");
|
const root = @import("root");
|
||||||
|
const cpuinfo = @import("cpuinfo");
|
||||||
|
|
||||||
const dispatchable = common.dispatchable;
|
const dispatchable = common.dispatchable;
|
||||||
|
|
||||||
@@ -13,6 +14,8 @@ instance: *const Instance,
|
|||||||
common_physical_device: common.PhysicalDevice,
|
common_physical_device: common.PhysicalDevice,
|
||||||
|
|
||||||
pub fn init(self: *Self) !void {
|
pub fn init(self: *Self) !void {
|
||||||
|
const allocator = std.heap.c_allocator;
|
||||||
|
|
||||||
self.common_physical_device.props = .{
|
self.common_physical_device.props = .{
|
||||||
.api_version = @bitCast(root.VULKAN_VERSION),
|
.api_version = @bitCast(root.VULKAN_VERSION),
|
||||||
.driver_version = @bitCast(root.DRIVER_VERSION),
|
.driver_version = @bitCast(root.DRIVER_VERSION),
|
||||||
@@ -24,8 +27,12 @@ pub fn init(self: *Self) !void {
|
|||||||
.limits = undefined,
|
.limits = undefined,
|
||||||
.sparse_properties = undefined,
|
.sparse_properties = undefined,
|
||||||
};
|
};
|
||||||
var writer = std.io.Writer.fixed(&self.common_physical_device.props.device_name);
|
|
||||||
try writer.print("Software Vulkan Driver", .{});
|
const info = try cpuinfo.get(allocator);
|
||||||
|
defer info.deinit(allocator);
|
||||||
|
|
||||||
|
var writer = std.io.Writer.fixed(self.common_physical_device.props.device_name[0 .. vk.MAX_PHYSICAL_DEVICE_NAME_SIZE - 1]);
|
||||||
|
try writer.print("{s} [Soft Vulkan Driver]", .{info.name});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getProperties(p_physical_device: vk.PhysicalDevice, properties: *vk.PhysicalDeviceProperties) callconv(vk.vulkan_call_conv) void {
|
pub fn getProperties(p_physical_device: vk.PhysicalDevice, properties: *vk.PhysicalDeviceProperties) callconv(vk.vulkan_call_conv) void {
|
||||||
|
|||||||
Reference in New Issue
Block a user