ci skip; start of update to zig 0.16
This commit is contained in:
@@ -21,6 +21,7 @@ pub const VTable = struct {
|
||||
allocateDescriptorSet: *const fn (*Self, *DescriptorSetLayout) VkError!*DescriptorSet,
|
||||
destroy: *const fn (*Self, std.mem.Allocator) void,
|
||||
freeDescriptorSet: *const fn (*Self, *DescriptorSet) VkError!void,
|
||||
reset: *const fn (*Self, vk.DescriptorPoolResetFlags) VkError!void,
|
||||
};
|
||||
|
||||
pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.DescriptorPoolCreateInfo) VkError!Self {
|
||||
@@ -43,3 +44,7 @@ pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void {
|
||||
pub inline fn freeDescriptorSet(self: *Self, set: *DescriptorSet) VkError!void {
|
||||
try self.vtable.freeDescriptorSet(self, set);
|
||||
}
|
||||
|
||||
pub inline fn reset(self: *Self, flags: vk.DescriptorPoolResetFlags) VkError!void {
|
||||
try self.vtable.reset(self, flags);
|
||||
}
|
||||
|
||||
@@ -72,15 +72,6 @@ pub inline fn getMemoryRequirements(self: *Self, requirements: *vk.MemoryRequire
|
||||
try self.vtable.getMemoryRequirements(self, requirements);
|
||||
}
|
||||
|
||||
pub inline fn getClearFormat(self: *Self) vk.Format {
|
||||
return if (lib.vku.vkuFormatIsSINT(@intCast(@intFromEnum(self.format))))
|
||||
.r32g32b32a32_sint
|
||||
else if (lib.vku.vkuFormatIsUINT(@intCast(@intFromEnum(self.format))))
|
||||
.r32g32b32a32_uint
|
||||
else
|
||||
.r32g32b32a32_sfloat;
|
||||
}
|
||||
|
||||
pub inline fn getTexelSize(self: *const Self) usize {
|
||||
return lib.format.texelSize(self.format);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const vk = @import("vulkan");
|
||||
const config = @import("config");
|
||||
|
||||
const logger = @import("lib.zig").logger;
|
||||
|
||||
@@ -21,7 +22,15 @@ 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;
|
||||
}
|
||||
};
|
||||
|
||||
physical_devices: std.ArrayList(*Dispatchable(PhysicalDevice)),
|
||||
threaded: std.Io.Threaded,
|
||||
allocator: if (config.debug_allocator) std.heap.DebugAllocator(.{}) else DeviceAllocator,
|
||||
dispatch_table: *const DispatchTable,
|
||||
vtable: *const VTable,
|
||||
|
||||
|
||||
@@ -90,3 +90,31 @@ pub inline fn sliceMemSize(format: vk.Format, width: usize, height: usize) usize
|
||||
pub inline fn isDepthAndStencil(format: vk.Format) bool {
|
||||
return lib.vku.vkuFormatIsDepthAndStencil(@intCast(@intFromEnum(format)));
|
||||
}
|
||||
|
||||
pub inline fn isSrgb(format: vk.Format) bool {
|
||||
return lib.vku.vkuFormatIsSRGB(@intCast(@intFromEnum(format)));
|
||||
}
|
||||
|
||||
pub inline fn isSfloat(format: vk.Format) bool {
|
||||
return lib.vku.vkuFormatIsSFLOAT(@intCast(@intFromEnum(format)));
|
||||
}
|
||||
|
||||
pub inline fn isSint(format: vk.Format) bool {
|
||||
return lib.vku.vkuFormatIsSINT(@intCast(@intFromEnum(format)));
|
||||
}
|
||||
|
||||
pub inline fn isSnorm(format: vk.Format) bool {
|
||||
return lib.vku.vkuFormatIsSNORM(@intCast(@intFromEnum(format)));
|
||||
}
|
||||
|
||||
pub inline fn isUfloat(format: vk.Format) bool {
|
||||
return lib.vku.vkuFormatIsUFLOAT(@intCast(@intFromEnum(format)));
|
||||
}
|
||||
|
||||
pub inline fn isUint(format: vk.Format) bool {
|
||||
return lib.vku.vkuFormatIsUINT(@intCast(@intFromEnum(format)));
|
||||
}
|
||||
|
||||
pub inline fn isUnorm(format: vk.Format) bool {
|
||||
return lib.vku.vkuFormatIsUNORM(@intCast(@intFromEnum(format)));
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ pub const LogVerboseLevel = enum {
|
||||
TooMuch,
|
||||
};
|
||||
|
||||
pub inline fn getLogVerboseLevel() LogVerboseLevel {
|
||||
pub fn getLogVerboseLevel() LogVerboseLevel {
|
||||
const allocator = std.heap.c_allocator;
|
||||
const level = std.process.getEnvVarOwned(allocator, DRIVER_LOGS_ENV_NAME) catch return .None;
|
||||
defer allocator.free(level);
|
||||
|
||||
@@ -1517,28 +1517,18 @@ pub export fn strollResetCommandPool(p_device: vk.Device, p_pool: vk.CommandPool
|
||||
|
||||
Dispatchable(Device).checkHandleValidity(p_device) catch |err| return toVkResult(err);
|
||||
const pool = NonDispatchable(CommandPool).fromHandleObject(p_pool) catch |err| return toVkResult(err);
|
||||
|
||||
notImplementedWarning();
|
||||
|
||||
_ = pool;
|
||||
_ = flags;
|
||||
|
||||
return .error_unknown;
|
||||
pool.reset(flags) catch |err| return toVkResult(err);
|
||||
return .success;
|
||||
}
|
||||
|
||||
pub export fn strollResetDescriptorPool(p_device: vk.Device, p_pool: vk.DescriptorPool, flags: vk.CommandPoolResetFlags) callconv(vk.vulkan_call_conv) vk.Result {
|
||||
pub export fn strollResetDescriptorPool(p_device: vk.Device, p_pool: vk.DescriptorPool, flags: vk.DescriptorPoolResetFlags) callconv(vk.vulkan_call_conv) vk.Result {
|
||||
entryPointBeginLogTrace(.vkResetDescriptorPool);
|
||||
defer entryPointEndLogTrace();
|
||||
|
||||
Dispatchable(Device).checkHandleValidity(p_device) catch |err| return toVkResult(err);
|
||||
const pool = NonDispatchable(DescriptorPool).fromHandleObject(p_pool) catch |err| return toVkResult(err);
|
||||
|
||||
notImplementedWarning();
|
||||
|
||||
_ = pool;
|
||||
_ = flags;
|
||||
|
||||
return .error_unknown;
|
||||
pool.reset(flags) catch |err| return toVkResult(err);
|
||||
return .success;
|
||||
}
|
||||
|
||||
pub export fn strollResetEvent(p_device: vk.Device, p_event: vk.Fence) callconv(vk.vulkan_call_conv) vk.Result {
|
||||
|
||||
@@ -4,14 +4,18 @@ const Manager = @import("Manager.zig");
|
||||
const Self = @This();
|
||||
|
||||
managers: std.AutoArrayHashMapUnmanaged(std.Thread.Id, Manager),
|
||||
allocator: std.heap.ThreadSafeAllocator,
|
||||
mutex: std.Thread.Mutex,
|
||||
allocator: std.mem.Allocator,
|
||||
mutex: std.Io.Mutex,
|
||||
io: std.Io,
|
||||
|
||||
pub const init: Self = .{
|
||||
.managers = .empty,
|
||||
.allocator = .{ .child_allocator = std.heap.c_allocator },
|
||||
.mutex = .{},
|
||||
};
|
||||
pub fn init(io: std.Io, allocator: std.mem.Allocator) Self {
|
||||
return .{
|
||||
.managers = .empty,
|
||||
.allocator = allocator,
|
||||
.mutex = .init,
|
||||
.io = io,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn get(self: *Self) *Manager {
|
||||
const allocator = self.allocator.allocator();
|
||||
@@ -23,17 +27,14 @@ pub fn get(self: *Self) *Manager {
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Self) void {
|
||||
{
|
||||
self.mutex.lock();
|
||||
defer self.mutex.unlock();
|
||||
self.mutex.lockUncancelable();
|
||||
defer self.mutex.unlock();
|
||||
|
||||
if (self.managers.getPtr(std.Thread.getCurrentId())) |manager| {
|
||||
manager.deinit();
|
||||
_ = self.managers.orderedRemove(std.Thread.getCurrentId());
|
||||
}
|
||||
if (self.managers.getPtr(std.Thread.getCurrentId())) |manager| {
|
||||
manager.deinit();
|
||||
_ = self.managers.orderedRemove(std.Thread.getCurrentId());
|
||||
}
|
||||
if (self.managers.count() == 0) {
|
||||
self.managers.deinit(self.allocator.allocator());
|
||||
self.* = .init;
|
||||
self.managers.deinit(self.allocator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const zdt = @import("zdt");
|
||||
const root = @import("root");
|
||||
const lib = @import("../lib.zig");
|
||||
|
||||
@@ -39,7 +38,7 @@ pub inline fn nestedFixme(comptime format: []const u8, args: anytype) void {
|
||||
std.log.scoped(.FIXME).warn("FIXME: " ++ format, args);
|
||||
}
|
||||
|
||||
pub fn log(comptime level: std.log.Level, comptime scope: @Type(.enum_literal), comptime format: []const u8, args: anytype) void {
|
||||
pub fn log(comptime level: std.log.Level, comptime scope: @EnumLiteral(), comptime format: []const u8, args: anytype) void {
|
||||
if (lib.getLogVerboseLevel() == .None) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user