site_archiver@lists.apple.com Delivered-To: pro-apps-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=DeMontfortUniversity.onmicrosoft.com; s=selector2-DeMontfortUniversity-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=idcAsZ6i2taDrDq14GTW17x6KugjIQQmb7VYL8WAfUQ=; b=pxwoQUrUlDWxVz+vc3a0VcQGZKMxcKnj3odjBTsZ3RiXyjhJizkoo5ME5UPh5uc99iWb7WaGyuTSK7SlZlaXv3SAFLW7QclDWcX9SUSdCc8M7mJAC5ATppeKOjbvDQbMfs6ZQ+oUCLleTiUDXM4/j1ByaEVxNRPbnZowgPRVsl4= Thread-index: AQHWCRCeuoWMtgmom0ywkg7KRj6cAA== Thread-topic: Metal AlphaBlending in FxPlug User-agent: Microsoft-MacOutlook/16.35.20030802 Thanks for that very fast response on question 1! So now for question 2: I am converting a plugin to Metal that used alpha blending to layer and mix OpenGL points (tells you how behind I am). I am using the FxShape example as my core model to work from. I have adapted the circle draw to take position and RGBA color arguments, have implemented MSAA, and now am trying to get alpha blending of overlapped circles to work. Piecing together examples from online, it seems like it should be (relatively) straightforward. However, I am just getting solid colors, no blends. So am wondering if there might be something odd about doing this in the Motion context that I am overlooking. I have noted that some errors in online examples have been solved by changing texture types or in one case having to a CAMetalLayer ‘opaque’property to false, but it is not clear to me if/how any of that would apply within an FxPlug. In FxMTLDeviceCache, I add code to the Shape Pipeline State descriptor to enable blending and set blending options, taking into account that Motion is premultiplied alpha: pipelineStateDescriptor.colorAttachments[0].blendingEnabled = TRUE; pipelineStateDescriptor.colorAttachments[0].sourceRGBBlendFactor = MTLBlendFactorOne; pipelineStateDescriptor.colorAttachments[0].destinationRGBBlendFactor = MTLBlendFactorOneMinusSourceAlpha; pipelineStateDescriptor.colorAttachments[0].rgbBlendOperation = MTLBlendOperationAdd; pipelineStateDescriptor.colorAttachments[0].sourceAlphaBlendFactor = MTLBlendFactorOne; pipelineStateDescriptor.colorAttachments[0].destinationAlphaBlendFactor = MTLBlendFactorOneMinusSourceAlpha; pipelineStateDescriptor.colorAttachments[0].alphaBlendOperation = MTLBlendOperationAdd; As far as I understand, that should be enough – that there is no need to alter the fragment shader. All the fragment shader needs to do is return the appropriate color, including its alpha value, and Metal should take care of the blending… Of course, I could have this desperately wrong, as well 😉 Thanks, -=Bret _______________________________________________ Do not post admin requests to the list. They will be ignored. Pro-apps-dev mailing list (Pro-apps-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/pro-apps-dev/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com