From 4bfe60fb8a90db77317eb4ef3bf59df5ed787da7 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 10 Oct 2019 03:13:52 +0900 Subject: [PATCH] graphicsdriver/metal: Bug fix: SetFragmentBytes must be called anytime Fixes #954 --- internal/graphicsdriver/metal/driver.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/graphicsdriver/metal/driver.go b/internal/graphicsdriver/metal/driver.go index 7a8e25155..50184531c 100644 --- a/internal/graphicsdriver/metal/driver.go +++ b/internal/graphicsdriver/metal/driver.go @@ -641,11 +641,9 @@ func (d *Driver) Draw(indexLen int, indexOffset int, mode driver.CompositeMode, } rce.SetFragmentBytes(unsafe.Pointer(&sourceSize[0]), unsafe.Sizeof(sourceSize), 2) - if colorM != nil { - esBody, esTranslate := colorM.UnsafeElements() - rce.SetFragmentBytes(unsafe.Pointer(&esBody[0]), unsafe.Sizeof(esBody[0])*uintptr(len(esBody)), 3) - rce.SetFragmentBytes(unsafe.Pointer(&esTranslate[0]), unsafe.Sizeof(esTranslate[0])*uintptr(len(esTranslate)), 4) - } + esBody, esTranslate := colorM.UnsafeElements() + rce.SetFragmentBytes(unsafe.Pointer(&esBody[0]), unsafe.Sizeof(esBody[0])*uintptr(len(esBody)), 3) + rce.SetFragmentBytes(unsafe.Pointer(&esTranslate[0]), unsafe.Sizeof(esTranslate[0])*uintptr(len(esTranslate)), 4) scale := float32(d.dst.width) / float32(d.src.width) rce.SetFragmentBytes(unsafe.Pointer(&scale), unsafe.Sizeof(scale), 5)