OFX: MTLBuffer size for OFX plugins?
Posted: Thu Nov 19, 2020 5:25 pm
Hi everyone,
I'm trying to blit the contents of the MTLBuffer that I get as the input clip into a texture, and the size of the buffer seems not to match the texture size.
For 1920x1080 32-bit float RGBA I'm getting the buffer length of 33,554,432, while it should be about 7.9 times larger. This is the assertion that I get:
When I make this call:
I'm trying to blit the contents of the MTLBuffer that I get as the input clip into a texture, and the size of the buffer seems not to match the texture size.
For 1920x1080 32-bit float RGBA I'm getting the buffer length of 33,554,432, while it should be about 7.9 times larger. This is the assertion that I get:
- Code: Select all
-[MTLDebugBlitCommandEncoder validateCopyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options:]:768: failed assertion `totalBytesUsed(265205760) must be <= [sourceBuffer length](33554432).'
When I make this call:
- Code: Select all
EncodeCopyBuffer:(id<MTLBuffer>)src
toTexture:(id<MTLTexture>)dst
into:(id<MTLCommandBuffer>)commandBuffer
{
auto info = texInfo(dst); // extracts info about texture
[blitEncoder copyFromBuffer:src
sourceOffset:0
sourceBytesPerRow:info.bytesPerRow
sourceBytesPerImage:info.bytesPerRow * dst.height
sourceSize:MTLSizeMake(dst.width, dst.height, dst.depth)
toTexture:dst
destinationSlice:0
destinationLevel:0
destinationOrigin:MTLOriginMake(0, 0, 0)];