gpu,app: [Metal] don't store CFTypeRef values in pointer types

CFTypeRefs may not always contain valid pointers, so they must not be
stored in pointer types lest the Go runtime treats them as such.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-09-23 15:30:56 +02:00
parent 8c6e3c5fdf
commit bdafb3564f
3 changed files with 8 additions and 10 deletions
+3 -4
View File
@@ -7,7 +7,6 @@ package app
import (
"errors"
"unsafe"
"gioui.org/gpu"
)
@@ -123,14 +122,14 @@ func (c *mtlContext) RenderTarget() (gpu.RenderTarget, error) {
return nil, errors.New("metal: CADrawable.texture is nil")
}
return gpu.MetalRenderTarget{
Texture: unsafe.Pointer(c.texture),
Texture: uintptr(c.texture),
}, nil
}
func (c *mtlContext) API() gpu.API {
return gpu.Metal{
Device: unsafe.Pointer(c.dev),
Queue: unsafe.Pointer(c.queue),
Device: uintptr(c.dev),
Queue: uintptr(c.queue),
PixelFormat: int(C.MTLPixelFormatBGRA8Unorm_sRGB),
}
}