adding Vulkan conformance tests as a step

This commit is contained in:
2025-12-03 23:50:52 +01:00
parent ff1317d412
commit 1def0692bb
9 changed files with 16102 additions and 18 deletions

16060
TestResults.qpa git.filemode.normal_file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
const std = @import("std"); const std = @import("std");
const Step = std.Build.Step; const Step = std.Build.Step;
const zcc = @import("compile_commands"); const zcc = @import("compile_commands");
const builtin = @import("builtin");
const ImplementationDesc = struct { const ImplementationDesc = struct {
name: []const u8, name: []const u8,
@@ -133,6 +134,25 @@ pub fn build(b: *std.Build) !void {
const run_c_test_gdb_step = b.step(b.fmt("test-c-{s}-gdb", .{impl.name}), b.fmt("Run lib{s} C test within gdb", .{impl.name})); const run_c_test_gdb_step = b.step(b.fmt("test-c-{s}-gdb", .{impl.name}), b.fmt("Run lib{s} C test within gdb", .{impl.name}));
run_c_test_gdb_step.dependOn(&run_c_test_gdb_exe.step); run_c_test_gdb_step.dependOn(&run_c_test_gdb_exe.step);
const cts = b.dependency("cts_bin", .{});
const cts_exe_path = cts.path(b.fmt("deqp-vk-{s}", .{
switch (if (target.query.os_tag) |tag| tag else builtin.target.os.tag) {
.linux => "linux.x86_64",
else => unreachable,
},
}));
const run_cts = b.addSystemCommand(&[_][]const u8{
try cts_exe_path.getPath3(b, null).toString(b.allocator),
b.fmt("--deqp-caselist-file={s}", .{try cts.path("mustpass/1.0.0/vk-default.txt").getPath3(b, null).toString(b.allocator)}),
b.fmt("--deqp-vk-library-path={s}/{s}", .{ b.getInstallPath(.lib, ""), lib.out_lib_filename }),
});
run_cts.step.dependOn(&lib_install.step);
const run_cts_step = b.step(b.fmt("test-conformance-{s}", .{impl.name}), b.fmt("Run Vulkan conformance tests for {s}", .{impl.name}));
run_cts_step.dependOn(&run_cts.step);
} }
const autodoc_test = b.addObject(.{ const autodoc_test = b.addObject(.{

View File

@@ -25,6 +25,10 @@
.url = "git+https://github.com/FObersteiner/zdt/?ref=v0.8.1#8b551a0a3e5ae64a32b5bad0e6a93119787b43af", .url = "git+https://github.com/FObersteiner/zdt/?ref=v0.8.1#8b551a0a3e5ae64a32b5bad0e6a93119787b43af",
.hash = "zdt-0.8.1-xr0_vAxUDwCJRDh9pcAS_mdZBIsvcGTtN-K8JJSWY4I6", .hash = "zdt-0.8.1-xr0_vAxUDwCJRDh9pcAS_mdZBIsvcGTtN-K8JJSWY4I6",
}, },
.cts_bin = .{
.url = "git+https://github.com/Kbz-8/Vulkan-CTS-bin#f0317494ed3784c17cf44a4f59a40d9c868073d2",
.hash = "N-V-__8AAK0SyAbVT6fSdbtrr5f3TaxffmQDtge6sMrLN-R5",
},
.cpuinfo = .{ .cpuinfo = .{
.url = "git+https://github.com/Kbz-8/cpuinfo-zig#77f82a1248194e7fb706967343c66021f8522766", .url = "git+https://github.com/Kbz-8/cpuinfo-zig#77f82a1248194e7fb706967343c66021f8522766",
.hash = "cpuinfo-0.1.0-V7dMLcghAADJuG7dkd3MnwDPZ232pBK_8uGjxY43eP5u", .hash = "cpuinfo-0.1.0-V7dMLcghAADJuG7dkd3MnwDPZ232pBK_8uGjxY43eP5u",
@@ -43,6 +47,7 @@
.stb = .{ .stb = .{
.url = "git+https://github.com/nothings/stb#f1c79c02822848a9bed4315b12c8c8f3761e1296", .url = "git+https://github.com/nothings/stb#f1c79c02822848a9bed4315b12c8c8f3761e1296",
.hash = "N-V-__8AABQ7TgCnPlp8MP4YA8znrjd6E-ZjpF1rvrS8J_2I", .hash = "N-V-__8AABQ7TgCnPlp8MP4YA8znrjd6E-ZjpF1rvrS8J_2I",
.lazy = true,
}, },
}, },
@@ -50,6 +55,7 @@
"build.zig", "build.zig",
"build.zig.zon", "build.zig.zon",
"src", "src",
"test",
"LICENSE", "LICENSE",
}, },
} }

BIN
shadercache.bin git.filemode.normal_file

Binary file not shown.

View File

@@ -11,7 +11,7 @@ pub const Interface = base.Fence;
interface: Interface, interface: Interface,
mutex: std.Thread.Mutex, mutex: std.Thread.Mutex,
condition: std.Thread.Condition, condition: std.Thread.Condition,
is_signaled: bool, is_signaled: std.atomic.Value(bool),
/// Used by impl queues to know when the fence should be signaled /// Used by impl queues to know when the fence should be signaled
concurrent_submits_count: std.atomic.Value(usize), concurrent_submits_count: std.atomic.Value(usize),
@@ -33,7 +33,7 @@ pub fn create(device: *Device, allocator: std.mem.Allocator, info: *const vk.Fen
.interface = interface, .interface = interface,
.mutex = std.Thread.Mutex{}, .mutex = std.Thread.Mutex{},
.condition = std.Thread.Condition{}, .condition = std.Thread.Condition{},
.is_signaled = info.flags.signaled_bit, .is_signaled = std.atomic.Value(bool).init(info.flags.signaled_bit),
.concurrent_submits_count = std.atomic.Value(usize).init(0), .concurrent_submits_count = std.atomic.Value(usize).init(0),
}; };
return self; return self;
@@ -46,33 +46,25 @@ pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) void {
pub fn getStatus(interface: *Interface) VkError!void { pub fn getStatus(interface: *Interface) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface)); const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
self.mutex.lock(); if (!self.is_signaled.load(.monotonic)) {
defer self.mutex.unlock();
if (!self.is_signaled) {
return VkError.NotReady; return VkError.NotReady;
} }
} }
pub fn reset(interface: *Interface) VkError!void { pub fn reset(interface: *Interface) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface)); const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
self.mutex.lock(); self.is_signaled.store(false, .monotonic);
defer self.mutex.unlock();
self.is_signaled = false;
} }
pub fn signal(interface: *Interface) VkError!void { pub fn signal(interface: *Interface) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface)); const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
{ self.is_signaled.store(true, .monotonic);
self.mutex.lock();
defer self.mutex.unlock();
self.is_signaled = true;
}
self.condition.broadcast(); self.condition.broadcast();
} }
pub fn wait(interface: *Interface, timeout: u64) VkError!void { pub fn wait(interface: *Interface, timeout: u64) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface)); const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
if (self.is_signaled) return; if (self.is_signaled.load(.monotonic)) return;
if (timeout == 0) return VkError.Timeout; if (timeout == 0) return VkError.Timeout;
self.mutex.lock(); self.mutex.lock();

View File

@@ -78,6 +78,13 @@ pub inline fn bindSparse(self: *Self, info: []const vk.BindSparseInfo, fence: ?*
} }
pub inline fn submit(self: *Self, infos: []const vk.SubmitInfo, p_fence: ?*Fence) VkError!void { pub inline fn submit(self: *Self, infos: []const vk.SubmitInfo, p_fence: ?*Fence) VkError!void {
if (infos.len == 0) {
if (p_fence) |fence| {
try fence.signal();
}
return;
}
const allocator = self.host_allocator.cloneWithScope(.command).allocator(); const allocator = self.host_allocator.cloneWithScope(.command).allocator();
var submit_infos = try SubmitInfo.initBlob(allocator, infos); var submit_infos = try SubmitInfo.initBlob(allocator, infos);

View File

@@ -90,7 +90,6 @@ fn free(context: *anyopaque, ptr: []u8, alignment: Alignment, ret_addr: usize) v
pfn_free(self.callbacks.?.p_user_data, ptr.ptr); pfn_free(self.callbacks.?.p_user_data, ptr.ptr);
} }
} }
getFallbackAllocator().rawFree(ptr, alignment, ret_addr); getFallbackAllocator().rawFree(ptr, alignment, ret_addr);
} }
@@ -99,6 +98,6 @@ inline fn getFallbackAllocator() std.mem.Allocator {
@branchHint(.unlikely); @branchHint(.unlikely);
return debug_allocator.allocator(); return debug_allocator.allocator();
} else { } else {
return std.heap.c_allocator; return std.heap.page_allocator;
} }
} }

View File

@@ -205,6 +205,7 @@ const device_pfn_map = block: {
functionMapEntryPoint("vkFreeMemory"), functionMapEntryPoint("vkFreeMemory"),
functionMapEntryPoint("vkGetBufferMemoryRequirements"), functionMapEntryPoint("vkGetBufferMemoryRequirements"),
functionMapEntryPoint("vkGetDeviceMemoryCommitment"), functionMapEntryPoint("vkGetDeviceMemoryCommitment"),
functionMapEntryPoint("vkGetDeviceProcAddr"),
functionMapEntryPoint("vkGetDeviceQueue"), functionMapEntryPoint("vkGetDeviceQueue"),
functionMapEntryPoint("vkGetEventStatus"), functionMapEntryPoint("vkGetEventStatus"),
functionMapEntryPoint("vkGetFenceStatus"), functionMapEntryPoint("vkGetFenceStatus"),
@@ -497,8 +498,6 @@ pub export fn strollQueueSubmit(p_queue: vk.Queue, count: u32, info: [*]const vk
entryPointBeginLogTrace(.vkQueueSubmit); entryPointBeginLogTrace(.vkQueueSubmit);
defer entryPointEndLogTrace(); defer entryPointEndLogTrace();
if (count == 0) return .success;
const queue = Dispatchable(Queue).fromHandleObject(p_queue) catch |err| return toVkResult(err); const queue = Dispatchable(Queue).fromHandleObject(p_queue) catch |err| return toVkResult(err);
const fence = if (p_fence != .null_handle) NonDispatchable(Fence).fromHandleObject(p_fence) catch |err| return toVkResult(err) else null; const fence = if (p_fence != .null_handle) NonDispatchable(Fence).fromHandleObject(p_fence) catch |err| return toVkResult(err) else null;
queue.submit(info[0..count], fence) catch |err| return toVkResult(err); queue.submit(info[0..count], fence) catch |err| return toVkResult(err);

View File

@@ -56,6 +56,7 @@ pub inline fn disableIndent() void {
pub inline fn freeInnerDebugStack() void { pub inline fn freeInnerDebugStack() void {
debug_stack.deinit(std.heap.c_allocator); debug_stack.deinit(std.heap.c_allocator);
debug_stack = .empty;
} }
pub inline fn fixme(comptime format: []const u8, args: anytype) void { pub inline fn fixme(comptime format: []const u8, args: anytype) void {