linux: update to latest vulkan-zig API; fix build
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
130c474874
commit
2a7e6049fd
10 changed files with 188 additions and 175 deletions
|
|
@ -16,7 +16,7 @@ fn getProcAddress(name_ptr: [*:0]const u8) c.PROC {
|
|||
}
|
||||
|
||||
pub fn init() !void {
|
||||
libgl = try std.DynLib.openZ("opengl32.dll");
|
||||
libgl = try std.DynLib.open("opengl32.dll");
|
||||
}
|
||||
|
||||
pub fn deinit() void {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ pub fn init(alloc: std.mem.Allocator, options: InitOptions) !void {
|
|||
if (options.baseLoader) |baseLoader| {
|
||||
vkb = try proc.loadBase(baseLoader);
|
||||
} else {
|
||||
libvulkan = try std.DynLib.openZ(switch (builtin.target.os.tag) {
|
||||
libvulkan = try std.DynLib.open(switch (builtin.target.os.tag) {
|
||||
.windows => "vulkan-1.dll",
|
||||
.linux => "libvulkan.so.1",
|
||||
.macos => "libvulkan.1.dylib",
|
||||
|
|
@ -132,24 +132,24 @@ pub const Instance = struct {
|
|||
&.{};
|
||||
const instance_extensions: []const [*:0]const u8 = switch (builtin.target.os.tag) {
|
||||
.linux => &.{
|
||||
vk.extension_info.khr_surface.name,
|
||||
vk.extension_info.khr_xlib_surface.name,
|
||||
vk.extension_info.khr_xcb_surface.name,
|
||||
vk.extensions.khr_surface.name,
|
||||
vk.extensions.khr_xlib_surface.name,
|
||||
vk.extensions.khr_xcb_surface.name,
|
||||
// TODO: renderdoc will not work with this extension
|
||||
// vk.extension_info.khr_wayland_surface.name,
|
||||
// vk.extensions.khr_wayland_surface.name,
|
||||
},
|
||||
.windows => &.{
|
||||
vk.extension_info.khr_surface.name,
|
||||
vk.extension_info.khr_win_32_surface.name,
|
||||
vk.extensions.khr_surface.name,
|
||||
vk.extensions.khr_win_32_surface.name,
|
||||
},
|
||||
.macos, .ios => &.{
|
||||
vk.extension_info.khr_surface.name,
|
||||
vk.extension_info.ext_metal_surface.name,
|
||||
vk.extensions.khr_surface.name,
|
||||
vk.extensions.ext_metal_surface.name,
|
||||
},
|
||||
else => |tag| if (builtin.target.abi == .android)
|
||||
&.{
|
||||
vk.extension_info.khr_surface.name,
|
||||
vk.extension_info.khr_android_surface.name,
|
||||
vk.extensions.khr_surface.name,
|
||||
vk.extensions.khr_android_surface.name,
|
||||
}
|
||||
else
|
||||
@compileError(std.fmt.comptimePrint("unsupported platform ({s})", .{@tagName(tag)})),
|
||||
|
|
@ -490,7 +490,8 @@ pub const Device = struct {
|
|||
.indirect_first_instance => features.features.draw_indirect_first_instance = vk.TRUE,
|
||||
.shader_f16 => {
|
||||
var feature = vk.PhysicalDeviceShaderFloat16Int8FeaturesKHR{
|
||||
.s_type = .physical_device_shader_float16_int8_features_khr,
|
||||
// physical_device_shader_float16_int8_features_khr
|
||||
.s_type = vk.StructureType.physical_device_shader_float16_int8_features_khr,
|
||||
.shader_float_16 = vk.TRUE,
|
||||
};
|
||||
features.p_next = @ptrCast(&feature);
|
||||
|
|
@ -716,7 +717,7 @@ pub const Device = struct {
|
|||
&[_][*:0]const u8{"VK_LAYER_KHRONOS_validation"}
|
||||
else
|
||||
&.{};
|
||||
const device_extensions = &[_][*:0]const u8{vk.extension_info.khr_swapchain.name};
|
||||
const device_extensions = &[_][*:0]const u8{vk.extensions.khr_swapchain.name};
|
||||
|
||||
pub const ResolveKey = struct {
|
||||
format: vk.Format,
|
||||
|
|
|
|||
|
|
@ -2,109 +2,121 @@ const std = @import("std");
|
|||
const builtin = @import("builtin");
|
||||
const vk = @import("vulkan");
|
||||
|
||||
pub const BaseFunctions = vk.BaseWrapper(.{
|
||||
.createInstance = true,
|
||||
.enumerateInstanceExtensionProperties = true,
|
||||
.enumerateInstanceLayerProperties = true,
|
||||
.getInstanceProcAddr = true,
|
||||
pub const BaseFunctions = vk.BaseWrapper(&.{
|
||||
.{
|
||||
.base_commands = .{
|
||||
.createInstance = true,
|
||||
.enumerateInstanceExtensionProperties = true,
|
||||
.enumerateInstanceLayerProperties = true,
|
||||
.getInstanceProcAddr = true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
pub const InstanceFunctions = vk.InstanceWrapper(.{
|
||||
.createDevice = true,
|
||||
// TODO: renderdoc will not work with wayland
|
||||
// .createWaylandSurfaceKHR = builtin.target.os.tag == .linux,
|
||||
.createWin32SurfaceKHR = builtin.target.os.tag == .windows,
|
||||
.createXlibSurfaceKHR = builtin.target.os.tag == .linux,
|
||||
.destroyInstance = true,
|
||||
.destroySurfaceKHR = true,
|
||||
.enumerateDeviceExtensionProperties = true,
|
||||
.enumerateDeviceLayerProperties = true,
|
||||
.enumeratePhysicalDevices = true,
|
||||
.getDeviceProcAddr = true,
|
||||
.getPhysicalDeviceFeatures = true,
|
||||
.getPhysicalDeviceFormatProperties = true,
|
||||
.getPhysicalDeviceProperties = true,
|
||||
.getPhysicalDeviceMemoryProperties = true,
|
||||
.getPhysicalDeviceQueueFamilyProperties = true,
|
||||
.getPhysicalDeviceSurfaceCapabilitiesKHR = true,
|
||||
.getPhysicalDeviceSurfaceFormatsKHR = true,
|
||||
pub const InstanceFunctions = vk.InstanceWrapper(&.{
|
||||
.{
|
||||
.instance_commands = .{
|
||||
.createDevice = true,
|
||||
// TODO: renderdoc will not work with wayland
|
||||
// .createWaylandSurfaceKHR = builtin.target.os.tag == .linux,
|
||||
.createWin32SurfaceKHR = builtin.target.os.tag == .windows,
|
||||
.createXlibSurfaceKHR = builtin.target.os.tag == .linux,
|
||||
.destroyInstance = true,
|
||||
.destroySurfaceKHR = true,
|
||||
.enumerateDeviceExtensionProperties = true,
|
||||
.enumerateDeviceLayerProperties = true,
|
||||
.enumeratePhysicalDevices = true,
|
||||
.getDeviceProcAddr = true,
|
||||
.getPhysicalDeviceFeatures = true,
|
||||
.getPhysicalDeviceFormatProperties = true,
|
||||
.getPhysicalDeviceProperties = true,
|
||||
.getPhysicalDeviceMemoryProperties = true,
|
||||
.getPhysicalDeviceQueueFamilyProperties = true,
|
||||
.getPhysicalDeviceSurfaceCapabilitiesKHR = true,
|
||||
.getPhysicalDeviceSurfaceFormatsKHR = true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
pub const DeviceFunctions = vk.DeviceWrapper(.{
|
||||
.acquireNextImageKHR = true,
|
||||
.allocateCommandBuffers = true,
|
||||
.allocateDescriptorSets = true,
|
||||
.allocateMemory = true,
|
||||
.beginCommandBuffer = true,
|
||||
.bindBufferMemory = true,
|
||||
.bindImageMemory = true,
|
||||
.cmdBeginRenderPass = true,
|
||||
.cmdBindDescriptorSets = true,
|
||||
.cmdBindIndexBuffer = true,
|
||||
.cmdBindPipeline = true,
|
||||
.cmdBindVertexBuffers = true,
|
||||
.cmdCopyBuffer = true,
|
||||
.cmdCopyBufferToImage = true,
|
||||
.cmdCopyImage = true,
|
||||
.cmdDispatch = true,
|
||||
.cmdDraw = true,
|
||||
.cmdDrawIndexed = true,
|
||||
.cmdEndRenderPass = true,
|
||||
.cmdPipelineBarrier = true,
|
||||
.cmdSetScissor = true,
|
||||
.cmdSetStencilReference = true,
|
||||
.cmdSetViewport = true,
|
||||
.createBuffer = true,
|
||||
.createCommandPool = true,
|
||||
.createComputePipelines = true,
|
||||
.createDescriptorPool = true,
|
||||
.createDescriptorSetLayout = true,
|
||||
.createFence = true,
|
||||
.createFramebuffer = true,
|
||||
.createGraphicsPipelines = true,
|
||||
.createImage = true,
|
||||
.createImageView = true,
|
||||
.createPipelineLayout = true,
|
||||
.createRenderPass = true,
|
||||
.createSampler = true,
|
||||
.createSemaphore = true,
|
||||
.createShaderModule = true,
|
||||
.createSwapchainKHR = true,
|
||||
.destroyBuffer = true,
|
||||
.destroyCommandPool = true,
|
||||
.destroyDescriptorPool = true,
|
||||
.destroyDescriptorSetLayout = true,
|
||||
.destroyDevice = true,
|
||||
.destroyFence = true,
|
||||
.destroyFramebuffer = true,
|
||||
.destroyImage = true,
|
||||
.destroyImageView = true,
|
||||
.destroyPipeline = true,
|
||||
.destroyPipelineLayout = true,
|
||||
.destroyRenderPass = true,
|
||||
.destroySampler = true,
|
||||
.destroySemaphore = true,
|
||||
.destroyShaderModule = true,
|
||||
.destroySwapchainKHR = true,
|
||||
.deviceWaitIdle = true,
|
||||
.endCommandBuffer = true,
|
||||
.freeCommandBuffers = true,
|
||||
.freeDescriptorSets = true,
|
||||
.freeMemory = true,
|
||||
.getBufferMemoryRequirements = true,
|
||||
.getDeviceQueue = true,
|
||||
.getFenceStatus = true,
|
||||
.getImageMemoryRequirements = true,
|
||||
.getSwapchainImagesKHR = true,
|
||||
.mapMemory = true,
|
||||
.queuePresentKHR = true,
|
||||
.queueSubmit = true,
|
||||
.queueWaitIdle = true,
|
||||
.resetCommandBuffer = true,
|
||||
.resetFences = true,
|
||||
.unmapMemory = true,
|
||||
.updateDescriptorSets = true,
|
||||
.waitForFences = true,
|
||||
pub const DeviceFunctions = vk.DeviceWrapper(&.{
|
||||
.{
|
||||
.device_commands = .{
|
||||
.acquireNextImageKHR = true,
|
||||
.allocateCommandBuffers = true,
|
||||
.allocateDescriptorSets = true,
|
||||
.allocateMemory = true,
|
||||
.beginCommandBuffer = true,
|
||||
.bindBufferMemory = true,
|
||||
.bindImageMemory = true,
|
||||
.cmdBeginRenderPass = true,
|
||||
.cmdBindDescriptorSets = true,
|
||||
.cmdBindIndexBuffer = true,
|
||||
.cmdBindPipeline = true,
|
||||
.cmdBindVertexBuffers = true,
|
||||
.cmdCopyBuffer = true,
|
||||
.cmdCopyBufferToImage = true,
|
||||
.cmdCopyImage = true,
|
||||
.cmdDispatch = true,
|
||||
.cmdDraw = true,
|
||||
.cmdDrawIndexed = true,
|
||||
.cmdEndRenderPass = true,
|
||||
.cmdPipelineBarrier = true,
|
||||
.cmdSetScissor = true,
|
||||
.cmdSetStencilReference = true,
|
||||
.cmdSetViewport = true,
|
||||
.createBuffer = true,
|
||||
.createCommandPool = true,
|
||||
.createComputePipelines = true,
|
||||
.createDescriptorPool = true,
|
||||
.createDescriptorSetLayout = true,
|
||||
.createFence = true,
|
||||
.createFramebuffer = true,
|
||||
.createGraphicsPipelines = true,
|
||||
.createImage = true,
|
||||
.createImageView = true,
|
||||
.createPipelineLayout = true,
|
||||
.createRenderPass = true,
|
||||
.createSampler = true,
|
||||
.createSemaphore = true,
|
||||
.createShaderModule = true,
|
||||
.createSwapchainKHR = true,
|
||||
.destroyBuffer = true,
|
||||
.destroyCommandPool = true,
|
||||
.destroyDescriptorPool = true,
|
||||
.destroyDescriptorSetLayout = true,
|
||||
.destroyDevice = true,
|
||||
.destroyFence = true,
|
||||
.destroyFramebuffer = true,
|
||||
.destroyImage = true,
|
||||
.destroyImageView = true,
|
||||
.destroyPipeline = true,
|
||||
.destroyPipelineLayout = true,
|
||||
.destroyRenderPass = true,
|
||||
.destroySampler = true,
|
||||
.destroySemaphore = true,
|
||||
.destroyShaderModule = true,
|
||||
.destroySwapchainKHR = true,
|
||||
.deviceWaitIdle = true,
|
||||
.endCommandBuffer = true,
|
||||
.freeCommandBuffers = true,
|
||||
.freeDescriptorSets = true,
|
||||
.freeMemory = true,
|
||||
.getBufferMemoryRequirements = true,
|
||||
.getDeviceQueue = true,
|
||||
.getFenceStatus = true,
|
||||
.getImageMemoryRequirements = true,
|
||||
.getSwapchainImagesKHR = true,
|
||||
.mapMemory = true,
|
||||
.queuePresentKHR = true,
|
||||
.queueSubmit = true,
|
||||
.queueWaitIdle = true,
|
||||
.resetCommandBuffer = true,
|
||||
.resetFences = true,
|
||||
.unmapMemory = true,
|
||||
.updateDescriptorSets = true,
|
||||
.waitForFences = true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
pub const BaseLoader = *const fn (vk.Instance, [*:0]const u8) vk.PfnVoidFunction;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue