OFX: MTLBuffer size for OFX plugins?

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Bart Walczak

  • Posts: 6
  • Joined: Wed Aug 19, 2015 2:22 pm

OFX: MTLBuffer size for OFX plugins?

PostThu 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:

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)];
Offline

Hendrik Proosa

  • Posts: 1256
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: OFX: MTLBuffer size for OFX plugins?

PostThu Nov 19, 2020 6:08 pm

The size you get in assertion is exactly the size of 2048x1024 pixel 32bit float RGBA as bytes. Are you sure about your resolution and buffer length math?
I do stuff.
Offline

Bart Walczak

  • Posts: 6
  • Joined: Wed Aug 19, 2015 2:22 pm

Re: OFX: MTLBuffer size for OFX plugins?

PostThu Nov 19, 2020 6:23 pm

Hendrik Proosa wrote:The size you get in assertion is exactly the size of 2048x1024 pixel 32bit float RGBA as bytes. Are you sure about your resolution and buffer length math?


Ah, indeed, I had the rowBytes in bits not bytes. Thanks!

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 3 guests