On Jun 23, 2016, at 2:56 PM, Jonathan Mitchell <li...@mugginsoft.com> wrote: > > On a rare occasion I encounter the following abort while rendering an image > in an NSImage category. > The method (shown below) gets called frequently to render resources as > grayscale. > Looks like the driver has issues but beyond that I am stuck. > Any ideas? > > Thread 1 (main-thread) > #0 0x00007fff9972ef06 in __pthread_kill () > #1 0x000000010183642d in pthread_kill () > #2 0x00007fff8d3426e7 in abort () > #3 0x00007fff9b3ace5c in gpusGenerateCrashLog ()
Are there any logs generated from the above call (other than your app's crash log)? Browse around within Console.app's log list to see. > #4 0x00000001127259dc in > ___lldb_unnamed_function586$$AMDRadeonX4000GLDriver () > #5 0x00007fff9b3ae204 in gpusSubmitDataBuffers () > #6 0x0000000112762813 in > ___lldb_unnamed_function1027$$AMDRadeonX4000GLDriver () > #7 0x0000000112778d37 in > ___lldb_unnamed_function1175$$AMDRadeonX4000GLDriver () > #8 0x00007fff91a1f22f in glReadPixels_Exec () > #9 0x00007fff91f0ceb9 in CI::GLContext::readback_bitmap(CI::Bitmap*, > CI::swizzle_info) () > #10 0x00007fff91dd43d9 in CI::image_get_cgimage(CI::Context*, CI::Image*, > CGRect, CGColorSpace*, CI::PixelFormat) () > #11 0x00007fff91db606a in -[CIContext > createCGImage:fromRect:format:colorSpace:] () > #12 0x00007fff91db476e in -[CIContext drawImage:inRect:fromRect:] () > #13 0x00007fff9ba09801 in -[CIImage(NSAppKitAdditions) > drawInRect:fromRect:operation:fraction:] () > #14 0x00007fff9ba09914 in -[CIImage(NSAppKitAdditions) > drawAtPoint:fromRect:operation:fraction:] () > #15 0x0000000100028f47 in -[NSImage(Test) > bp_grayscaleImageWithAlphaValue:saturationValue:brightnessValue:contrastValue:] > at > > NSImage category: > > - (NSImage *)bp_grayscaleImageWithAlphaValue:(CGFloat)alphaValue > saturationValue:(CGFloat)saturationValue > brightnessValue:(CGFloat)brightnessValue > contrastValue:(CGFloat)contrastValue > { > NSSize size = [self size]; > NSRect bounds = { NSZeroPoint, size }; > NSImage *tintedImage = [[NSImage alloc] initWithSize:size]; > > [tintedImage lockFocus]; > > CIImage *image = [CIImage imageWithData:[self TIFFRepresentation]]; > > CIFilter *colorFilter = [CIFilter filterWithName:@"CIColorControls"]; > [colorFilter setDefaults]; > [colorFilter setValue:image forKey:kCIInputImageKey]; > [colorFilter setValue:[NSNumber numberWithFloat:saturationValue] > forKey:kCIInputSaturationKey]; > [colorFilter setValue:[NSNumber numberWithFloat:brightnessValue] > forKey:kCIInputBrightnessKey]; > [colorFilter setValue:[NSNumber numberWithFloat:contrastValue] > forKey:kCIInputContrastKey]; Any chance these values are out of valid range? > > CIImage *filterImage = [colorFilter valueForKey:kCIOutputImageKey]; > > [filterImage drawAtPoint:NSZeroPoint // << this is the call site that > eventually aborts > fromRect:bounds > operation:NSCompositeCopy > fraction:alphaValue]; What does it mean to use a potentially non-1.0 fraction for a copy to an as-yet-uninitialized image? No idea if that might contribute to the problem. Maybe clearing the image to some background color first would help. Also, have you considered using -[CIContext createCGImage:fromRect:] to create the image instead of drawing into a focus-locked NSImage? To get an NSImage from the CGImage, you can use [[NSImage alloc] initWithCGImage:… size:NSZeroSize]. Regards, Ken _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com