forked from mirror/vulkan-zig
Refactor example to use extension info and feature info for functions
This commit is contained in:
@@ -5,79 +5,36 @@ const Allocator = std.mem.Allocator;
|
|||||||
|
|
||||||
const required_device_extensions = [_][*:0]const u8{vk.extension_info.khr_swapchain.name};
|
const required_device_extensions = [_][*:0]const u8{vk.extension_info.khr_swapchain.name};
|
||||||
|
|
||||||
const BaseDispatch = vk.BaseWrapper(.{
|
const BaseDispatch = vk.BaseWrapper(
|
||||||
.createInstance = true,
|
blk: {
|
||||||
.getInstanceProcAddr = true,
|
var commands = vk.feature_info.version_1_0.base_functions;
|
||||||
});
|
commands = vk.BaseCommandFlags.merge(commands, vk.feature_info.version_1_1.base_functions);
|
||||||
|
commands = vk.BaseCommandFlags.merge(commands, vk.feature_info.version_1_2.base_functions);
|
||||||
|
break :blk commands;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const InstanceDispatch = vk.InstanceWrapper(.{
|
const InstanceDispatch = vk.InstanceWrapper(
|
||||||
.destroyInstance = true,
|
blk: {
|
||||||
.createDevice = true,
|
var commands = vk.feature_info.version_1_0.instance_functions;
|
||||||
.destroySurfaceKHR = true,
|
commands = vk.InstanceCommandFlags.merge(commands, vk.feature_info.version_1_1.instance_functions);
|
||||||
.enumeratePhysicalDevices = true,
|
commands = vk.InstanceCommandFlags.merge(commands, vk.feature_info.version_1_2.instance_functions);
|
||||||
.getPhysicalDeviceProperties = true,
|
commands = vk.InstanceCommandFlags.merge(commands, vk.extension_info.khr_surface.instance_functions);
|
||||||
.enumerateDeviceExtensionProperties = true,
|
commands = vk.InstanceCommandFlags.merge(commands, vk.extension_info.khr_swapchain.instance_functions);
|
||||||
.getPhysicalDeviceSurfaceFormatsKHR = true,
|
break :blk commands;
|
||||||
.getPhysicalDeviceSurfacePresentModesKHR = true,
|
}
|
||||||
.getPhysicalDeviceSurfaceCapabilitiesKHR = true,
|
);
|
||||||
.getPhysicalDeviceQueueFamilyProperties = true,
|
|
||||||
.getPhysicalDeviceSurfaceSupportKHR = true,
|
|
||||||
.getPhysicalDeviceMemoryProperties = true,
|
|
||||||
.getDeviceProcAddr = true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const DeviceDispatch = vk.DeviceWrapper(.{
|
const DeviceDispatch = vk.DeviceWrapper(
|
||||||
.destroyDevice = true,
|
blk: {
|
||||||
.getDeviceQueue = true,
|
var commands = vk.feature_info.version_1_0.device_functions;
|
||||||
.createSemaphore = true,
|
commands = vk.DeviceCommandFlags.merge(commands, vk.feature_info.version_1_1.device_functions);
|
||||||
.createFence = true,
|
commands = vk.DeviceCommandFlags.merge(commands, vk.feature_info.version_1_2.device_functions);
|
||||||
.createImageView = true,
|
commands = vk.DeviceCommandFlags.merge(commands, vk.extension_info.khr_surface.device_functions);
|
||||||
.destroyImageView = true,
|
commands = vk.DeviceCommandFlags.merge(commands, vk.extension_info.khr_swapchain.device_functions);
|
||||||
.destroySemaphore = true,
|
break :blk commands;
|
||||||
.destroyFence = true,
|
}
|
||||||
.getSwapchainImagesKHR = true,
|
);
|
||||||
.createSwapchainKHR = true,
|
|
||||||
.destroySwapchainKHR = true,
|
|
||||||
.acquireNextImageKHR = true,
|
|
||||||
.deviceWaitIdle = true,
|
|
||||||
.waitForFences = true,
|
|
||||||
.resetFences = true,
|
|
||||||
.queueSubmit = true,
|
|
||||||
.queuePresentKHR = true,
|
|
||||||
.createCommandPool = true,
|
|
||||||
.destroyCommandPool = true,
|
|
||||||
.allocateCommandBuffers = true,
|
|
||||||
.freeCommandBuffers = true,
|
|
||||||
.queueWaitIdle = true,
|
|
||||||
.createShaderModule = true,
|
|
||||||
.destroyShaderModule = true,
|
|
||||||
.createPipelineLayout = true,
|
|
||||||
.destroyPipelineLayout = true,
|
|
||||||
.createRenderPass = true,
|
|
||||||
.destroyRenderPass = true,
|
|
||||||
.createGraphicsPipelines = true,
|
|
||||||
.destroyPipeline = true,
|
|
||||||
.createFramebuffer = true,
|
|
||||||
.destroyFramebuffer = true,
|
|
||||||
.beginCommandBuffer = true,
|
|
||||||
.endCommandBuffer = true,
|
|
||||||
.allocateMemory = true,
|
|
||||||
.freeMemory = true,
|
|
||||||
.createBuffer = true,
|
|
||||||
.destroyBuffer = true,
|
|
||||||
.getBufferMemoryRequirements = true,
|
|
||||||
.mapMemory = true,
|
|
||||||
.unmapMemory = true,
|
|
||||||
.bindBufferMemory = true,
|
|
||||||
.cmdBeginRenderPass = true,
|
|
||||||
.cmdEndRenderPass = true,
|
|
||||||
.cmdBindPipeline = true,
|
|
||||||
.cmdDraw = true,
|
|
||||||
.cmdSetViewport = true,
|
|
||||||
.cmdSetScissor = true,
|
|
||||||
.cmdBindVertexBuffers = true,
|
|
||||||
.cmdCopyBuffer = true,
|
|
||||||
});
|
|
||||||
|
|
||||||
pub const GraphicsContext = struct {
|
pub const GraphicsContext = struct {
|
||||||
vkb: BaseDispatch,
|
vkb: BaseDispatch,
|
||||||
|
|||||||
Reference in New Issue
Block a user