adding fragment derivatives, base pipeline cache, missing KHR function to avoid CTS crash + lots of minor bugfixes
This commit is contained in:
@@ -1,3 +1,29 @@
|
||||
const std = @import("std");
|
||||
const vk = @import("vulkan");
|
||||
|
||||
pub fn boundedName(name: [*:0]const u8, max_len: usize) ?[]const u8 {
|
||||
const bytes = name[0..max_len];
|
||||
const len = std.mem.indexOfScalar(u8, bytes, 0) orelse return null;
|
||||
return bytes[0..len];
|
||||
}
|
||||
|
||||
pub fn propertyName(comptime max_len: usize, name: *const [max_len]u8) []const u8 {
|
||||
return std.mem.sliceTo(name[0..], 0);
|
||||
}
|
||||
|
||||
pub fn extensionName(name: *const [vk.MAX_EXTENSION_NAME_SIZE]u8) []const u8 {
|
||||
return propertyName(vk.MAX_EXTENSION_NAME_SIZE, name);
|
||||
}
|
||||
|
||||
pub fn isSupportedExtension(name: []const u8, extensions: []const vk.ExtensionProperties) bool {
|
||||
for (extensions) |extension| {
|
||||
if (std.mem.eql(u8, name, extensionName(&extension.extension_name))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
pub fn writePacked(comptime T: type, bytes: []u8, value: T) void {
|
||||
const raw: [@sizeOf(T)]u8 = @bitCast(value);
|
||||
@memcpy(bytes[0..@sizeOf(T)], raw[0..]);
|
||||
|
||||
Reference in New Issue
Block a user