forked from duarteroso/glfw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvulkan.v
More file actions
41 lines (35 loc) · 1.44 KB
/
Copy pathvulkan.v
File metadata and controls
41 lines (35 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module vglfw
// TODO
/*
// Forward declaration
[typedef] struct C.VkInstance { }
[typedef] struct C.VkPhysicalDevice { }
[typedef] struct C.VkAllocationCallbacks { }
[typedef] struct C.VkSurfaceKHR { }
fn C.glfwGetInstanceProcAddress(instance C.VkInstance, procname charptr) FnVkProc
fn C.glfwGetPhysicalDevicePresentationSupport(instance C.VkInstance, device C.VkPhysicalDevice, queuefamily u32) int
fn C.glfwCreateWindowSurface(instance C.VkInstance, window &C.GLFWwindow, allocator &C.VkAllocationCallbacks, surface &VkSurfaceKHR) C.VkResult
// Vulkan Wrapper for VkInstance
pub struct Vulkan{
mut:
data &C.VkInstance = &C.VkInstance(0)
}
// get_instance_proc_address Get Vulkan instance proc address
pub fn (v &Vulkan) get_instance_proc_address(proc_name string)! FnVkProc {
adr := C.glfwGetInstanceProcAddress(v.data, proc_name.str)
check_error()!
return adr
}
// get_physical_device_presentation_support Get physical device presentation support
pub fn (v &Vulkan) get_physical_device_presentation_support(device C.VkPhysicalDevice, queue_family u32)! int {
b := C.glfwGetPhysicalDevicePresentationSupport(*v.data, device, queue_family)
check_error()!
return b
}
// create_window_surface Create Vulkan wndow surface
pub fn (v &Vulkan) create_window_surface(window &Window, allocator &C.VkAllocationCallbacks, surface &C.VkSurfaceKHR)! C.VkResult {
r := C.glfwCreateWindowSurface(*v.data, window.data, allocator, surface)
check_error()!
return r
}
*/