veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.21k stars 221 forks source link

Vulkan funcs should return unsafe.Pointer instead of uintptr #409

Closed Nightwulf closed 5 years ago

Nightwulf commented 5 years ago

VulkanCreateSurface(instance interface{}) returns an uintptr which is a dangerous behaviour hence uintptr is not updated by the garbage collector. It should return the unsafe.Pointer instead which is updated. In VulkanGetVkGetInstanceProcAddr() it is done correctly. if you use VulkanCreateSurface() and try to cast it to a vkSurfaceKHR, you need to cast it back to unsafe.Pointer which then causes a warning when call "go vet": "possible misuse of unsafe.Pointer"

veeableful commented 5 years ago

Hi @Nightwulf, thanks for the feedback! I've updated the function to return unsafe.Pointer instead.

Nightwulf commented 5 years ago

Hey @veeableful,

thank you for the fast reply and change. Go vet no longer moans now!