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: 1644
  • 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!
Offline

gene JACQUES

  • Posts: 3
  • Joined: Mon Mar 14, 2016 1:24 pm

Re: OFX: MTLBuffer size for OFX plugins?

PostFri Dec 04, 2020 8:24 pm

Greetings

does any one know or have a ofx plugin or a developed tool similar to photoshop selective color tool that's works or act and behaves more or less similar to the photoshop like selective color unless its not been thought off or considered

would appreciate if any one could point me in the right direction
much appreciated
Attachments
Photoshop_selective_color.jpg
Photoshop_selective_color.jpg (97.82 KiB) Viewed 830 times
Offline

Bruce Payan

  • Posts: 27
  • Joined: Wed Mar 27, 2013 11:39 am

Re: OFX: MTLBuffer size for OFX plugins?

PostFri Dec 04, 2020 11:57 pm

Bart Walczak wrote:
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!


One thing about the rowBytes.... if your buffer was, say, 2048x1018, your row bytes will still be the same (with unused bytes on each row), and CVPixelBuffer would expect a 2048x1024 sized buffer. It used to be that it would round up on 4-byte intervals -- but I believe it's now 16-byte intervals now with 128-bit intrinsics, This is why one always enquires CoreVideo about the number of rowBytes to a buffer. That issue has nipped a few people in the past. *ahem*.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 3 guests