Skip to content

panic: runtime error: cgo argument has Go pointer to Go pointer #56

@dawsonc623

Description

@dawsonc623

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:

appInfo := vk.ApplicationInfo{}
appInfo.SType = vk.StructureTypeApplicationInfo
appInfo.PApplicationName = "Hello Triangle"
appInfo.ApplicationVersion = vk.MakeVersion(1, 0, 0)
appInfo.PEngineName = "No Engine"
appInfo.EngineVersion = vk.MakeVersion(1, 0, 0)
appInfo.ApiVersion = vk.ApiVersion10

createInfo := vk.InstanceCreateInfo{}
createInfo.SType = vk.StructureTypeInstanceCreateInfo
createInfo.PApplicationInfo = &appInfo

glfwExtensions := h.window.GetRequiredInstanceExtensions()

createInfo.EnabledExtensionCount = uint32(len(glfwExtensions))
createInfo.PpEnabledExtensionNames = glfwExtensions

createInfo.EnabledLayerCount = 0

result := vk.CreateInstance(&createInfo, nil, &h.instance)

if result != vk.Success {
  return errors.New("failed to create instance!")
}

return nil

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions