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 <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-08-23 17:48:59 +02:00
parent 0f81bf02c1
commit b47653b808
+2 -7
View File
@@ -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{}