fixing debug allocator
Build / build (push) Successful in 4m14s
Test / build_and_test (push) Has been cancelled

This commit is contained in:
2026-05-08 14:23:49 +02:00
parent eb743c914e
commit e793cb6c3f
9 changed files with 72 additions and 28 deletions
+2 -12
View File
@@ -61,26 +61,16 @@ jobs:
which deqp-runner && deqp-runner --version || echo "deqp-runner not found" which deqp-runner && deqp-runner --version || echo "deqp-runner not found"
- name: Run Vulkan CTS - name: Run Vulkan CTS
run: | run: zig build cts-soft --release=fast -Ddebug-allocator=true -- -j1
set +e
zig build cts-soft --release=fast -- -j1 --timeout 5 --no-progress
status=$?
echo "CTS exited with $status"
find . -name 'log.json' -o -name 'summary.csv' -o -name 'results.csv'
exit 0
continue-on-error: true continue-on-error: true
- name: Upload CTS runner logs - name: Upload CTS runner logs
if: always() if: always()
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: cts-runner-logs name: cts-runner-logs
path: | path: |
**/log.json cts/results.csv
**/summary.csv
**/results.csv
**/fails/**
- name: Verify tests - name: Verify tests
run: ls cts | grep "results.csv"; run: ls cts | grep "results.csv";
+7 -8
View File
@@ -39,7 +39,7 @@ Assume thou that functions lacking in this array are, for now, not intended to b
Name | Status Name | Status
-------------------------------------------------|-------- -------------------------------------------------|--------
vkAcquireNextImageKHR | ⚙️ WIP vkAcquireNextImageKHR | ✅ Implemented
vkAllocateCommandBuffers | ✅ Implemented vkAllocateCommandBuffers | ✅ Implemented
vkAllocateDescriptorSets | ✅ Implemented vkAllocateDescriptorSets | ✅ Implemented
vkAllocateMemory | ✅ Implemented vkAllocateMemory | ✅ Implemented
@@ -138,14 +138,13 @@ vkDestroySampler | ✅ Implemented
vkDestroySemaphore | ✅ Implemented vkDestroySemaphore | ✅ Implemented
vkDestroyShaderModule | ✅ Implemented vkDestroyShaderModule | ✅ Implemented
vkDestroySurfaceKHR | ✅ Implemented vkDestroySurfaceKHR | ✅ Implemented
vkDestroySwapchainKHR | ⚙️ WIP
vkDestroySwapchainKHR | ✅ Implemented vkDestroySwapchainKHR | ✅ Implemented
vkDeviceWaitIdle | ✅ Implemented vkDeviceWaitIdle | ✅ Implemented
vkEndCommandBuffer | ✅ Implemented vkEndCommandBuffer | ✅ Implemented
vkEnumerateDeviceExtensionProperties | ⚙️ WIP vkEnumerateDeviceExtensionProperties | ✅ Implemented
vkEnumerateDeviceLayerProperties | ⚙️ WIP vkEnumerateDeviceLayerProperties | ✅ Implemented
vkEnumerateInstanceExtensionProperties | ⚙️ WIP vkEnumerateInstanceExtensionProperties | ✅ Implemented
vkEnumerateInstanceLayerProperties | ⚙️ WIP vkEnumerateInstanceLayerProperties | ✅ Implemented
vkEnumeratePhysicalDevices | ✅ Implemented vkEnumeratePhysicalDevices | ✅ Implemented
vkFlushMappedMemoryRanges | ✅ Implemented vkFlushMappedMemoryRanges | ✅ Implemented
vkFreeCommandBuffers | ✅ Implemented vkFreeCommandBuffers | ✅ Implemented
@@ -172,14 +171,14 @@ vkGetPhysicalDeviceSurfaceCapabilitiesKHR | ✅ Implemented
vkGetPhysicalDeviceSurfaceFormatsKHR | ✅ Implemented vkGetPhysicalDeviceSurfaceFormatsKHR | ✅ Implemented
vkGetPhysicalDeviceSurfacePresentModesKHR | ✅ Implemented vkGetPhysicalDeviceSurfacePresentModesKHR | ✅ Implemented
vkGetPhysicalDeviceSurfaceSupportKHR | ✅ Implemented vkGetPhysicalDeviceSurfaceSupportKHR | ✅ Implemented
vkGetPhysicalDeviceWaylandPresentationSupportKHR | ⚙️ WIP vkGetPhysicalDeviceWaylandPresentationSupportKHR | ✅ Implemented
vkGetPhysicalDeviceWin32PresentationSupportKHR | ⚙️ WIP vkGetPhysicalDeviceWin32PresentationSupportKHR | ⚙️ WIP
vkGetPhysicalDeviceXcbPresentationSupportKHR | ⚙️ WIP vkGetPhysicalDeviceXcbPresentationSupportKHR | ⚙️ WIP
vkGetPhysicalDeviceXlibPresentationSupportKHR | ⚙️ WIP vkGetPhysicalDeviceXlibPresentationSupportKHR | ⚙️ WIP
vkGetPipelineCacheData | ⚙️ WIP vkGetPipelineCacheData | ⚙️ WIP
vkGetQueryPoolResults | ⚙️ WIP vkGetQueryPoolResults | ⚙️ WIP
vkGetRenderAreaGranularity | ⚙️ WIP vkGetRenderAreaGranularity | ⚙️ WIP
vkGetSwapchainImagesKHR | ⚙️ WIP vkGetSwapchainImagesKHR | ✅ Implemented
vkInvalidateMappedMemoryRanges | ✅ Implemented vkInvalidateMappedMemoryRanges | ✅ Implemented
vkMapMemory | ✅ Implemented vkMapMemory | ✅ Implemented
vkMergePipelineCaches | ⚙️ WIP vkMergePipelineCaches | ⚙️ WIP
+10 -2
View File
@@ -310,7 +310,15 @@ fn addMultithreadedCTS(b: *std.Build, target: std.Build.ResolvedTarget, impl: *c
} }
} }
const mustpass_path = try cts.path("vk-default.txt").getPath3(b, null).toString(b.allocator); var caselist_file_path: []const u8 = try cts.path("vk-default.txt").getPath3(b, null).toString(b.allocator);
if (b.args) |args| {
for (args) |arg| {
if (std.mem.startsWith(u8, arg, "--deqp-caselist-file")) {
caselist_file_path = arg["--deqp-caselist-file=".len..];
}
}
}
const cts_exe_path = try cts_exe_name.getPath3(b, null).toString(b.allocator); const cts_exe_path = try cts_exe_name.getPath3(b, null).toString(b.allocator);
const run = b.addSystemCommand(&[_][]const u8{"deqp-runner"}); const run = b.addSystemCommand(&[_][]const u8{"deqp-runner"});
@@ -320,7 +328,7 @@ fn addMultithreadedCTS(b: *std.Build, target: std.Build.ResolvedTarget, impl: *c
run.addArg("--deqp"); run.addArg("--deqp");
run.addArg(cts_exe_path); run.addArg(cts_exe_path);
run.addArg("--caselist"); run.addArg("--caselist");
run.addArg(mustpass_path); run.addArg(caselist_file_path);
run.addArg("--output"); run.addArg("--output");
run.addArg("./cts"); run.addArg("./cts");
if (jobs_count) |count| { if (jobs_count) |count| {
+5 -2
View File
@@ -93,9 +93,12 @@ pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) VkError!void
if (config.debug_allocator) { if (config.debug_allocator) {
// All device memory allocations should've been freed by now // All device memory allocations should've been freed by now
if (!self.device_allocator.detectLeaks()) { const leaks = self.device_allocator.detectLeaks();
if (leaks != 0)
std.log.scoped(.vkDestroyDevice).err("Device was destroyed leaking {d}KB", .{@divTrunc(leaks, 1000)})
else
std.log.scoped(.vkDestroyDevice).debug("No device memory leaks detected", .{}); std.log.scoped(.vkDestroyDevice).debug("No device memory leaks detected", .{});
} self.device_allocator.deinitWithoutLeakChecks();
} }
allocator.destroy(self); allocator.destroy(self);
+6
View File
@@ -44,6 +44,7 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance) VkError!*S
.getFormatProperties = getFormatProperties, .getFormatProperties = getFormatProperties,
.getImageFormatProperties = getImageFormatProperties, .getImageFormatProperties = getImageFormatProperties,
.getSparseImageFormatProperties = getSparseImageFormatProperties, .getSparseImageFormatProperties = getSparseImageFormatProperties,
.enumerateLayerProperties = enumerateLayerProperties,
.enumerateExtensionProperties = enumerateExtensionProperties, .enumerateExtensionProperties = enumerateExtensionProperties,
.release = destroy, .release = destroy,
@@ -248,6 +249,11 @@ pub fn createDevice(interface: *Interface, allocator: std.mem.Allocator, infos:
return &device.interface; return &device.interface;
} }
pub fn enumerateLayerProperties(_: *const Interface, count: *u32, p_properties: ?[*]vk.LayerProperties) VkError!void {
count.* = 0;
_ = p_properties;
}
pub fn enumerateExtensionProperties(_: *const Interface, layer_name: ?[]const u8, count: *u32, p_properties: ?[*]vk.ExtensionProperties) VkError!void { pub fn enumerateExtensionProperties(_: *const Interface, layer_name: ?[]const u8, count: *u32, p_properties: ?[*]vk.ExtensionProperties) VkError!void {
if (layer_name) |_| { if (layer_name) |_| {
return VkError.LayerNotPresent; return VkError.LayerNotPresent;
+14 -1
View File
@@ -50,7 +50,7 @@ pub fn init(allocator: std.mem.Allocator, infos: *const vk.InstanceCreateInfo) V
}; };
} }
/// Dummy for docs creation and stuff /// Dummy to avoid compile error in tests and doc generation
pub fn create(allocator: std.mem.Allocator, infos: *const vk.InstanceCreateInfo) VkError!*Self { pub fn create(allocator: std.mem.Allocator, infos: *const vk.InstanceCreateInfo) VkError!*Self {
_ = allocator; _ = allocator;
_ = infos; _ = infos;
@@ -62,6 +62,19 @@ pub fn deinit(self: *Self, allocator: std.mem.Allocator) VkError!void {
try self.dispatch_table.destroy(self, allocator); try self.dispatch_table.destroy(self, allocator);
} }
pub fn enumerateLayerProperties(count: *u32, p_properties: ?[*]vk.LayerProperties) VkError!void {
if (comptime !builtin.is_test and @hasDecl(root.Instance, "LAYERS")) {
count.* = root.Instance.LAYERS.len;
if (p_properties) |properties| {
for (root.Instance.LAYERS, properties[0..]) |layer, *prop| {
prop.* = layer;
}
}
} else {
count.* = 0;
}
}
pub fn enumerateExtensionProperties(layer_name: ?[]const u8, count: *u32, p_properties: ?[*]vk.ExtensionProperties) VkError!void { pub fn enumerateExtensionProperties(layer_name: ?[]const u8, count: *u32, p_properties: ?[*]vk.ExtensionProperties) VkError!void {
if (layer_name) |_| { if (layer_name) |_| {
return VkError.LayerNotPresent; return VkError.LayerNotPresent;
+5
View File
@@ -23,6 +23,7 @@ pub const DispatchTable = struct {
getImageFormatProperties: *const fn (*Self, vk.Format, vk.ImageType, vk.ImageTiling, vk.ImageUsageFlags, vk.ImageCreateFlags) VkError!vk.ImageFormatProperties, getImageFormatProperties: *const fn (*Self, vk.Format, vk.ImageType, vk.ImageTiling, vk.ImageUsageFlags, vk.ImageCreateFlags) VkError!vk.ImageFormatProperties,
getSparseImageFormatProperties: *const fn (*Self, vk.Format, vk.ImageType, vk.SampleCountFlags, vk.ImageTiling, vk.ImageUsageFlags, ?[*]vk.SparseImageFormatProperties) VkError!u32, getSparseImageFormatProperties: *const fn (*Self, vk.Format, vk.ImageType, vk.SampleCountFlags, vk.ImageTiling, vk.ImageUsageFlags, ?[*]vk.SparseImageFormatProperties) VkError!u32,
enumerateExtensionProperties: *const fn (*const Self, ?[]const u8, *u32, ?[*]vk.ExtensionProperties) VkError!void, enumerateExtensionProperties: *const fn (*const Self, ?[]const u8, *u32, ?[*]vk.ExtensionProperties) VkError!void,
enumerateLayerProperties: *const fn (*const Self, *u32, ?[*]vk.LayerProperties) VkError!void,
release: *const fn (*Self, std.mem.Allocator) VkError!void, release: *const fn (*Self, std.mem.Allocator) VkError!void,
// VK_KHR_get_physical_device_properties_2 // VK_KHR_get_physical_device_properties_2
@@ -71,6 +72,10 @@ pub inline fn enumerateExtensionProperties(self: *const Self, layer_name: ?[]con
return try self.dispatch_table.enumerateExtensionProperties(self, layer_name, count, p_properties); return try self.dispatch_table.enumerateExtensionProperties(self, layer_name, count, p_properties);
} }
pub inline fn enumerateLayerProperties(self: *const Self, count: *u32, p_properties: ?[*]vk.LayerProperties) VkError!void {
return try self.dispatch_table.enumerateLayerProperties(self, count, p_properties);
}
pub inline fn getImageFormatProperties( pub inline fn getImageFormatProperties(
self: *Self, self: *Self,
format: vk.Format, format: vk.Format,
+22 -2
View File
@@ -48,11 +48,11 @@ pub const SurfaceKHR = @import("wsi/SurfaceKHR.zig");
pub const SwapchainKHR = @import("wsi/SwapchainKHR.zig"); pub const SwapchainKHR = @import("wsi/SwapchainKHR.zig");
pub const WaylandSurfaceKHR = @import("wsi/WaylandSurfaceKHR.zig"); pub const WaylandSurfaceKHR = @import("wsi/WaylandSurfaceKHR.zig");
fn entryPointBeginLogTrace(comptime scope: @EnumLiteral()) void { inline fn entryPointBeginLogTrace(comptime scope: @EnumLiteral()) void {
std.log.scoped(scope).debug("Calling {s}...", .{@tagName(scope)}); std.log.scoped(scope).debug("Calling {s}...", .{@tagName(scope)});
} }
fn entryPointEndLogTrace() void {} inline fn entryPointEndLogTrace() void {}
inline fn notImplementedWarning() void { inline fn notImplementedWarning() void {
logger.fixme("function not yet implemented", .{}); logger.fixme("function not yet implemented", .{});
@@ -79,6 +79,7 @@ const icd_pfn_map = std.StaticStringMap(vk.PfnVoidFunction).initComptime(.{
const global_pfn_map = std.StaticStringMap(vk.PfnVoidFunction).initComptime(.{ const global_pfn_map = std.StaticStringMap(vk.PfnVoidFunction).initComptime(.{
functionMapEntryPoint("vkCreateInstance"), functionMapEntryPoint("vkCreateInstance"),
functionMapEntryPoint("vkEnumerateInstanceExtensionProperties"), functionMapEntryPoint("vkEnumerateInstanceExtensionProperties"),
functionMapEntryPoint("vkEnumerateInstanceLayerProperties"),
//functionMapEntryPoint("vkEnumerateInstanceVersion"), //functionMapEntryPoint("vkEnumerateInstanceVersion"),
functionMapEntryPoint("vkGetInstanceProcAddr"), functionMapEntryPoint("vkGetInstanceProcAddr"),
}); });
@@ -94,6 +95,7 @@ const instance_pfn_map = std.StaticStringMap(vk.PfnVoidFunction).initComptime(.{
const physical_device_pfn_map = std.StaticStringMap(vk.PfnVoidFunction).initComptime(.{ const physical_device_pfn_map = std.StaticStringMap(vk.PfnVoidFunction).initComptime(.{
functionMapEntryPoint("vkCreateDevice"), functionMapEntryPoint("vkCreateDevice"),
functionMapEntryPoint("vkEnumerateDeviceExtensionProperties"), functionMapEntryPoint("vkEnumerateDeviceExtensionProperties"),
functionMapEntryPoint("vkEnumerateDeviceLayerProperties"),
functionMapEntryPoint("vkGetPhysicalDeviceFeatures"), functionMapEntryPoint("vkGetPhysicalDeviceFeatures"),
functionMapEntryPoint("vkGetPhysicalDeviceFeatures2KHR"), functionMapEntryPoint("vkGetPhysicalDeviceFeatures2KHR"),
functionMapEntryPoint("vkGetPhysicalDeviceFormatProperties"), functionMapEntryPoint("vkGetPhysicalDeviceFormatProperties"),
@@ -316,6 +318,14 @@ pub export fn strollCreateInstance(info: *const vk.InstanceCreateInfo, callbacks
return .success; return .success;
} }
pub export fn strollEnumerateInstanceLayerProperties(property_count: *u32, properties: ?[*]vk.LayerProperties) callconv(vk.vulkan_call_conv) vk.Result {
entryPointBeginLogTrace(.vkEnumerateInstanceLayerProperties);
defer entryPointEndLogTrace();
Instance.enumerateLayerProperties(property_count, properties) catch |err| return toVkResult(err);
return .success;
}
pub export fn strollEnumerateInstanceExtensionProperties(p_layer_name: ?[*:0]const u8, property_count: *u32, properties: ?[*]vk.ExtensionProperties) callconv(vk.vulkan_call_conv) vk.Result { pub export fn strollEnumerateInstanceExtensionProperties(p_layer_name: ?[*:0]const u8, property_count: *u32, properties: ?[*]vk.ExtensionProperties) callconv(vk.vulkan_call_conv) vk.Result {
entryPointBeginLogTrace(.vkEnumerateInstanceExtensionProperties); entryPointBeginLogTrace(.vkEnumerateInstanceExtensionProperties);
defer entryPointEndLogTrace(); defer entryPointEndLogTrace();
@@ -328,6 +338,7 @@ pub export fn strollEnumerateInstanceExtensionProperties(p_layer_name: ?[*:0]con
return .success; return .success;
} }
/// Do not make it available to GetProcAddr until Vulkan 1.1 is implemented
pub export fn strollEnumerateInstanceVersion(version: *u32) callconv(vk.vulkan_call_conv) vk.Result { pub export fn strollEnumerateInstanceVersion(version: *u32) callconv(vk.vulkan_call_conv) vk.Result {
entryPointBeginLogTrace(.vkEnumerateInstanceVersion); entryPointBeginLogTrace(.vkEnumerateInstanceVersion);
defer entryPointEndLogTrace(); defer entryPointEndLogTrace();
@@ -382,6 +393,15 @@ pub export fn strollCreateDevice(p_physical_device: vk.PhysicalDevice, info: *co
return .success; return .success;
} }
pub export fn strollEnumerateDeviceLayerProperties(p_physical_device: vk.PhysicalDevice, property_count: *u32, properties: ?[*]vk.LayerProperties) callconv(vk.vulkan_call_conv) vk.Result {
entryPointBeginLogTrace(.vkEnumerateDeviceLayerProperties);
defer entryPointEndLogTrace();
const physical_device = Dispatchable(PhysicalDevice).fromHandleObject(p_physical_device) catch |err| return toVkResult(err);
physical_device.enumerateLayerProperties(property_count, properties) catch |err| return toVkResult(err);
return .success;
}
pub export fn strollEnumerateDeviceExtensionProperties(p_physical_device: vk.PhysicalDevice, p_layer_name: ?[*:0]const u8, property_count: *u32, properties: ?[*]vk.ExtensionProperties) callconv(vk.vulkan_call_conv) vk.Result { pub export fn strollEnumerateDeviceExtensionProperties(p_physical_device: vk.PhysicalDevice, p_layer_name: ?[*:0]const u8, property_count: *u32, properties: ?[*]vk.ExtensionProperties) callconv(vk.vulkan_call_conv) vk.Result {
entryPointBeginLogTrace(.vkEnumerateDeviceExtensionProperties); entryPointBeginLogTrace(.vkEnumerateDeviceExtensionProperties);
defer entryPointEndLogTrace(); defer entryPointEndLogTrace();
+1 -1
View File
@@ -2,7 +2,7 @@ FROM ubuntu:latest
WORKDIR /root WORKDIR /root
RUN apt update && apt install -y git rustup clang curl libgl1 libsm6 libwayland-egl1 libwayland-cursor0 libwayland-server0; RUN apt update && apt install -y git rustup clang curl libgl1 libsm6 libwayland-egl1 libwayland-cursor0 libwayland-server0 vim;
RUN rustup default stable; RUN rustup default stable;
RUN cargo install deqp-runner && cp $HOME/.cargo/bin/deqp-runner /usr/bin; RUN cargo install deqp-runner && cp $HOME/.cargo/bin/deqp-runner /usr/bin;
RUN curl -L https://github.com/marler8997/anyzig/releases/latest/download/anyzig-x86_64-linux.tar.gz | tar xz && mv zig /usr/bin/; RUN curl -L https://github.com/marler8997/anyzig/releases/latest/download/anyzig-x86_64-linux.tar.gz | tar xz && mv zig /usr/bin/;