I'm trying to figure out the maximum usable size of a CVPixelBuffer. Here's my sample code:
CGSize frameSize = CGSizeMake(32768,16384);
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey,
[NSNumber numberWithBool:YES], kCVPixelBufferMetalCompatibilityKey,
[NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey,
nil];
CVPixelBufferRef pxBuffer = NULL;
CVReturn status = CVPixelBufferCreate( kCFAllocatorDefault, frameSize.width, frameSize.height, kCVPixelFormatType_32BGRA, (__bridge CFDictionaryRef)options, &pxBuffer);
if (status != kCVReturnSuccess || pxBuffer==nil)
NSBeep(); // error creating bufferHere's a little table of (x,y) pixel sizes and their failure status:
(32768,16384) FAILS
(32768,16383) OK
(131072,4095) OK
(131072,4096) FAILS
(4095,131072) FAILS
(16383,32768) FAILS
(16384,32768) FAILS
(16384,32767) OK
(pow(2,24),pow(2,4)) OK
(pow(2,24),pow(2,5)) FAILS
(pow(2,24),pow(2,5)-1) OK
(pow(2,4),pow(2,24)) OK
(pow(2,5),pow(2,24)) FAILS
(pow(2,5),pow(2,24)-1) OK
I can't quite figure out the criteria for what makes for valid (extreme) dimensions of an RGBA32 CVPixelBuffer. An (M,N) size might work but then (N,M) won't.
Is there documentation about for these maximum sizes? It would seem that they exceed the Metal Specs given here:
https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
which leads me to believe creation of a CVPixelBuffer is not a GPU-bound activity.
I'm trying this on a late-2015 iMac 5K, Radeon R9-M395, OS 10.12.6.