adding Vulkan conformance tests as a step
This commit is contained in:
@@ -11,7 +11,7 @@ pub const Interface = base.Fence;
|
||||
interface: Interface,
|
||||
mutex: std.Thread.Mutex,
|
||||
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
|
||||
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,
|
||||
.mutex = std.Thread.Mutex{},
|
||||
.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),
|
||||
};
|
||||
return self;
|
||||
@@ -46,33 +46,25 @@ pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) void {
|
||||
|
||||
pub fn getStatus(interface: *Interface) VkError!void {
|
||||
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
|
||||
self.mutex.lock();
|
||||
defer self.mutex.unlock();
|
||||
if (!self.is_signaled) {
|
||||
if (!self.is_signaled.load(.monotonic)) {
|
||||
return VkError.NotReady;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reset(interface: *Interface) VkError!void {
|
||||
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
|
||||
self.mutex.lock();
|
||||
defer self.mutex.unlock();
|
||||
self.is_signaled = false;
|
||||
self.is_signaled.store(false, .monotonic);
|
||||
}
|
||||
|
||||
pub fn signal(interface: *Interface) VkError!void {
|
||||
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
|
||||
{
|
||||
self.mutex.lock();
|
||||
defer self.mutex.unlock();
|
||||
self.is_signaled = true;
|
||||
}
|
||||
self.is_signaled.store(true, .monotonic);
|
||||
self.condition.broadcast();
|
||||
}
|
||||
|
||||
pub fn wait(interface: *Interface, timeout: u64) VkError!void {
|
||||
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;
|
||||
|
||||
self.mutex.lock();
|
||||
|
||||
Reference in New Issue
Block a user