fixing linter errors
Test / build_and_test (push) Successful in 5m28s
Build / build (push) Successful in 7m26s

This commit is contained in:
2026-07-15 15:39:16 +02:00
parent 1640013546
commit 2375abf688
116 changed files with 563 additions and 354 deletions
-2
View File
@@ -8,8 +8,6 @@ scripts/__pycache__/
*.o
.gdb_history
*.json
*.png
!logo.png
*.bin
*.qpa
*.xml
+7 -1
View File
@@ -175,7 +175,13 @@ pub fn build(b: *std.Build) !void {
const install_step = b.step(impl.name, b.fmt("Build libvulkan_{s}", .{impl.name}));
install_step.dependOn(&lib_install.step);
const lib_tests = b.addTest(.{ .root_module = lib_mod });
const lib_tests = b.addTest(.{
.root_module = lib_mod,
.test_runner = .{
.path = b.path("test/test_runner.zig"),
.mode = .simple,
},
});
const run_tests = b.addRunArtifact(lib_tests);
const test_step = b.step(b.fmt("test-{s}", .{impl.name}), b.fmt("Run libvulkan_{s} tests", .{impl.name}));
+4 -5
View File
@@ -6,7 +6,6 @@ const soft = @import("soft");
const flint = @import("flint");
const phi = @import("phi");
const Dispatchable = base.Dispatchable;
const VkError = base.VkError;
const Self = @This();
@@ -37,15 +36,15 @@ pub fn create(allocator: std.mem.Allocator, infos: *const vk.InstanceCreateInfo)
};
const soft_instance = try soft.Instance.create(allocator, infos);
errdefer soft_instance.deinit(allocator) catch {};
errdefer soft_instance.deinit(allocator) catch @panic("Caught an error while handling an error");
self.backend_instances.append(allocator, soft_instance) catch return VkError.OutOfHostMemory;
const flint_instance = try flint.Instance.create(allocator, infos);
errdefer flint_instance.deinit(allocator) catch {};
errdefer flint_instance.deinit(allocator) catch @panic("Caught an error while handling an error");
self.backend_instances.append(allocator, flint_instance) catch return VkError.OutOfHostMemory;
const phi_instance = try phi.Instance.create(allocator, infos);
errdefer phi_instance.deinit(allocator) catch {};
errdefer phi_instance.deinit(allocator) catch @panic("Caught an error while handling an error");
self.backend_instances.append(allocator, phi_instance) catch return VkError.OutOfHostMemory;
return &self.interface;
@@ -68,7 +67,7 @@ fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator, _
fn appendBackendPhysicalDevices(self: *Self, allocator: std.mem.Allocator, backend: *Interface) VkError!void {
try backend.requestPhysicalDevices(allocator);
errdefer backend.releasePhysicalDevices(allocator) catch {};
errdefer backend.releasePhysicalDevices(allocator) catch @panic("Caught an error while handling an error");
self.interface.physical_devices.appendSlice(allocator, backend.physical_devices.items) catch return VkError.OutOfHostMemory;
backend.physical_devices.deinit(allocator);
+1 -2
View File
@@ -4,7 +4,6 @@ const base = @import("base");
const kmd = @import("kmd.zig");
const VkError = base.VkError;
const Device = base.Device;
const FlintDevice = @import("FlintDevice.zig");
const drm_syncobj_create = 0xbf;
@@ -159,5 +158,5 @@ fn destroyHandle(device: *FlintDevice, io: std.Io, handle: u32) void {
io,
kmd.drmIoctlIowr(drm_syncobj_destroy, SyncObjDestroy),
&destroy_info,
) catch {};
) catch @panic("Caught an error while handling an error");
}
-2
View File
@@ -2,10 +2,8 @@ const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const lib = @import("lib.zig");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.Buffer;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.BufferView;
+1 -3
View File
@@ -5,8 +5,6 @@ const kmd = @import("kmd.zig");
const VkError = base.VkError;
const FlintDevice = @import("FlintDevice.zig");
const FlintDeviceMemory = @import("FlintDeviceMemory.zig");
const FlintImage = @import("FlintImage.zig");
const MemoryRange = @import("MemoryRange.zig");
@@ -96,7 +94,7 @@ pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) void {
pub fn submitGpuBatch(self: *Self, syncs: []const kmd.SyncDependency) VkError!void {
try self.interface.submit();
defer self.interface.finish() catch {};
defer self.interface.finish() catch @panic("Caught an error while handling an error");
if (self.batch.items.len == 0) return;
-2
View File
@@ -2,9 +2,7 @@ const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const NonDispatchable = base.NonDispatchable;
const VkError = base.VkError;
const Device = base.Device;
const FlintCommandBuffer = @import("FlintCommandBuffer.zig");
-3
View File
@@ -3,9 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const VulkanAllocator = base.VulkanAllocator;
const Device = base.Device;
const Self = @This();
pub const Interface = base.DescriptorPool;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.DescriptorSetLayout;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.Event;
+1 -1
View File
@@ -170,7 +170,7 @@ fn destroyHandle(device: *FlintDevice, io: std.Io, handle: u32) void {
io,
kmd.drmIoctlIowr(drm_syncobj_destroy, SyncObjDestroy),
&destroy_info,
) catch {};
) catch @panic("ioctl failed");
}
fn absoluteTimeout(io: std.Io, timeout: u64) i64 {
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.ImageView;
+5 -5
View File
@@ -80,17 +80,17 @@ fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator, d
defer version.deinit(allocator);
const kmd_type: lib.KmdType = if (std.mem.eql(u8, version.name, "i915"))
.I915
.i915
else if (std.mem.eql(u8, version.name, "xe"))
.Xe
.xe
else
.Invalid;
.invalid;
if (kmd_type == .Invalid)
if (kmd_type == .invalid)
continue;
const physical_device = try FlintPhysicalDevice.create(allocator, interface, &drm_device, kmd_type);
errdefer physical_device.interface.release(allocator) catch {};
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);
+5 -6
View File
@@ -9,7 +9,6 @@ const pci_ids = @import("pci_ids.zig").map;
const FlintDevice = @import("FlintDevice.zig");
const VkError = base.VkError;
const VulkanAllocator = base.VulkanAllocator;
const SurfaceKHR = base.SurfaceKHR;
const Self = @This();
@@ -79,7 +78,7 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance, drm_device
break;
}
interface.props.pipeline_cache_uuid = undefined;
interface.props.pipeline_cache_uuid = @splat(0);
interface.props.limits = .{
.max_image_dimension_1d = 4096,
.max_image_dimension_2d = 4096,
@@ -867,10 +866,10 @@ fn cpuid(leaf_id: u32, subleaf_id: u32) CpuidRegs {
}
}
var eax: u32 = undefined;
var ebx: u32 = undefined;
var ecx: u32 = undefined;
var edx: u32 = undefined;
var eax: u32 = 0;
var ebx: u32 = 0;
var ecx: u32 = 0;
var edx: u32 = 0;
asm volatile ("cpuid"
: [_] "={eax}" (eax),
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.PipelineLayout;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.QueryPool;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.RenderPass;
+1 -2
View File
@@ -1,7 +1,6 @@
const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const kmd = @import("kmd.zig");
const VkError = base.VkError;
const FlintImage = @import("FlintImage.zig");
@@ -158,7 +157,7 @@ fn bitwiseCompatibleFormats(src: vk.Format, dst: vk.Format) bool {
fn nearestBlitCoordinate(src_0: i32, src_1: i32, dst_0: i32, dst_1: i32, dst: i32, extent: u32) usize {
const numerator = @as(i64, 2 * (dst - dst_0) + 1) * @as(i64, src_1 - src_0);
const denominator = @as(i64, 2 * (dst_1 - dst_0));
const denominator: i64 = 2 * (dst_1 - dst_0);
const coordinate = @as(i64, src_0) + @divFloor(numerator, denominator);
return @intCast(std.math.clamp(coordinate, 0, @as(i64, extent) - 1));
}
@@ -1,19 +1,18 @@
const vk = @import("vulkan");
pub const command_base = 0x40;
pub const i915_gem_create = 0x1b;
pub const i915_gem_mmap_gtt = 0x24;
pub const i915_gem_set_domain = 0x1f;
pub const i915_gem_execbuffer2 = 0x29;
pub const gem_create = 0x1b;
pub const gem_mmap_gtt = 0x24;
pub const gem_set_domain = 0x1f;
pub const gem_execbuffer2 = 0x29;
pub const gem_close = 0x09;
pub const i915_mmap_offset_wb = 2;
pub const i915_gem_domain_cpu = 0x00000001;
pub const i915_gem_domain_gtt = 0x00000040;
pub const i915_exec_blt = 3 << 0;
pub const i915_exec_fence_array: u64 = 1 << 19;
pub const i915_exec_fence_wait: u32 = 1 << 0;
pub const i915_exec_fence_signal: u32 = 1 << 1;
pub const mmap_offset_wb = 2;
pub const gem_domain_cpu = 0x00000001;
pub const gem_domain_gtt = 0x00000040;
pub const exec_blt = 3 << 0;
pub const exec_fence_array: u64 = 1 << 19;
pub const exec_fence_wait: u32 = 1 << 0;
pub const exec_fence_signal: u32 = 1 << 1;
pub const exec_object_write = 1 << 2;
pub const mi_flush_dw: u32 = (0x26 << 23) | 3;
+43 -26
View File
@@ -2,13 +2,11 @@ const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const drm = @import("drm.zig");
const _i915 = @import("i915.zig");
const common_kmd = @import("../kmd.zig");
const VkError = base.VkError;
const IOCTL = std.os.linux.IOCTL;
const Mapping = struct {
bytes: []align(std.heap.page_size_min) u8,
@@ -33,12 +31,17 @@ pub const Device = struct {
}
pub fn allocateMemory(self: *Device, io: std.Io, size: vk.DeviceSize) VkError!Memory {
var create = drm.GemCreate{
var create = _i915.GemCreate{
.size = size,
.handle = 0,
.pad = 0,
};
base.utils.ioctl(self.card.handle, io, common_kmd.drmIoctlIowr(drm.command_base + drm.i915_gem_create, drm.GemCreate), &create) catch return VkError.OutOfDeviceMemory;
base.utils.ioctl(
self.card.handle,
io,
common_kmd.drmIoctlIowr(_i915.command_base + _i915.gem_create, _i915.GemCreate),
&create,
) catch return VkError.OutOfDeviceMemory;
var memory = Memory{
.handle = create.handle,
@@ -47,7 +50,7 @@ pub const Device = struct {
};
errdefer memory.deinit(self, io);
try memory.setDomain(self, io, drm.i915_gem_domain_cpu, 0);
try memory.setDomain(self, io, _i915.gem_domain_cpu, 0);
return memory;
}
@@ -61,7 +64,7 @@ pub const Device = struct {
const batch_map = try batch.map(self, io, 0, batch_size);
const batch_words = std.mem.bytesAsSlice(u32, batch_map);
@memcpy(batch_words[0..commands.len], commands);
batch_words[commands.len + 0] = drm.mi_flush_dw;
batch_words[commands.len + 0] = _i915.mi_flush_dw;
batch_words[commands.len + 1] = 0;
batch_words[commands.len + 2] = 0;
batch_words[commands.len + 3] = 0;
@@ -71,7 +74,7 @@ pub const Device = struct {
}
try batch.flushRange(self, io, 0, batch_size);
var objects = std.ArrayList(drm.ExecObject2).empty;
var objects = std.ArrayList(_i915.ExecObject2).empty;
defer objects.deinit(allocator);
var object_handles = std.ArrayList(u32).empty;
@@ -86,17 +89,17 @@ pub const Device = struct {
.relocs_ptr = 0,
.alignment = 0,
.offset = 0,
.flags = if (relocation.write) drm.exec_object_write else 0,
.flags = if (relocation.write) _i915.exec_object_write else 0,
.rsvd1 = 0,
.rsvd2 = 0,
}) catch return VkError.OutOfHostMemory;
} else if (relocation.write) {
const index = std.mem.indexOfScalar(u32, object_handles.items, relocation.target_handle).?;
objects.items[index].flags |= drm.exec_object_write;
objects.items[index].flags |= _i915.exec_object_write;
}
}
var i915_relocations = std.ArrayList(drm.RelocationEntry).empty;
var i915_relocations = std.ArrayList(_i915.RelocationEntry).empty;
defer i915_relocations.deinit(allocator);
for (relocations) |relocation| {
@@ -121,17 +124,16 @@ pub const Device = struct {
.rsvd2 = 0,
}) catch return VkError.OutOfHostMemory;
var exec_fences = std.ArrayList(drm.ExecFence).empty;
var exec_fences = std.ArrayList(_i915.ExecFence).empty;
defer exec_fences.deinit(allocator);
for (syncs) |sync| {
exec_fences.append(allocator, .{
.handle = sync.handle,
.flags = (if (sync.wait) drm.i915_exec_fence_wait else 0) |
(if (sync.signal) drm.i915_exec_fence_signal else 0),
.flags = (if (sync.wait) _i915.exec_fence_wait else 0) | (if (sync.signal) _i915.exec_fence_signal else 0),
}) catch return VkError.OutOfHostMemory;
}
var execbuffer = drm.ExecBuffer2{
var execbuffer = _i915.ExecBuffer2{
.buffers_ptr = @intFromPtr(objects.items.ptr),
.buffer_count = @intCast(objects.items.len),
.batch_start_offset = 0,
@@ -140,11 +142,16 @@ pub const Device = struct {
.DR4 = 0,
.num_cliprects = @intCast(exec_fences.items.len),
.cliprects_ptr = if (exec_fences.items.len == 0) 0 else @intFromPtr(exec_fences.items.ptr),
.flags = drm.i915_exec_blt | (if (exec_fences.items.len == 0) 0 else drm.i915_exec_fence_array),
.flags = _i915.exec_blt | (if (exec_fences.items.len == 0) 0 else _i915.exec_fence_array),
.rsvd1 = 0,
.rsvd2 = 0,
};
base.utils.ioctl(self.card.handle, io, common_kmd.drmIoctlIowr(drm.command_base + drm.i915_gem_execbuffer2, drm.ExecBuffer2), &execbuffer) catch return VkError.DeviceLost;
base.utils.ioctl(
self.card.handle,
io,
common_kmd.drmIoctlIowr(_i915.command_base + _i915.gem_execbuffer2, _i915.ExecBuffer2),
&execbuffer,
) catch return VkError.DeviceLost;
}
};
@@ -156,11 +163,11 @@ pub const Memory = struct {
pub fn deinit(self: *Memory, device: *Device, io: std.Io) void {
self.unmap();
var close = drm.GemClose{
var close = _i915.GemClose{
.handle = self.handle,
.pad = 0,
};
base.utils.ioctl(device.card.handle, io, common_kmd.drmIoctlIow(drm.gem_close, drm.GemClose), &close) catch {};
base.utils.ioctl(device.card.handle, io, common_kmd.drmIoctlIow(_i915.gem_close, _i915.GemClose), &close) catch @panic("Caught an error while handling an error");
self.* = undefined;
}
@@ -176,14 +183,19 @@ pub const Memory = struct {
return mapping.slice(offset, map_size);
}
var mmap_offset = drm.GemMmapOffset{
var mmap_offset = _i915.GemMmapOffset{
.handle = self.handle,
.pad = 0,
.offset = 0,
.flags = drm.i915_mmap_offset_wb,
.flags = _i915.mmap_offset_wb,
.extensions = 0,
};
base.utils.ioctl(device.card.handle, io, common_kmd.drmIoctlIowr(drm.command_base + drm.i915_gem_mmap_gtt, drm.GemMmapOffset), &mmap_offset) catch return VkError.MemoryMapFailed;
base.utils.ioctl(
device.card.handle,
io,
common_kmd.drmIoctlIowr(_i915.command_base + _i915.gem_mmap_gtt, _i915.GemMmapOffset),
&mmap_offset,
) catch return VkError.MemoryMapFailed;
if (self.size > std.math.maxInt(usize)) return VkError.MemoryMapFailed;
const full_size: usize = @intCast(self.size);
@@ -210,21 +222,26 @@ pub const Memory = struct {
pub fn flushRange(self: *Memory, device: *Device, io: std.Io, offset: vk.DeviceSize, size: vk.DeviceSize) VkError!void {
_ = offset;
_ = size;
try self.setDomain(device, io, drm.i915_gem_domain_cpu, 0);
try self.setDomain(device, io, _i915.gem_domain_cpu, 0);
}
pub fn invalidateRange(self: *Memory, device: *Device, io: std.Io, offset: vk.DeviceSize, size: vk.DeviceSize) VkError!void {
_ = offset;
_ = size;
try self.setDomain(device, io, drm.i915_gem_domain_cpu, 0);
try self.setDomain(device, io, _i915.gem_domain_cpu, 0);
}
fn setDomain(self: *Memory, device: *Device, io: std.Io, read_domains: u32, write_domain: u32) VkError!void {
var domain = drm.GemSetDomain{
var domain = _i915.GemSetDomain{
.handle = self.handle,
.read_domains = read_domains,
.write_domain = write_domain,
};
base.utils.ioctl(device.card.handle, io, common_kmd.drmIoctlIow(drm.command_base + drm.i915_gem_set_domain, drm.GemSetDomain), &domain) catch return VkError.DeviceLost;
base.utils.ioctl(
device.card.handle,
io,
common_kmd.drmIoctlIow(_i915.command_base + _i915.gem_set_domain, _i915.GemSetDomain),
&domain,
) catch return VkError.DeviceLost;
}
};
+53 -52
View File
@@ -1,7 +1,8 @@
const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const lib = @import("lib.zig");
const KmdType = @import("lib.zig").KmdType;
const FlintPhysicalDevice = @import("FlintPhysicalDevice.zig");
const i915_kmd = @import("i915/kmd.zig");
@@ -32,128 +33,128 @@ pub const SyncDependency = struct {
signal: bool = false,
};
pub const Device = union(lib.KmdType) {
Invalid: void,
I915: i915_kmd.Device,
Xe: xe.Device,
pub const Device = union(KmdType) {
invalid: void,
i915: i915_kmd.Device,
xe: xe.Device,
pub fn open(io: std.Io, physical_device: *const FlintPhysicalDevice) VkError!Device {
return switch (physical_device.kmd_type) {
.I915 => .{ .I915 = try i915_kmd.Device.open(io, physical_device.getNodePath()) },
.Xe => .{ .Xe = try xe.Device.open(io, physical_device.getNodePath()) },
.Invalid => VkError.InitializationFailed,
.i915 => .{ .i915 = try i915_kmd.Device.open(io, physical_device.getNodePath()) },
.xe => .{ .xe = try xe.Device.open(io, physical_device.getNodePath()) },
.invalid => VkError.InitializationFailed,
};
}
pub fn close(self: *Device, io: std.Io) void {
switch (self.*) {
.I915 => |*device| device.close(io),
.Xe => |*device| device.close(io),
.Invalid => {},
.i915 => |*device| device.close(io),
.xe => |*device| device.close(io),
.invalid => {},
}
self.* = .{ .Invalid = {} };
self.* = .{ .invalid = {} };
}
pub fn allocateMemory(self: *Device, io: std.Io, size: vk.DeviceSize) VkError!Memory {
return switch (self.*) {
.I915 => |*device| .{ .I915 = try device.allocateMemory(io, size) },
.Xe => |*device| .{ .Xe = try device.allocateMemory(io, size) },
.Invalid => VkError.OutOfDeviceMemory,
.i915 => |*device| .{ .i915 = try device.allocateMemory(io, size) },
.xe => |*device| .{ .xe = try device.allocateMemory(io, size) },
.invalid => VkError.OutOfDeviceMemory,
};
}
pub fn submitBatch(self: *Device, io: std.Io, allocator: std.mem.Allocator, commands: []const u32, relocations: []const Relocation, syncs: []const SyncDependency) VkError!void {
return switch (self.*) {
.I915 => |*device| device.submitBatch(io, allocator, commands, relocations, syncs),
.Xe => |*device| device.submitBatch(io, allocator, commands, relocations, syncs),
.Invalid => VkError.DeviceLost,
.i915 => |*device| device.submitBatch(io, allocator, commands, relocations, syncs),
.xe => |*device| device.submitBatch(io, allocator, commands, relocations, syncs),
.invalid => VkError.DeviceLost,
};
}
pub fn file(self: *Device) VkError!std.Io.File {
return switch (self.*) {
.I915 => |*device| device.card.handle,
.Xe => |*device| device.card.handle,
.Invalid => VkError.DeviceLost,
.i915 => |*device| device.card.handle,
.xe => |*device| device.card.handle,
.invalid => VkError.DeviceLost,
};
}
};
pub const Memory = union(lib.KmdType) {
Invalid: void,
I915: i915_kmd.Memory,
Xe: xe.Memory,
pub const Memory = union(KmdType) {
invalid: void,
i915: i915_kmd.Memory,
xe: xe.Memory,
pub fn deinit(self: *Memory, device: *Device, io: std.Io) void {
switch (self.*) {
.I915 => |*memory| switch (device.*) {
.I915 => |*adapter| memory.deinit(adapter, io),
.i915 => |*memory| switch (device.*) {
.i915 => |*adapter| memory.deinit(adapter, io),
else => {},
},
.Xe => |*memory| switch (device.*) {
.Xe => |*adapter| memory.deinit(adapter, io),
.xe => |*memory| switch (device.*) {
.xe => |*adapter| memory.deinit(adapter, io),
else => {},
},
.Invalid => {},
.invalid => {},
}
self.* = .{ .Invalid = {} };
self.* = .{ .invalid = {} };
}
pub fn map(self: *Memory, device: *Device, io: std.Io, offset: vk.DeviceSize, size: vk.DeviceSize) VkError![]u8 {
return switch (self.*) {
.I915 => |*memory| switch (device.*) {
.I915 => |*adapter| memory.map(adapter, io, offset, size),
.i915 => |*memory| switch (device.*) {
.i915 => |*adapter| memory.map(adapter, io, offset, size),
else => VkError.MemoryMapFailed,
},
.Xe => |*memory| switch (device.*) {
.Xe => |*adapter| memory.map(adapter, io, offset, size),
.xe => |*memory| switch (device.*) {
.xe => |*adapter| memory.map(adapter, io, offset, size),
else => VkError.MemoryMapFailed,
},
.Invalid => VkError.MemoryMapFailed,
.invalid => VkError.MemoryMapFailed,
};
}
pub fn unmap(self: *Memory) void {
switch (self.*) {
.I915 => |*memory| memory.unmap(),
.Xe => |*memory| memory.unmap(),
.Invalid => {},
.i915 => |*memory| memory.unmap(),
.xe => |*memory| memory.unmap(),
.invalid => {},
}
}
pub fn flushRange(self: *Memory, device: *Device, io: std.Io, offset: vk.DeviceSize, size: vk.DeviceSize) VkError!void {
return switch (self.*) {
.I915 => |*memory| switch (device.*) {
.I915 => |*adapter| memory.flushRange(adapter, io, offset, size),
.i915 => |*memory| switch (device.*) {
.i915 => |*adapter| memory.flushRange(adapter, io, offset, size),
else => VkError.InvalidDeviceMemoryDrv,
},
.Xe => |*memory| switch (device.*) {
.Xe => |*adapter| memory.flushRange(adapter, io, offset, size),
.xe => |*memory| switch (device.*) {
.xe => |*adapter| memory.flushRange(adapter, io, offset, size),
else => VkError.InvalidDeviceMemoryDrv,
},
.Invalid => VkError.InvalidDeviceMemoryDrv,
.invalid => VkError.InvalidDeviceMemoryDrv,
};
}
pub fn invalidateRange(self: *Memory, device: *Device, io: std.Io, offset: vk.DeviceSize, size: vk.DeviceSize) VkError!void {
return switch (self.*) {
.I915 => |*memory| switch (device.*) {
.I915 => |*adapter| memory.invalidateRange(adapter, io, offset, size),
.i915 => |*memory| switch (device.*) {
.i915 => |*adapter| memory.invalidateRange(adapter, io, offset, size),
else => VkError.InvalidDeviceMemoryDrv,
},
.Xe => |*memory| switch (device.*) {
.Xe => |*adapter| memory.invalidateRange(adapter, io, offset, size),
.xe => |*memory| switch (device.*) {
.xe => |*adapter| memory.invalidateRange(adapter, io, offset, size),
else => VkError.InvalidDeviceMemoryDrv,
},
.Invalid => VkError.InvalidDeviceMemoryDrv,
.invalid => VkError.InvalidDeviceMemoryDrv,
};
}
pub fn handle(self: *const Memory) VkError!u32 {
return switch (self.*) {
.I915 => |*memory| memory.handle,
.Xe => VkError.FeatureNotPresent,
.Invalid => VkError.InvalidDeviceMemoryDrv,
.i915 => |*memory| memory.handle,
.xe => VkError.FeatureNotPresent,
.invalid => VkError.InvalidDeviceMemoryDrv,
};
}
};
+3 -3
View File
@@ -52,9 +52,9 @@ pub const VULKAN_VERSION = vk.makeApiVersion(
pub const IMAGE_MEMORY_ALIGNMENT = std.heap.page_size_max;
pub const KmdType = enum {
Invalid,
I915,
Xe,
invalid,
i915,
xe,
};
pub const std_options = base.std_options;
-2
View File
@@ -1,5 +1,3 @@
const std = @import("std");
const PciInfo = struct {
id: u16,
name: []const u8,
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.BinarySemaphore;
-2
View File
@@ -2,10 +2,8 @@ const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const lib = @import("lib.zig");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.Buffer;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.BufferView;
-2
View File
@@ -2,9 +2,7 @@ const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const NonDispatchable = base.NonDispatchable;
const VkError = base.VkError;
const Device = base.Device;
const PhiCommandBuffer = @import("PhiCommandBuffer.zig");
-2
View File
@@ -3,9 +3,7 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const VulkanAllocator = base.VulkanAllocator;
const Device = base.Device;
const Self = @This();
pub const Interface = base.DescriptorPool;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.DescriptorSetLayout;
+1 -1
View File
@@ -229,7 +229,7 @@ fn uploadAndLaunchDaemon(instance: *base.Instance, allocator: std.mem.Allocator,
const local_path = std.fmt.allocPrint(allocator, "/tmp/ape_phi_device_{d}_{d}.mic", .{ std.os.linux.getpid(), mic_device_num }) catch return VkError.OutOfHostMemory;
defer allocator.free(local_path);
defer std.Io.Dir.deleteFileAbsolute(io, local_path) catch {};
defer std.Io.Dir.deleteFileAbsolute(io, local_path) catch @panic("Caught an error while handling an error");
std.Io.Dir.writeFile(.cwd(), io, .{
.sub_path = local_path,
+1 -1
View File
@@ -46,7 +46,7 @@ pub fn create(device: *PhiDevice, allocator: std.mem.Allocator, size: vk.DeviceS
.flags = 0,
};
var reply: proto.PhiAllocMemoryReply = undefined;
var reply = std.mem.zeroes(proto.PhiAllocMemoryReply);
try device.transport.request(proto.PHI_PACKET_ALLOC_MEMORY, std.mem.asBytes(&alloc_request), std.mem.asBytes(&reply));
if (reply.result.status != proto.PHI_STATUS_OK) {
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.Event;
-1
View File
@@ -1,7 +1,6 @@
const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const lib = @import("lib.zig");
const VkError = base.VkError;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.ImageView;
+1 -1
View File
@@ -98,7 +98,7 @@ fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator, _
defer device.deinit();
const physical_device = try PhiPhysicalDevice.create(allocator, interface, device, device_num);
errdefer physical_device.interface.release(allocator) catch {};
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);
+5 -6
View File
@@ -10,7 +10,6 @@ const pci_ids = @import("pci_ids.zig").map;
const PhiDevice = @import("PhiDevice.zig");
const VkError = base.VkError;
const VulkanAllocator = base.VulkanAllocator;
const SurfaceKHR = base.SurfaceKHR;
const Self = @This();
@@ -87,7 +86,7 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance, mic_device
return VkError.InitializationFailed;
}
interface.props.pipeline_cache_uuid = undefined;
interface.props.pipeline_cache_uuid = @splat(0);
interface.props.limits = .{
.max_image_dimension_1d = 4096,
.max_image_dimension_2d = 4096,
@@ -872,10 +871,10 @@ fn cpuid(leaf_id: u32, subleaf_id: u32) CpuidRegs {
}
}
var eax: u32 = undefined;
var ebx: u32 = undefined;
var ecx: u32 = undefined;
var edx: u32 = undefined;
var eax: u32 = 0;
var ebx: u32 = 0;
var ecx: u32 = 0;
var edx: u32 = 0;
asm volatile ("cpuid"
: [_] "={eax}" (eax),
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.PipelineLayout;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.QueryPool;
+1 -1
View File
@@ -66,7 +66,7 @@ pub fn submit(interface: *Interface, infos: []Interface.SubmitInfo, fence: ?*bas
@memcpy(payload[@sizeOf(proto.PhiWorkExecutionRequest)..], phi_command_buffer.commands.items);
// Synchronous queues for now
var reply: proto.PhiWorkExecutionReply = undefined;
var reply = std.mem.zeroes(proto.PhiWorkExecutionReply);
try device.transport.request(proto.PHI_PACKET_WORK_EXECUTION, payload, std.mem.asBytes(&reply));
if (reply.result.status != proto.PHI_STATUS_OK) {
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.RenderPass;
+3
View File
@@ -68,6 +68,7 @@ pub fn request(self: *Self, command: c_uint, payload: []const u8, reply_payload:
try self.writeAll(std.mem.asBytes(&header));
try self.writeAll(payload);
// SAFETY: will be entirely written with the readAll
var reply_header: proto.PhiMessageHeader = undefined;
try self.readAll(std.mem.asBytes(&reply_header));
@@ -119,6 +120,8 @@ fn handshake(self: *Self) VkError!void {
.host_protocol_version = proto.PHI_PROTOCOL_VERSION,
.reserved = 0,
};
// SAFETY: will be entirely written by the request
var reply: proto.PhiHelloReply = undefined;
try self.request(proto.PHI_PACKET_HELLO, std.mem.asBytes(&request_payload), std.mem.asBytes(&reply));
if (reply.result.status != proto.PHI_STATUS_OK) {
-1
View File
@@ -1,4 +1,3 @@
const std = @import("std");
const PciInfo = struct {
id: u16,
+6
View File
@@ -13,12 +13,18 @@ pub const PortId = extern struct {
pub const SEND_BLOCK = 1;
pub const RECV_BLOCK = 1;
// SAFETY: load assigns every function pointer before the public wrappers can be used.
var scif_open: *const fn () callconv(.c) epd_t = undefined;
// SAFETY: load assigns every function pointer before the public wrappers can be used.
var scif_close: *const fn (epd: epd_t) callconv(.c) c_int = undefined;
// SAFETY: load assigns every function pointer before the public wrappers can be used.
var scif_connect: *const fn (epd: epd_t, dst: *const PortId) callconv(.c) c_int = undefined;
// SAFETY: load assigns every function pointer before the public wrappers can be used.
var scif_send: *const fn (epd: epd_t, msg: ?*const anyopaque, len: usize, flags: c_int) callconv(.c) isize = undefined;
// SAFETY: load assigns every function pointer before the public wrappers can be used.
var scif_recv: *const fn (epd: epd_t, msg: ?*anyopaque, len: usize, flags: c_int) callconv(.c) isize = undefined;
// SAFETY: load initializes the module before it can be closed or queried.
var module: std.DynLib = undefined;
var ref_count = std.atomic.Value(usize).init(0);
var load_mutex: base.SpinMutex = .{};
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.BinarySemaphore;
-1
View File
@@ -5,7 +5,6 @@ const base = @import("base");
const lib = @import("lib.zig");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.Buffer;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.BufferView;
+7 -5
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const lib = @import("lib.zig");
const Device = base.Device;
const VkError = base.VkError;
const SoftBuffer = @import("SoftBuffer.zig");
@@ -129,10 +128,9 @@ pub fn create(device: *base.Device, allocator: std.mem.Allocator, info: *const v
self.* = .{
.interface = interface,
.command_allocator = undefined,
.command_allocator = .init(interface.host_allocator.allocator()),
.commands = .empty,
};
self.command_allocator = .init(self.interface.host_allocator.allocator());
return self;
}
@@ -144,7 +142,7 @@ pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) void {
pub fn execute(self: *Self, device: *ExecutionDevice) VkError!void {
try self.interface.submit();
defer self.interface.finish() catch {};
defer self.interface.finish() catch @panic("Caught an error while handling an error");
for (self.commands.items) |command| {
command.vtable.execute(@ptrCast(command.ptr), device) catch |err| {
@@ -1063,7 +1061,11 @@ pub fn endRenderPass(interface: *Interface) VkError!void {
}
};
self.commands.append(allocator, .{ .ptr = undefined, .vtable = &.{ .execute = CommandImpl.execute } }) catch return VkError.OutOfHostMemory;
self.commands.append(allocator, .{
// SAFETY: this command's execute callback does not inspect its context pointer.
.ptr = undefined,
.vtable = &.{ .execute = CommandImpl.execute },
}) catch return VkError.OutOfHostMemory;
}
pub fn executeCommands(interface: *Interface, commands: *Interface) VkError!void {
-2
View File
@@ -2,9 +2,7 @@ const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const NonDispatchable = base.NonDispatchable;
const VkError = base.VkError;
const Device = base.Device;
const SoftCommandBuffer = @import("SoftCommandBuffer.zig");
-1
View File
@@ -5,7 +5,6 @@ const base = @import("base");
const VkError = base.VkError;
const VulkanAllocator = base.VulkanAllocator;
const Device = base.Device;
const SoftDescriptorSet = @import("SoftDescriptorSet.zig");
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Buffer = base.Buffer;
const BufferView = base.BufferView;
const ImageView = base.ImageView;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.DescriptorSetLayout;
+1 -5
View File
@@ -1,8 +1,6 @@
const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const builtin = @import("builtin");
const config = base.config;
const SoftQueue = @import("SoftQueue.zig");
@@ -33,8 +31,6 @@ const VkError = base.VkError;
const Self = @This();
pub const Interface = base.Device;
const SpawnError = std.Thread.SpawnError;
interface: Interface,
pub fn create(instance: *base.Instance, physical_device: *base.PhysicalDevice, allocator: std.mem.Allocator, info: *const vk.DeviceCreateInfo) VkError!*Self {
@@ -42,7 +38,7 @@ pub fn create(instance: *base.Instance, physical_device: *base.PhysicalDevice, a
var initialized = false;
errdefer {
if (initialized) {
self.interface.destroy(allocator) catch {};
self.interface.destroy(allocator) catch @panic("Caught an error while handling an error");
} else {
allocator.destroy(self);
}
-1
View File
@@ -2,7 +2,6 @@ const std = @import("std");
const vk = @import("vulkan");
const SoftDevice = @import("SoftDevice.zig");
const base = @import("base");
const lib = @import("lib.zig");
const VkError = base.VkError;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.Event;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const blitter = @import("device/blitter.zig");
-2
View File
@@ -61,10 +61,8 @@ const F32x4 = blitter.F32x4;
const U32x4 = blitter.U32x4;
const VkError = base.VkError;
const Device = base.Device;
const SoftBuffer = @import("SoftBuffer.zig");
const SoftDevice = @import("SoftDevice.zig");
const Self = @This();
pub const Interface = base.Image;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.ImageView;
+1 -2
View File
@@ -1,7 +1,6 @@
const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const lib = @import("lib.zig");
const SoftPhysicalDevice = @import("SoftPhysicalDevice.zig");
const Dispatchable = base.Dispatchable;
@@ -63,7 +62,7 @@ fn destroy(interface: *Interface, allocator: std.mem.Allocator) VkError!void {
fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator, _: []base.drm.Card) VkError!void {
// Software driver has only one physical device (the CPU)
const physical_device = try SoftPhysicalDevice.create(allocator, interface);
errdefer physical_device.interface.release(allocator) catch {};
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;
+4 -4
View File
@@ -925,10 +925,10 @@ fn cpuid(leaf_id: u32, subleaf_id: u32) CpuidRegs {
}
}
var eax: u32 = undefined;
var ebx: u32 = undefined;
var ecx: u32 = undefined;
var edx: u32 = undefined;
var eax: u32 = 0;
var ebx: u32 = 0;
var ecx: u32 = 0;
var edx: u32 = 0;
asm volatile ("cpuid"
: [_] "={eax}" (eax),
-2
View File
@@ -7,7 +7,6 @@ const zm = base.zm;
const blitter = @import("device/blitter.zig");
const Device = base.Device;
const VkError = base.VkError;
const SpvRuntimeError = spv.Runtime.RuntimeError;
@@ -31,7 +30,6 @@ pub threadlocal var current_framebuffer_attachment_count: usize = 0;
const NonDispatchable = base.NonDispatchable;
const ShaderModule = base.ShaderModule;
const SoftDevice = @import("SoftDevice.zig");
const SoftBuffer = @import("SoftBuffer.zig");
const SoftBufferView = @import("SoftBufferView.zig");
const SoftImage = @import("SoftImage.zig");
-1
View File
@@ -4,7 +4,6 @@ const base = @import("base");
const spv = @import("spv");
const VkError = base.VkError;
const SoftDevice = @import("SoftDevice.zig");
const SoftShaderModule = @import("SoftShaderModule.zig");
const Self = @This();
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.PipelineLayout;
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.QueryPool;
+1 -2
View File
@@ -3,9 +3,7 @@ const vk = @import("vulkan");
const base = @import("base");
const ExecutionDevice = @import("device/Device.zig");
const Dispatchable = base.Dispatchable;
const CommandBuffer = base.CommandBuffer;
const SoftDevice = @import("SoftDevice.zig");
const SoftCommandBuffer = @import("SoftCommandBuffer.zig");
@@ -109,6 +107,7 @@ fn executeSubmitInfo(soft_device: *SoftDevice, info: Interface.SubmitInfo) VkErr
try semaphore.wait();
}
// SAFETY: setup initializes every field before execution_device is read.
var execution_device: ExecutionDevice = undefined;
execution_device.setup(soft_device);
defer execution_device.deinit(soft_device.interface.device_allocator.allocator());
-1
View File
@@ -3,7 +3,6 @@ const vk = @import("vulkan");
const base = @import("base");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.RenderPass;
-1
View File
@@ -6,7 +6,6 @@ const zm = base.zm;
const blitter = @import("device/blitter.zig");
const VkError = base.VkError;
const Device = base.Device;
const F32x4 = zm.F32x4;
const U32x4 = blitter.U32x4;
-3
View File
@@ -2,12 +2,9 @@ const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const spv = @import("spv");
const lib = @import("lib.zig");
const VkError = base.VkError;
const Device = base.Device;
const SoftDevice = @import("SoftDevice.zig");
const Self = @This();
pub const Interface = base.ShaderModule;
-1
View File
@@ -1,5 +1,4 @@
const std = @import("std");
const base = @import("base");
const Self = @This();
@@ -1,8 +1,6 @@
const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const spv = @import("spv");
const lib = @import("../lib.zig");
const ExecutionDevice = @import("Device.zig");
const PipelineState = ExecutionDevice.PipelineState;
+2 -4
View File
@@ -6,15 +6,11 @@ const spv = @import("spv");
const SoftDescriptorSet = @import("../SoftDescriptorSet.zig");
const SoftDevice = @import("../SoftDevice.zig");
const SoftFramebuffer = @import("../SoftFramebuffer.zig");
const SoftPipeline = @import("../SoftPipeline.zig");
const SoftRenderPass = @import("../SoftRenderPass.zig");
const ComputeDispatcher = @import("ComputeDispatcher.zig");
const Renderer = @import("Renderer.zig");
const VkError = base.VkError;
const Self = @This();
pub const GRAPHICS_PIPELINE_STATE = 0;
@@ -58,7 +54,9 @@ pub fn setup(self: *Self, device: *SoftDevice) void {
.data = switch (i) {
GRAPHICS_PIPELINE_STATE => .{
.graphics = .{
// SAFETY: indexed draws bind the index buffer before the renderer reads it.
.index_buffer = undefined,
// SAFETY: each vertex binding is populated before an attribute reads it.
.vertex_buffers = undefined,
},
},
+2 -3
View File
@@ -9,16 +9,13 @@ const PipelineState = ExecutionDevice.PipelineState;
const BoundedAllocator = @import("BoundedAllocator.zig");
const SoftBuffer = @import("../SoftBuffer.zig");
const SoftDescriptorSet = @import("../SoftDescriptorSet.zig");
const SoftDevice = @import("../SoftDevice.zig");
const SoftFramebuffer = @import("../SoftFramebuffer.zig");
const SoftPipeline = @import("../SoftPipeline.zig");
const SoftRenderPass = @import("../SoftRenderPass.zig");
const blitter = @import("blitter.zig");
const rasterizer = @import("rasterizer.zig");
const vertex_dispatcher = @import("vertex_dispatcher.zig");
const clip = @import("clip.zig");
const VkError = base.VkError;
const F32x4 = zm.F32x4;
@@ -110,7 +107,9 @@ pub const DrawCall = struct {
.vertex_count = vertex_count,
.instance_count = instance_count,
.renderer = renderer,
// SAFETY: draw assigns the viewport before the rasterizer receives this value.
.viewport = undefined,
// SAFETY: draw assigns the scissor before the rasterizer receives this value.
.scissor = undefined,
.color_attachments = framebuffer.interface.attachments[0..],
.depth_attachment = if (render_pass.interface.subpasses[renderer.subpass_index].depth_stencil_attachments) |desc| framebuffer.interface.attachments[desc.attachment] else null,
+1 -1
View File
@@ -1640,7 +1640,7 @@ fn encodeUFloat(value: f32, mantissa_bits: comptime_int) u32 {
return max_exponent << mantissa_bits;
if (adjusted_exponent <= 0) {
const mantissa = @as(u32, @intFromFloat(@round(value * @as(f32, @floatFromInt(1 << (mantissa_bits + exponent_bias - 1))))));
const mantissa: u32 = @intFromFloat(@round(value * @as(f32, @floatFromInt(1 << (mantissa_bits + exponent_bias - 1)))));
return mantissa;
}
+26 -26
View File
@@ -13,12 +13,12 @@ const VkError = base.VkError;
const INTERFACE_BLOB_PADDING = @sizeOf(F32x4);
const ClipPlane = enum {
Left,
Right,
Bottom,
Top,
Near,
Far,
left,
right,
bottom,
top,
near,
far,
};
const MAX_CLIPPED_POLYGON_VERTICES = 16;
@@ -29,7 +29,7 @@ pub const ClippedLine = struct {
};
const ClippedPolygon = struct {
vertices: [MAX_CLIPPED_POLYGON_VERTICES]Vertex = undefined,
vertices: [MAX_CLIPPED_POLYGON_VERTICES]Vertex = std.mem.zeroes([MAX_CLIPPED_POLYGON_VERTICES]Vertex),
len: usize = 0,
fn append(self: *@This(), vertex: Vertex) VkError!void {
@@ -48,12 +48,12 @@ pub fn clipTriangle(allocator: std.mem.Allocator, v0: *const Vertex, v1: *const
try polygon.append(v2.*);
const planes = [_]ClipPlane{
.Left,
.Right,
.Bottom,
.Top,
.Near,
.Far,
.left,
.right,
.bottom,
.top,
.near,
.far,
};
for (planes) |plane| {
@@ -72,12 +72,12 @@ pub fn clipLine(allocator: std.mem.Allocator, v0: *const Vertex, v1: *const Vert
};
const planes = [_]ClipPlane{
.Left,
.Right,
.Bottom,
.Top,
.Near,
.Far,
.left,
.right,
.bottom,
.top,
.near,
.far,
};
for (planes) |plane| {
@@ -131,12 +131,12 @@ pub fn viewportTransformVertex(viewport: vk.Viewport, vertex: *Vertex) void {
fn clipDistance(position: F32x4, plane: ClipPlane) f32 {
const x, const y, const z, const w = position;
return switch (plane) {
.Left => x + w,
.Right => w - x,
.Bottom => y + w,
.Top => w - y,
.Near => z,
.Far => w - z,
.left => x + w,
.right => w - x,
.bottom => y + w,
.top => w - y,
.near => z,
.far => w - z,
};
}
@@ -173,7 +173,7 @@ fn interpolateVertexForClipping(allocator: std.mem.Allocator, a: *const Vertex,
.primitive_restart = false,
.position = a.position + ((b.position - a.position) * zm.f32x4s(t)),
.point_size = a.point_size + ((b.point_size - a.point_size) * t),
.outputs = undefined,
.outputs = @splat(@splat(null)),
};
for (&result.outputs) |*location| {
+4 -4
View File
@@ -8,10 +8,8 @@ const VertexInterpolationLocation = @import("rasterizer/common.zig").VertexInter
const ExecutionDevice = @import("Device.zig");
const Renderer = @import("Renderer.zig");
const SoftImage = @import("../SoftImage.zig");
const SoftPipeline = @import("../SoftPipeline.zig");
const VkError = base.VkError;
const SpvRuntimeError = spv.Runtime.RuntimeError;
const INTERFACE_BLOB_PADDING = @sizeOf(zm.F32x4);
const PROCESSED_INPUTS_STACK_CAPACITY = 4096;
@@ -49,8 +47,10 @@ pub fn shaderInvocation(
const io = draw_call.renderer.device.interface.io();
// SAFETY: fragment dispatch only occurs after a graphics pipeline has been bound.
const pipeline = draw_call.renderer.state.pipeline orelse return undefined;
// SAFETY: fragment dispatch only occurs when the bound pipeline has a fragment stage.
const shader = pipeline.stages.getPtr(.fragment) orelse return undefined;
const runtime = &shader.runtimes[batch_id];
const mutex = &runtime.mutex;
@@ -245,7 +245,7 @@ pub fn shaderInvocation(
}
var depth: ?f32 = null;
var frag_depth: f32 = undefined;
var frag_depth: f32 = 0;
if (rt.readBuiltIn(std.mem.asBytes(&frag_depth), .FragDepth)) {
depth = frag_depth;
} else |err| switch (err) {
@@ -254,7 +254,7 @@ pub fn shaderInvocation(
}
var sample_mask: ?vk.SampleMask = null;
var frag_sample_mask: [1]vk.SampleMask = undefined;
var frag_sample_mask: [1]vk.SampleMask = .{0};
if (rt.readBuiltIn(std.mem.asBytes(&frag_sample_mask), .SampleMask)) {
sample_mask = frag_sample_mask[0];
} else |err| switch (err) {
+1 -1
View File
@@ -133,7 +133,7 @@ pub fn processThenFragmentStage(renderer: *Renderer, allocator: std.mem.Allocato
);
const color_attachment_subresource_size = renderTargetSubresourceSize(render_target, render_target_view, color_range.aspect_mask, color_range.base_mip_level);
access.* = .{
.mutex = undefined,
.mutex = .init,
.base = try render_target.mapAsSliceWithAddedOffset(u8, color_attachment_subresource_offset, color_attachment_subresource_size),
.row_pitch = render_target.getRowPitchMemSizeForMipLevelWithFormat(color_range.aspect_mask, color_range.base_mip_level, color_format),
.texel_size = base.format.texelSize(color_format),
@@ -8,7 +8,6 @@ const common = @import("common.zig");
const fragment = @import("../fragment.zig");
const Renderer = @import("../Renderer.zig");
const SoftImage = @import("../../SoftImage.zig");
const VkError = base.VkError;
const SpvRuntimeError = spv.Runtime.RuntimeError;
+6 -6
View File
@@ -53,14 +53,14 @@ pub fn clampDepthBias(bias: f32, clamp: f32) f32 {
}
pub fn scissorContainsPixel(scissor: vk.Rect2D, x: i32, y: i32) bool {
const min_x: i64 = @as(i64, scissor.offset.x);
const min_y: i64 = @as(i64, scissor.offset.y);
const min_x: i64 = scissor.offset.x;
const min_y: i64 = scissor.offset.y;
const max_x: i64 = min_x + @as(i64, @intCast(scissor.extent.width));
const max_y: i64 = min_y + @as(i64, @intCast(scissor.extent.height));
const pixel_x: i64 = @as(i64, x);
const pixel_y: i64 = @as(i64, y);
const pixel_x: i64 = x;
const pixel_y: i64 = y;
return pixel_x >= min_x and
pixel_x < max_x and
@@ -69,8 +69,8 @@ pub fn scissorContainsPixel(scissor: vk.Rect2D, x: i32, y: i32) bool {
}
pub fn rectContainsPixel(rect: vk.Rect2D, x: usize, y: usize) bool {
const min_x: i64 = @as(i64, rect.offset.x);
const min_y: i64 = @as(i64, rect.offset.y);
const min_x: i64 = rect.offset.x;
const min_y: i64 = rect.offset.y;
const max_x: i64 = min_x + @as(i64, @intCast(rect.extent.width));
const max_y: i64 = min_y + @as(i64, @intCast(rect.extent.height));
@@ -485,6 +485,7 @@ inline fn run(data: RunData) !void {
centroid_b2,
);
const derivative_inputs: ?fragment.DerivativeInputs = if (data.fragment_uses_derivatives) blk: {
// SAFETY: both dx and dy are assigned below before derivatives is returned.
var derivatives: fragment.DerivativeInputs = undefined;
const p_dx = zm.f32x4(@as(f32, @floatFromInt(x)) + 1.5, @as(f32, @floatFromInt(y)) + 0.5, 0.0, 1.0);
+1 -1
View File
@@ -526,7 +526,7 @@ fn isConstantZero(rt: *spv.Runtime, result_word: spv.SpvWord) bool {
const variant = rt.results[result_word].variant orelse return false;
switch (variant) {
.Constant => |constant| {
var value: u32 = undefined;
var value: u32 = 0;
_ = constant.value.read(std.mem.asBytes(&value)) catch return false;
return value == 0;
},
+1 -2
View File
@@ -1,8 +1,6 @@
const std = @import("std");
const vk = @import("vulkan");
const NonDispatchable = @import("NonDispatchable.zig");
const VkError = @import("error_set.zig").VkError;
const Device = @import("Device.zig");
@@ -25,6 +23,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Semap
_ = info;
return .{
.owner = device,
// SAFETY: the backend assigns the vtable before returning the semaphore.
.vtable = undefined,
};
}
+1
View File
@@ -31,6 +31,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Buffe
.usage = info.usage,
.memory = null,
.allowed_memory_types = std.bit_set.IntegerBitSet(32).initFull(),
// SAFETY: the backend assigns the vtable before returning the buffer.
.vtable = undefined,
};
}
+1
View File
@@ -27,6 +27,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Buffe
return .{
.owner = device,
.buffer = try NonDispatchable(Buffer).fromHandleObject(info.buffer),
// SAFETY: the backend assigns the vtable before returning the buffer view.
.vtable = undefined,
.format = info.format,
.offset = info.offset,
+16 -14
View File
@@ -18,11 +18,11 @@ const QueryPool = @import("QueryPool.zig");
const RenderPass = @import("RenderPass.zig");
const State = enum {
Initial,
Recording,
Executable,
Pending,
Invalid,
initial,
recording,
executable,
pending,
invalid,
};
const Self = @This();
@@ -100,13 +100,15 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Comma
return .{
.owner = device,
.pool = try NonDispatchable(CommandPool).fromHandleObject(info.command_pool),
.state = .Initial,
.state = .initial,
.begin_info = null,
.usage_flags = .{},
.device_mask = 1,
.host_allocator = VulkanAllocator.from(allocator).cloneWithScope(.object),
.state_mutex = .init,
// SAFETY: the backend assigns both tables before returning the command buffer.
.vtable = undefined,
// SAFETY: the backend assigns both tables before returning the command buffer.
.dispatch_table = undefined,
};
}
@@ -128,9 +130,9 @@ pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void {
}
pub fn begin(self: *Self, info: *const vk.CommandBufferBeginInfo) VkError!void {
const implicitly_reset = self.state == .Executable or self.state == .Invalid;
const implicitly_reset = self.state == .executable or self.state == .invalid;
self.transitionState(.Recording, &.{ .Initial, .Executable, .Invalid }) catch return VkError.ValidationFailed;
self.transitionState(.recording, &.{ .initial, .executable, .invalid }) catch return VkError.ValidationFailed;
if (implicitly_reset) {
try self.dispatch_table.reset(self, .{});
self.begin_info = null;
@@ -143,7 +145,7 @@ pub fn begin(self: *Self, info: *const vk.CommandBufferBeginInfo) VkError!void {
}
pub fn end(self: *Self) VkError!void {
self.transitionState(.Executable, &.{.Recording}) catch return VkError.ValidationFailed;
self.transitionState(.executable, &.{.recording}) catch return VkError.ValidationFailed;
try self.dispatch_table.end(self);
}
@@ -156,7 +158,7 @@ pub fn reset(self: *Self, flags: vk.CommandBufferResetFlags) VkError!void {
}
pub fn resetFromPool(self: *Self, flags: vk.CommandBufferResetFlags) VkError!void {
self.transitionState(.Initial, &.{ .Initial, .Recording, .Executable, .Invalid }) catch return VkError.ValidationFailed;
self.transitionState(.initial, &.{ .initial, .recording, .executable, .invalid }) catch return VkError.ValidationFailed;
try self.dispatch_table.reset(self, flags);
self.begin_info = null;
self.usage_flags = .{};
@@ -165,18 +167,18 @@ pub fn resetFromPool(self: *Self, flags: vk.CommandBufferResetFlags) VkError!voi
pub fn submit(self: *Self) VkError!void {
if (!self.usage_flags.simultaneous_use_bit) {
self.transitionState(.Pending, &.{.Executable}) catch return VkError.ValidationFailed;
self.transitionState(.pending, &.{.executable}) catch return VkError.ValidationFailed;
return;
}
self.transitionState(.Pending, &.{ .Pending, .Executable }) catch return VkError.ValidationFailed;
self.transitionState(.pending, &.{ .pending, .executable }) catch return VkError.ValidationFailed;
}
pub fn finish(self: *Self) VkError!void {
if (self.usage_flags.one_time_submit_bit) {
self.transitionState(.Invalid, &.{.Pending}) catch return VkError.ValidationFailed;
self.transitionState(.invalid, &.{.pending}) catch return VkError.ValidationFailed;
return;
}
self.transitionState(.Executable, &.{.Pending}) catch return VkError.ValidationFailed;
self.transitionState(.executable, &.{.pending}) catch return VkError.ValidationFailed;
}
// Commands ====================================================================================================
+2 -1
View File
@@ -44,6 +44,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Comma
.host_allocator = VulkanAllocator.from(allocator).clone(),
.buffers = std.ArrayList(*Dispatchable(CommandBuffer)).initCapacity(allocator, BUFFER_POOL_BASE_CAPACITY) catch return VkError.OutOfHostMemory,
.first_free_buffer_index = 0,
// SAFETY: the backend assigns the vtable before returning the command pool.
.vtable = undefined,
};
}
@@ -112,6 +113,6 @@ pub fn reset(self: *Self, flags: vk.CommandPoolResetFlags) VkError!void {
self.first_free_buffer_index = 0;
for (self.buffers.items) |dis_cmd| {
_ = dis_cmd.object.resetFromPool(.{ .release_resources_bit = flags.release_resources_bit }) catch {};
_ = dis_cmd.object.resetFromPool(.{ .release_resources_bit = flags.release_resources_bit }) catch @panic("Caught an error while handling an error");
}
}
+1 -1
View File
@@ -2,7 +2,6 @@ const std = @import("std");
const vk = @import("vulkan");
const VkError = @import("error_set.zig").VkError;
const NonDispatchable = @import("NonDispatchable.zig").NonDispatchable;
const Device = @import("Device.zig");
@@ -29,6 +28,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Descr
return .{
.owner = device,
.flags = info.flags,
// SAFETY: the backend assigns the vtable before returning the descriptor pool.
.vtable = undefined,
};
}
+1 -2
View File
@@ -1,8 +1,6 @@
const std = @import("std");
const vk = @import("vulkan");
const NonDispatchable = @import("NonDispatchable.zig");
const VkError = @import("error_set.zig").VkError;
const Device = @import("Device.zig");
@@ -29,6 +27,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, layout: *DescriptorSe
return .{
.owner = device,
.layout = layout,
// SAFETY: the backend assigns the vtable before returning the descriptor set.
.vtable = undefined,
};
}
+4 -3
View File
@@ -19,7 +19,7 @@ const BindingLayout = struct {
/// This slice points to an array located after the binding layouts array
immutable_samplers: []const *const Sampler,
driver_data: *anyopaque,
driver_data: ?*anyopaque,
};
owner: *Device,
@@ -77,7 +77,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Descr
.array_size = 0,
.dynamic_index = 0,
.immutable_samplers = &.{},
.driver_data = undefined,
.driver_data = null,
};
}
@@ -119,7 +119,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Descr
.array_size = descriptor_count,
.dynamic_index = dynamic_index,
.immutable_samplers = binding_immutable_samplers,
.driver_data = undefined,
.driver_data = null,
};
stages = stages.merge(binding_info.stage_flags);
@@ -134,6 +134,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Descr
.dynamic_descriptor_count = dynamic_descriptor_count,
.stages = stages,
.ref_count = std.atomic.Value(usize).init(1),
// SAFETY: the backend assigns the vtable before returning the descriptor set layout.
.vtable = undefined,
};
}
+3 -4
View File
@@ -4,7 +4,6 @@ const lib = @import("lib.zig");
const config = lib.config;
const Dispatchable = @import("Dispatchable.zig").Dispatchable;
const NonDispatchable = @import("NonDispatchable.zig").NonDispatchable;
const VulkanAllocator = @import("VulkanAllocator.zig");
const VkError = @import("error_set.zig").VkError;
@@ -16,7 +15,6 @@ const Buffer = @import("Buffer.zig");
const BufferView = @import("BufferView.zig");
const CommandPool = @import("CommandPool.zig");
const DescriptorPool = @import("DescriptorPool.zig");
const DescriptorSet = @import("DescriptorSet.zig");
const DescriptorSetLayout = @import("DescriptorSetLayout.zig");
const DeviceMemory = @import("DeviceMemory.zig");
const Event = @import("Event.zig");
@@ -34,7 +32,6 @@ const Sampler = @import("Sampler.zig");
const ShaderModule = @import("ShaderModule.zig");
const SurfaceKHR = @import("wsi/SurfaceKHR.zig");
const SwapchainKHR = @import("wsi/SwapchainKHR.zig");
const Self = @This();
pub const ObjectType: vk.ObjectType = .device;
@@ -120,7 +117,9 @@ pub fn init(allocator: std.mem.Allocator, instance: *Instance, physical_device:
.enabled_khr_swapchain = enabled_khr_swapchain,
.enabled_khr_device_group = enabled_khr_device_group,
.device_allocator = if (config.device_debug_allocator) .init else .{},
// SAFETY: the backend assigns both tables before returning the device.
.dispatch_table = undefined,
// SAFETY: the backend assigns both tables before returning the device.
.vtable = undefined,
};
}
@@ -141,7 +140,7 @@ pub fn createQueues(self: *Self, allocator: std.mem.Allocator, info: *const vk.D
}
const queue = try self.vtable.createQueue(allocator, self, queue_info.queue_family_index, @intCast(family_ptr.items.len), queue_info.flags);
errdefer self.vtable.destroyQueue(queue, allocator) catch {};
errdefer self.vtable.destroyQueue(queue, allocator) catch @panic("Caught an error while handling an error");
const dispatchable_queue = try Dispatchable(Queue).wrap(allocator, queue);
errdefer dispatchable_queue.destroy(allocator);
+1
View File
@@ -28,6 +28,7 @@ pub fn init(device: *Device, size: vk.DeviceSize, memory_type_index: u32) VkErro
.size = size,
.memory_type_index = memory_type_index,
.is_mapped = false,
// SAFETY: the backend assigns the vtable before returning device memory.
.vtable = undefined,
};
}
+1 -2
View File
@@ -1,8 +1,6 @@
const std = @import("std");
const vk = @import("vulkan");
const NonDispatchable = @import("NonDispatchable.zig");
const VkError = @import("error_set.zig").VkError;
const Device = @import("Device.zig");
@@ -27,6 +25,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Event
_ = info;
return .{
.owner = device,
// SAFETY: the backend assigns the vtable before returning the event.
.vtable = undefined,
};
}
+1
View File
@@ -25,6 +25,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Fence
return .{
.owner = device,
.flags = info.flags,
// SAFETY: the backend assigns the vtable before returning the fence.
.vtable = undefined,
};
}
+1
View File
@@ -44,6 +44,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Frame
.height = @intCast(info.height),
.layers = @intCast(info.layers),
.attachments = attachments,
// SAFETY: the backend assigns the vtable before returning the framebuffer.
.vtable = undefined,
};
}
+1
View File
@@ -53,6 +53,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Image
.memory = null,
.memory_offset = 0,
.allowed_memory_types = std.bit_set.IntegerBitSet(32).initFull(),
// SAFETY: the backend assigns the vtable before returning the image.
.vtable = undefined,
};
}
+1 -1
View File
@@ -1,6 +1,5 @@
const std = @import("std");
const vk = @import("vulkan");
const lib = @import("lib.zig");
const VkError = @import("error_set.zig").VkError;
const NonDispatchable = @import("NonDispatchable.zig").NonDispatchable;
@@ -33,6 +32,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Image
.format = info.format,
.components = info.components,
.subresource_range = info.subresource_range,
// SAFETY: the backend assigns the vtable before returning the image view.
.vtable = undefined,
};
}
+2 -7
View File
@@ -1,7 +1,6 @@
const std = @import("std");
const builtin = @import("builtin");
const vk = @import("vulkan");
const config = @import("lib.zig").config;
const utils = @import("utils.zig");
const drm = @import("drm.zig");
const lib = @import("lib.zig");
@@ -23,12 +22,6 @@ comptime {
const Self = @This();
pub const ObjectType: vk.ObjectType = .instance;
const DeviceAllocator = struct {
pub inline fn allocator(_: @This()) std.mem.Allocator {
return std.heap.smp_allocator;
}
};
/// Dummy
pub const EXTENSIONS = [_]vk.ExtensionProperties{};
@@ -52,7 +45,9 @@ pub fn init(allocator: std.mem.Allocator, infos: *const vk.InstanceCreateInfo) V
_ = infos;
return .{
.physical_devices = .empty,
// SAFETY: the backend assigns both tables before returning the instance.
.dispatch_table = undefined,
// SAFETY: the backend assigns both tables before returning the instance.
.vtable = undefined,
};
}
+9 -8
View File
@@ -38,25 +38,26 @@ pub fn init(allocator: std.mem.Allocator, instance: *Instance) VkError!Self {
_ = allocator;
return .{
.props = .{
.api_version = undefined,
.driver_version = undefined,
.api_version = 0,
.driver_version = 0,
.vendor_id = root.VULKAN_VENDOR_ID,
.device_id = undefined,
.device_type = undefined,
.device_id = 0,
.device_type = .other,
.device_name = @as([vk.MAX_PHYSICAL_DEVICE_NAME_SIZE]u8, @splat(0)),
.pipeline_cache_uuid = undefined,
.pipeline_cache_uuid = @splat(0),
.limits = std.mem.zeroInit(vk.PhysicalDeviceLimits, .{}),
.sparse_properties = undefined,
.sparse_properties = std.mem.zeroes(vk.PhysicalDeviceSparseProperties),
},
.mem_props = .{
.memory_type_count = 0,
.memory_types = undefined,
.memory_types = @splat(.{ .heap_index = 0 }),
.memory_heap_count = 0,
.memory_heaps = undefined,
.memory_heaps = @splat(.{ .size = 0 }),
},
.queue_family_props = .empty,
.features = .{},
.instance = instance,
// SAFETY: the backend assigns the dispatch table before returning the physical device.
.dispatch_table = undefined,
};
}
+2
View File
@@ -83,6 +83,7 @@ pub fn initCompute(device: *Device, allocator: std.mem.Allocator, cache: ?*Pipel
return .{
.owner = device,
// SAFETY: the backend assigns the vtable before returning the compute pipeline.
.vtable = undefined,
.bind_point = .compute,
.stages = info.stage.stage,
@@ -132,6 +133,7 @@ pub fn initGraphics(device: *Device, allocator: std.mem.Allocator, cache: ?*Pipe
return .{
.owner = device,
// SAFETY: the backend assigns the vtable before returning the graphics pipeline.
.vtable = undefined,
.bind_point = .graphics,
.stages = stages,
+1 -2
View File
@@ -1,8 +1,6 @@
const std = @import("std");
const vk = @import("vulkan");
const NonDispatchable = @import("NonDispatchable.zig");
const VkError = @import("error_set.zig").VkError;
const root = @import("lib.zig");
@@ -42,6 +40,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Pipel
return .{
.owner = device,
.data = data,
// SAFETY: the backend assigns the vtable before returning the pipeline cache.
.vtable = undefined,
};
}
+2 -1
View File
@@ -39,8 +39,9 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Pipel
.set_layouts = [_]?*DescriptorSetLayout{null} ** lib.VULKAN_MAX_DESCRIPTOR_SETS,
.dynamic_descriptor_offsets = [_]usize{0} ** lib.VULKAN_MAX_DESCRIPTOR_SETS,
.push_ranges_count = info.push_constant_range_count,
.push_ranges = undefined,
.push_ranges = @splat(std.mem.zeroes(vk.PushConstantRange)),
.ref_count = std.atomic.Value(usize).init(1),
// SAFETY: the backend assigns the vtable before returning the pipeline layout.
.vtable = undefined,
};

Some files were not shown because too many files have changed in this diff Show More