fixing vertex outputs
Test / build_and_test (push) Successful in 2m19s
Build / build (push) Successful in 4m2s

This commit is contained in:
2026-07-02 21:00:56 +02:00
parent 23c3731f06
commit d4ac14ae92
22 changed files with 259 additions and 85 deletions
+21
View File
@@ -1,5 +1,7 @@
const std = @import("std");
const vk = @import("vulkan");
const lib = @import("lib.zig");
const config = lib.config;
const Dispatchable = @import("Dispatchable.zig").Dispatchable;
const NonDispatchable = @import("NonDispatchable.zig").NonDispatchable;
@@ -37,10 +39,17 @@ const SwapchainKHR = @import("wsi/SwapchainKHR.zig");
const Self = @This();
pub const ObjectType: vk.ObjectType = .device;
const DeviceAllocator = struct {
pub inline fn allocator(_: @This()) std.mem.Allocator {
return lib.fallback_host_allocator;
}
};
instance: *Instance,
physical_device: *const PhysicalDevice,
queues: std.AutoArrayHashMapUnmanaged(u32, std.ArrayList(*Dispatchable(Queue))),
host_allocator: VulkanAllocator,
device_allocator: if (config.device_debug_allocator) std.heap.DebugAllocator(.{}) else DeviceAllocator,
enabled_khr_swapchain: bool,
enabled_khr_device_group: bool,
@@ -110,6 +119,7 @@ pub fn init(allocator: std.mem.Allocator, instance: *Instance, physical_device:
.host_allocator = VulkanAllocator.from(allocator).cloneWithScope(.object),
.enabled_khr_swapchain = enabled_khr_swapchain,
.enabled_khr_device_group = enabled_khr_device_group,
.device_allocator = if (config.device_debug_allocator) .init else .{},
.dispatch_table = undefined,
.vtable = undefined,
};
@@ -154,6 +164,17 @@ pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) VkError!void {
family.deinit(allocator);
}
self.queues.deinit(allocator);
if (config.device_debug_allocator) {
// All device memory allocations should've been freed by now
const leaks = self.device_allocator.detectLeaks();
if (leaks != 0)
std.log.scoped(.vkDestroyDevice).err("Device was destroyed leaking {d:.3}KB", .{@as(f32, @floatFromInt(leaks)) / 1000})
else
std.log.scoped(.vkDestroyDevice).debug("No device memory leaks detected", .{});
self.device_allocator.deinitWithoutLeakChecks();
}
try self.dispatch_table.destroy(self, allocator);
}
+2
View File
@@ -45,6 +45,7 @@ mode: union(enum) {
scissor: ?[]vk.Rect2D,
},
rasterization: struct {
rasterizer_discard_enable: bool,
polygon_mode: vk.PolygonMode,
cull_mode: vk.CullModeFlags,
front_face: vk.FrontFace,
@@ -194,6 +195,7 @@ pub fn initGraphics(device: *Device, allocator: std.mem.Allocator, cache: ?*Pipe
},
},
.rasterization = .{
.rasterizer_discard_enable = rasterizer_discard_enable,
.polygon_mode = if (info.p_rasterization_state) |state| state.polygon_mode else return VkError.ValidationFailed,
.cull_mode = if (info.p_rasterization_state) |state| state.cull_mode else return VkError.ValidationFailed,
.front_face = if (info.p_rasterization_state) |state| state.front_face else return VkError.ValidationFailed,