#47

segfault in vulkaninfo example

Opensplaceopened 6y ago

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

Activity

2
splace6y ago

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

actually vulkaninfo (the CLI) shows it does, i did wonder, vulkaninfo (the example) says, when fixed, that it doesn't.

in fact; about half the device extensions aren't being reported.

splace5y ago

in fact; about half the device extensions aren't being reported.

after the latest update to vulkan (solus) all extensions produced by this are now agreeing with vulkaninfo. which is reassuring.