From b47653b808ddd1e8d6154bdcc2f98d206fde1fe8 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 23 Aug 2021 17:48:59 +0200 Subject: [PATCH] gpu/internal/metal: don't double-buffer staging memory One staging buffer is enough because BeginFrame waits for the completion of the staging operatoins from the previous frame. Signed-off-by: Elias Naur --- gpu/internal/metal/metal_darwin.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gpu/internal/metal/metal_darwin.go b/gpu/internal/metal/metal_darwin.go index ba5f1b4c..2722b5dd 100644 --- a/gpu/internal/metal/metal_darwin.go +++ b/gpu/internal/metal/metal_darwin.go @@ -388,9 +388,8 @@ type Backend struct { computeEnc C.CFTypeRef blitEnc C.CFTypeRef - stagingBuf C.CFTypeRef - stagingOff int - oldStagingBuf C.CFTypeRef + stagingBuf C.CFTypeRef + stagingOff int indexBuf *Buffer state state @@ -491,7 +490,6 @@ func newMetalDevice(api driver.Metal) (driver.Device, error) { func (b *Backend) BeginFrame(target driver.RenderTarget, clear bool, viewport image.Point) driver.Framebuffer { if b.lastCmdBuffer != 0 { C.cmdBufferWaitUntilCompleted(b.lastCmdBuffer) - b.oldStagingBuf, b.stagingBuf = b.stagingBuf, b.oldStagingBuf b.stagingOff = 0 } if target == nil { @@ -594,9 +592,6 @@ func (b *Backend) Release() { if b.stagingBuf != 0 { C.CFRelease(b.stagingBuf) } - if b.oldStagingBuf != 0 { - C.CFRelease(b.oldStagingBuf) - } C.CFRelease(b.queue) C.CFRelease(b.dev) *b = Backend{}