From a2948bd65d6e35139219a148747a5075ca22b4a2 Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Sun, 2 Nov 2025 22:41:17 +0100 Subject: [PATCH] yes --- build.zig | 9 +++++++++ build.zig.zon | 4 ++++ src/soft/PhysicalDevice.zig | 11 +++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index 3ad8a39..692cd43 100644 --- a/build.zig +++ b/build.zig @@ -26,13 +26,21 @@ pub fn build(b: *std.Build) !void { .link_libc = true, }); + const interface_dependency = b.dependency("interface", .{ + .target = target, + .optimize = optimize, + }); + const vulkan_headers = b.dependency("vulkan_headers", .{}); const vulkan = b.dependency("vulkan_zig", .{ .registry = vulkan_headers.path("registry/vk.xml"), }).module("vulkan-zig"); + const interface_mod = interface_dependency.module("interface"); + common_mod.addImport("vulkan", vulkan); + common_mod.addImport("interface", interface_mod); common_mod.addSystemIncludePath(vulkan_headers.path("include")); for (implementations) |impl| { @@ -44,6 +52,7 @@ pub fn build(b: *std.Build) !void { .imports = &.{ .{ .name = "common", .module = common_mod }, .{ .name = "vulkan", .module = vulkan }, + .{ .name = "interface", .module = interface_mod }, }, }); diff --git a/build.zig.zon b/build.zig.zon index 4991a0b..3113675 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -18,6 +18,10 @@ .hash = "cpuinfo-0.1.0-V7dMLcghAADJuG7dkd3MnwDPZ232pBK_8uGjxY43eP5u", .lazy = true, }, + .interface = .{ + .url = "git+https://github.com/nilslice/zig-interface#19f2c937b77e42b15bc8cacaa2894ce5b783d94d", + .hash = "interface-0.0.2-GFlWJ7KOAQAkHikqZU0XV86AhX7R9jCyGza85lTIqcEU", + }, }, .paths = .{ diff --git a/src/soft/PhysicalDevice.zig b/src/soft/PhysicalDevice.zig index 081a336..6ae70b0 100644 --- a/src/soft/PhysicalDevice.zig +++ b/src/soft/PhysicalDevice.zig @@ -3,6 +3,7 @@ const vk = @import("vulkan"); const Instance = @import("Instance.zig"); const common = @import("common"); const root = @import("root"); +const cpuinfo = @import("cpuinfo"); const dispatchable = common.dispatchable; @@ -13,6 +14,8 @@ instance: *const Instance, common_physical_device: common.PhysicalDevice, pub fn init(self: *Self) !void { + const allocator = std.heap.c_allocator; + self.common_physical_device.props = .{ .api_version = @bitCast(root.VULKAN_VERSION), .driver_version = @bitCast(root.DRIVER_VERSION), @@ -24,8 +27,12 @@ pub fn init(self: *Self) !void { .limits = 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 {