You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to follow https://vulkan-tutorial.com/ except using Go. I have done the tutorial once in C/C++, so I have a basic understanding of Vulkan (emphasis on basic). I also have some Go experience, but not much when it comes to CGo. I get the error in the title when running this code:
In particular, vk.CreateInstance is failing. I am not familiar enough with CGo and how memory sharing between the languages works to really know how to debug this issue. Any guidance?
The text was updated successfully, but these errors were encountered:
Just had the same problem: It looks like this happens if &h.instance is allocated in a Go heap span. If you just declare a local (stack) variable like var instance vk.Instance and take the pointer from that, it seems to "work".
My understanding is, that any heap allocation may be deallocated at any time, due to the concurrent GC nature and the runtime cannot prove that the c function has access to it. However, the stack is at least guaranteed to live until the called function returns, so it is guaranteed that the memory location is valid until the c function returns. Actually, the c function may still leak that memory and fail later...
I am trying to follow https://vulkan-tutorial.com/ except using Go. I have done the tutorial once in C/C++, so I have a basic understanding of Vulkan (emphasis on basic). I also have some Go experience, but not much when it comes to CGo. I get the error in the title when running this code:
In particular,
vk.CreateInstance
is failing. I am not familiar enough with CGo and how memory sharing between the languages works to really know how to debug this issue. Any guidance?The text was updated successfully, but these errors were encountered: