fixing ci
This commit is contained in:
6
src/vulkan/environment.zig
git.filemode.normal_file
6
src/vulkan/environment.zig
git.filemode.normal_file
@@ -0,0 +1,6 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn hasEnvVar(name: []const u8) bool {
|
||||
_ = name;
|
||||
return false;
|
||||
}
|
||||
@@ -11,6 +11,7 @@ pub const errors = @import("error_set.zig");
|
||||
pub const lib_vulkan = @import("lib_vulkan.zig");
|
||||
pub const logger = @import("logger.zig");
|
||||
pub const format = @import("format.zig");
|
||||
pub const env = @import("environment.zig");
|
||||
|
||||
pub const Dispatchable = @import("Dispatchable.zig").Dispatchable;
|
||||
pub const NonDispatchable = @import("NonDispatchable.zig").NonDispatchable;
|
||||
@@ -84,28 +85,6 @@ pub const std_options: std.Options = .{
|
||||
.logFn = logger.log,
|
||||
};
|
||||
|
||||
pub const LogVerboseLevel = enum {
|
||||
None,
|
||||
Standard,
|
||||
High,
|
||||
TooMuch,
|
||||
};
|
||||
|
||||
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);
|
||||
//return if (std.mem.eql(u8, level, "none"))
|
||||
// .None
|
||||
//else if (std.mem.eql(u8, level, "all"))
|
||||
// .High
|
||||
//else if (std.mem.eql(u8, level, "stupid"))
|
||||
// .TooMuch
|
||||
//else
|
||||
// .Standard;
|
||||
return .High;
|
||||
}
|
||||
|
||||
pub inline fn unsupported(comptime fmt: []const u8, args: anytype) void {
|
||||
std.log.scoped(.UNSUPPORTED).warn(fmt, args);
|
||||
}
|
||||
|
||||
@@ -50,11 +50,6 @@ fn entryPointBeginLogTrace(comptime scope: @EnumLiteral()) void {
|
||||
|
||||
fn entryPointEndLogTrace() void {}
|
||||
|
||||
fn entryPointNotFoundErrorLog(comptime scope: @EnumLiteral(), name: []const u8) void {
|
||||
if (lib.getLogVerboseLevel() != .TooMuch) return;
|
||||
std.log.scoped(scope).err("Could not find function {s}", .{name});
|
||||
}
|
||||
|
||||
inline fn notImplementedWarning() void {
|
||||
logger.fixme("function not yet implemented", .{});
|
||||
}
|
||||
@@ -248,9 +243,6 @@ pub export fn stroll_icdNegotiateLoaderICDInterfaceVersion(p_version: *u32) call
|
||||
}
|
||||
|
||||
pub export fn vk_icdGetInstanceProcAddr(p_instance: vk.Instance, p_name: ?[*:0]const u8) callconv(vk.vulkan_call_conv) vk.PfnVoidFunction {
|
||||
if (lib.getLogVerboseLevel() == .TooMuch) {
|
||||
entryPointBeginLogTrace(.vk_icdGetInstanceProcAddr);
|
||||
}
|
||||
defer entryPointEndLogTrace();
|
||||
|
||||
if (p_name == null) return null;
|
||||
@@ -261,9 +253,6 @@ pub export fn vk_icdGetInstanceProcAddr(p_instance: vk.Instance, p_name: ?[*:0]c
|
||||
}
|
||||
|
||||
pub export fn stroll_icdGetPhysicalDeviceProcAddr(_: vk.Instance, p_name: ?[*:0]const u8) callconv(vk.vulkan_call_conv) vk.PfnVoidFunction {
|
||||
if (lib.getLogVerboseLevel() == .TooMuch) {
|
||||
entryPointBeginLogTrace(.vk_icdGetPhysicalDeviceProcAddr);
|
||||
}
|
||||
defer entryPointEndLogTrace();
|
||||
|
||||
if (p_name == null) return null;
|
||||
@@ -271,16 +260,12 @@ pub export fn stroll_icdGetPhysicalDeviceProcAddr(_: vk.Instance, p_name: ?[*:0]
|
||||
|
||||
if (physical_device_pfn_map.get(name)) |pfn| return pfn;
|
||||
|
||||
entryPointNotFoundErrorLog(.vk_icdGetPhysicalDeviceProcAddr, name);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Global functions ==========================================================================================================================================
|
||||
|
||||
pub export fn vkGetInstanceProcAddr(p_instance: vk.Instance, p_name: ?[*:0]const u8) callconv(vk.vulkan_call_conv) vk.PfnVoidFunction {
|
||||
if (lib.getLogVerboseLevel() == .TooMuch) {
|
||||
entryPointBeginLogTrace(.vkGetInstanceProcAddr);
|
||||
}
|
||||
defer entryPointEndLogTrace();
|
||||
|
||||
if (p_name == null) return null;
|
||||
@@ -292,7 +277,6 @@ pub export fn vkGetInstanceProcAddr(p_instance: vk.Instance, p_name: ?[*:0]const
|
||||
if (physical_device_pfn_map.get(name)) |pfn| return pfn;
|
||||
if (device_pfn_map.get(name)) |pfn| return pfn;
|
||||
}
|
||||
entryPointNotFoundErrorLog(.vkGetInstanceProcAddr, name);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1317,9 +1301,6 @@ pub export fn strollGetDeviceMemoryCommitment(p_device: vk.Device, p_memory: vk.
|
||||
}
|
||||
|
||||
pub export fn strollGetDeviceProcAddr(p_device: vk.Device, p_name: ?[*:0]const u8) callconv(vk.vulkan_call_conv) vk.PfnVoidFunction {
|
||||
if (lib.getLogVerboseLevel() == .TooMuch) {
|
||||
entryPointBeginLogTrace(.vkGetDeviceProcAddr);
|
||||
}
|
||||
defer entryPointEndLogTrace();
|
||||
|
||||
if (p_name == null) return null;
|
||||
@@ -1328,7 +1309,6 @@ pub export fn strollGetDeviceProcAddr(p_device: vk.Device, p_name: ?[*:0]const u
|
||||
if (p_device == .null_handle) return null;
|
||||
if (device_pfn_map.get(name)) |pfn| return pfn;
|
||||
|
||||
entryPointNotFoundErrorLog(.vkGetDeviceProcAddr, name);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@ comptime {
|
||||
var mutex: std.Io.Mutex = .init;
|
||||
|
||||
pub inline fn fixme(comptime format: []const u8, args: anytype) void {
|
||||
if (lib.getLogVerboseLevel() == .None) {
|
||||
if (!lib.env.hasEnvVar("STROLL_DEBUG_LOGS")) {
|
||||
return;
|
||||
}
|
||||
std.log.scoped(.FIXME).warn("FIXME: " ++ format, args);
|
||||
}
|
||||
|
||||
pub fn log(comptime level: std.log.Level, comptime scope: @EnumLiteral(), comptime format: []const u8, args: anytype) void {
|
||||
if (lib.getLogVerboseLevel() == .None) {
|
||||
if (!lib.env.hasEnvVar("STROLL_DEBUG_LOGS")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user