mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 01:45:36 +00:00
app,gpu,internal/vk: add Vulkan port for Wayland, X11, Android
This change implements a Vulkan port for the two renderers, old and compute. Run with GIORENDERER=forcecompute to test the compute renderer. To shake out bugs faster, it is also made the default on systems that support it. To disable Vulkan and force the use of OpenGL, use the `novulkan` tag: $ go run -tags novulkan gioui.org/example/kitchen Don't forget to file an issue describing the issue that prompted the use of the tag. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -37,17 +37,19 @@ type mtlContext struct {
|
||||
queue C.CFTypeRef
|
||||
}
|
||||
|
||||
func newContext() (context, error) {
|
||||
dev := C.createDevice()
|
||||
if dev == 0 {
|
||||
return nil, errors.New("headless: failed to create Metal device")
|
||||
func init() {
|
||||
newContextPrimary = func() (context, error) {
|
||||
dev := C.createDevice()
|
||||
if dev == 0 {
|
||||
return nil, errors.New("headless: failed to create Metal device")
|
||||
}
|
||||
queue := C.newCommandQueue(dev)
|
||||
if queue == 0 {
|
||||
C.CFRelease(dev)
|
||||
return nil, errors.New("headless: failed to create MTLQueue")
|
||||
}
|
||||
return &mtlContext{dev: dev, queue: queue}, nil
|
||||
}
|
||||
queue := C.newCommandQueue(dev)
|
||||
if queue == 0 {
|
||||
C.CFRelease(dev)
|
||||
return nil, errors.New("headless: failed to create MTLQueue")
|
||||
}
|
||||
return &mtlContext{dev: dev, queue: queue}, nil
|
||||
}
|
||||
|
||||
func (c *mtlContext) API() gpu.API {
|
||||
|
||||
Reference in New Issue
Block a user