Graphics context for example

This commit is contained in:
Robin Voetter
2020-07-02 04:01:59 +02:00
parent 260a7966ee
commit 1ebed09413
5 changed files with 385 additions and 11 deletions

13
examples/c.zig Normal file
View File

@@ -0,0 +1,13 @@
pub usingnamespace @cImport({
@cDefine("GLFW_INCLUDE_NONE", {});
@cInclude("GLFW/glfw3.h");
});
const vk = @import("vulkan");
// usually the GLFW vulkan functions are exported if Vulkan is included,
// but since thats not the case here, they are manually imported.
pub extern "c" fn glfwGetInstanceProcAddress(instance: vk.Instance, procname: [*:0]const u8) vk.PfnVoidFunction;
pub extern "c" fn glfwGetPhysicalDevicePresentationSupport(instance: vk.Instance, pdev: vk.PhysicalDevice, queuefamily: u32) c_int;
pub extern "c" fn glfwCreateWindowSurface(instance: vk.Instance, window: *GLFWwindow, allocation_callbacks: ?*const vk.AllocationCallbacks, surface: *vk.SurfaceKHR) vk.Result;