-
Notifications
You must be signed in to change notification settings - Fork 55
/
vulkan_linux_wayland.go
59 lines (47 loc) · 2.36 KB
/
vulkan_linux_wayland.go
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// +build linux,!android,wayland
package vulkan
import "unsafe"
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -Wno-implicit-function-declaration -DVK_USE_PLATFORM_WAYLAND_KHR
#include "vk_wrapper.h"
////////////////////// WAYLAND BEGIN
VkResult wlcallVkCreateWaylandSurfaceKHR(
void* Pinstance,
void* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface) {
VkInstance instance = (VkInstance) Pinstance;
return vgo_vkCreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface);
}
VkBool32 wlcallVkGetPhysicalDeviceWaylandPresentationSupportKHR(
void* PphysicalDevice,
uint32_t queueFamilyIndex,
void* display) {
VkPhysicalDevice physicalDevice = (VkPhysicalDevice) PphysicalDevice;
return vgo_vkGetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice,
queueFamilyIndex, display);
}
////////////////////// WAYLAND END
*/
import "C"
// Linux Wayland type flags
type WaylandSurfaceCreateFlags uint32
// Linux Wayland type struct
type WaylandSurfaceCreateInfo struct {
SType StructureType
PNext unsafe.Pointer
Flags WaylandSurfaceCreateFlags
Display uintptr
Surface uintptr
}
// CreateWaylandSurface function as declared in https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCreateWaylandSurfaceKHR.html
func CreateWaylandSurface(instance Instance, info *WaylandSurfaceCreateInfo, pAllocator *AllocationCallbacks, pSurface *Surface) {
cpAllocator, _ := (*C.VkAllocationCallbacks)(unsafe.Pointer(pAllocator)), 0
cpSurface, _ := (*C.VkSurfaceKHR)(unsafe.Pointer(pSurface)), 0
C.wlcallVkCreateWaylandSurfaceKHR(unsafe.Pointer(instance), unsafe.Pointer(info), cpAllocator, cpSurface)
}
// GetPhysicalDeviceWaylandPresentationSupport function as declared in https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWaylandPresentationSupportKHR.html
func GetPhysicalDeviceWaylandPresentationSupport(physicalDevice PhysicalDevice, queueFamilyIndex uint32, display uintptr) bool {
return 0 != C.wlcallVkGetPhysicalDeviceWaylandPresentationSupportKHR(unsafe.Pointer(physicalDevice), C.uint(queueFamilyIndex), unsafe.Pointer(display))
}