From 9298b044e32ec929b28666cecfd72cb98a02dc96 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 11 Feb 2020 20:28:15 +0900 Subject: [PATCH] graphicsdriver/metal: Bug fix: avoid using mtl.LoadActionDontCare Fixes #1019 --- internal/graphicsdriver/metal/driver.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/internal/graphicsdriver/metal/driver.go b/internal/graphicsdriver/metal/driver.go index ed0a8ab49..850eab600 100644 --- a/internal/graphicsdriver/metal/driver.go +++ b/internal/graphicsdriver/metal/driver.go @@ -587,13 +587,11 @@ func (d *Driver) Draw(indexLen int, indexOffset int, mode driver.CompositeMode, d.view.update() rpd := mtl.RenderPassDescriptor{} - if d.dst.screen { - rpd.ColorAttachments[0].LoadAction = mtl.LoadActionDontCare - rpd.ColorAttachments[0].StoreAction = mtl.StoreActionStore - } else { - rpd.ColorAttachments[0].LoadAction = mtl.LoadActionLoad - rpd.ColorAttachments[0].StoreAction = mtl.StoreActionStore - } + // Even though the destination pixels are not used, mtl.LoadActionDontCare might cause glitches + // (#1019). Always using mtl.LoadActionLoad is safe. + rpd.ColorAttachments[0].LoadAction = mtl.LoadActionLoad + rpd.ColorAttachments[0].StoreAction = mtl.StoreActionStore + var t mtl.Texture if d.dst.screen { if d.screenDrawable == (ca.MetalDrawable{}) {