asche icon indicating copy to clipboard operation
asche copied to clipboard

VulkanDebug() == true panics

Open fzwoch opened this issue 4 years ago • 1 comments

Enabling VulkanDebug() causes a panic during registering the debug callback in cgo.

$ go version
go version go1.11.12 linux/amd64

2019/07/24 11:28:36 vulkan: enabling 0 instance extensions
panic: runtime error: cgo argument has Go pointer to Go pointer

goroutine 1 [running]:
github.com/vulkan-go/vulkan.CreateDebugReportCallback.func1(0x10fd490, 0x11766b0, 0x0, 0xc0000cea68, 0x10fd490)
	/home/fzwoch/go/pkg/mod/github.com/vulkan-go/[email protected]/vulkan.go:1556 +0xcd
github.com/vulkan-go/vulkan.CreateDebugReportCallback(0x10fd490, 0xc0000f7da0, 0x0, 0xc0000cea68, 0x0)
	/home/fzwoch/go/pkg/mod/github.com/vulkan-go/[email protected]/vulkan.go:1556 +0x57
github.com/vulkan-go/asche.NewPlatform(0x52bca0, 0xc0000ae370, 0x0, 0x0, 0xc000070f88, 0xc0000a4058)
	/home/fzwoch/go/pkg/mod/github.com/vulkan-go/[email protected]/platform.go:95 +0x1aee
main.main()

example.go:

package main

import (
	as "github.com/vulkan-go/asche"
	vk "github.com/vulkan-go/vulkan"
)

type application struct {
	as.BaseVulkanApp
}

func (a *application) VulkanDebug() bool {
	return true
}

func main() {
	if err := vk.SetDefaultGetInstanceProcAddr(); err != nil {
		panic(err)
	}

	if err := vk.Init(); err != nil {
		panic(err)
	}

	app := &application{}

	as.NewPlatform(app)
}

fzwoch avatar Jul 24 '19 09:07 fzwoch

Debug callbacks are tricky with cgo, needs more research. Probably the issue here is caused by newer Go version that added more safety checks.

Thx for the report.

xlab avatar Jul 24 '19 10:07 xlab