graphicsdriver/metal: Bug fix: SetFragmentBytes must be called anytime

Fixes #954
This commit is contained in:
Hajime Hoshi 2019-10-10 03:13:52 +09:00
parent 01cb6e67b8
commit 4bfe60fb8a

View File

@ -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) rce.SetFragmentBytes(unsafe.Pointer(&sourceSize[0]), unsafe.Sizeof(sourceSize), 2)
if colorM != nil { esBody, esTranslate := colorM.UnsafeElements()
esBody, esTranslate := colorM.UnsafeElements() rce.SetFragmentBytes(unsafe.Pointer(&esBody[0]), unsafe.Sizeof(esBody[0])*uintptr(len(esBody)), 3)
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)
rce.SetFragmentBytes(unsafe.Pointer(&esTranslate[0]), unsafe.Sizeof(esTranslate[0])*uintptr(len(esTranslate)), 4)
}
scale := float32(d.dst.width) / float32(d.src.width) scale := float32(d.dst.width) / float32(d.src.width)
rce.SetFragmentBytes(unsafe.Pointer(&scale), unsafe.Sizeof(scale), 5) rce.SetFragmentBytes(unsafe.Pointer(&scale), unsafe.Sizeof(scale), 5)