I have encountered the same FxPlug problem as described by @goamk. I have created my own texture and wish to render it to the output texture. In attempting to setup the command encoder with the outputTexture as the colorAttachment, the error described by goamk appears in Xcode debugger.
As goamk notes, the plugin DOES work as expected when NOT run via the Xcode debugger.
Fxplug = v4.3
Motion = v5.8
Xcode = 15.4
OS = Sonoma 14.5 on Apple M2 Max studio.
My code worked fine previously under Fxplug 4.2.2 and Motion 5.5.3 on an Intel Mac.
I have a different Fxplug in which I resolve an MSAA into the outputTexture. This is working fine.
Looking at the current FxBrightness example, it appears to me that I am doing the same type of setup to write to the output texture as demonstrated there (though mine is in Objective-C still). But I must be missing something.
Code excerpt
uint64_t deviceRegistryID = destinationImage.deviceRegistryID;
FxMTLDeviceCache* deviceCache = [FxMTLDeviceCache deviceCache];
// Get the destination's GPU device
id<MTLDevice> device = [deviceCache deviceWithRegistryID:deviceRegistryID];
MTLPixelFormat pixelFormat = [FxMTLDeviceCache MTLPixelFormatForImageTile:destinationImage];
id<MTLCommandQueue> commandQueue = [deviceCache commandQueueWithRegistryID:deviceRegistryID
pixelFormat:pixelFormat];
id<MTLTexture> outputTexture = [destinationImage metalTextureForDevice:device];
[SNIP]
// Setup the color attachment for the output texture, with load action to clear the output texture
MTLRenderPassColorAttachmentDescriptor* fbColorAttachmentDescriptor = [[MTLRenderPassColorAttachmentDescriptor alloc] init];
fbColorAttachmentDescriptor.texture = outputTexture;
fbColorAttachmentDescriptor.clearColor = MTLClearColorMake(0.0, 0.0, 0.0, 0.0);
fbColorAttachmentDescriptor.loadAction = MTLLoadActionClear;
NSLog(@"Output texture usage is: %lu", outputTexture.usage);
// Create a render pass descriptor and attach the color attachment to it
MTLRenderPassDescriptor* fbRenderPassDescriptor = [MTLRenderPassDescriptor renderPassDescriptor];
fbRenderPassDescriptor.colorAttachments [ 0 ] = fbColorAttachmentDescriptor;
// Create the render command encoder
id<MTLRenderCommandEncoder> fbCommandEncoder = [fbCommandBuffer renderCommandEncoderWithDescriptor:fbRenderPassDescriptor];
==>
validateRenderPassDescriptor:782: failed assertion `RenderPass Descriptor Validation
Texture at colorAttachment[0] has usage (0x01) which doesn't specify MTLTextureUsageRenderTarget (0x04)
'