Skip to content

segfault in vulkaninfo example #47

@splace

Description

@splace

on investigating seems to be three issues in play (see below code extract)

deviceCreate requires swapchain, my vulkan setup doesn't have it, so this errors.

but swapchain doesn't actually seem to be needed anyway, so it just commented it out to fix.

but when erroring the code calls DestroySurface without first having setup one, so this is the seqfault.

again i just commented out to get to work; correctly report unavailable extension.

when i looked in the docs of DistroySurface, to see if the surface could be null, the link in the docs is broken, seems the url changed? this;

https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/html/vkspec.html#VkDestroySurfaceKHR

needs the uppercase 'V' changed to lowercase to work.

	deviceExtensions := []string{
		"VK_KHR_swapchain\x00",
	}
	deviceCreateInfo := &vk.DeviceCreateInfo{
		SType:                   vk.StructureTypeDeviceCreateInfo,
		QueueCreateInfoCount:    uint32(len(queueCreateInfos)),
		PQueueCreateInfos:       queueCreateInfos,
		EnabledExtensionCount:   uint32(len(deviceExtensions)),
		PpEnabledExtensionNames: deviceExtensions,
	}
	var device vk.Device
	err = vk.Error(vk.CreateDevice(v.gpuDevices[0], deviceCreateInfo, nil, &device))
	if err != nil {
		v.gpuDevices = nil
		vk.DestroySurface(v.instance, v.surface, nil)
		vk.DestroyInstance(v.instance, nil)
		err = fmt.Errorf("CreateDevice with extensions %s failed with %s",deviceExtensions, err)
		return

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