Skip to content

Instantly share code, notes, and snippets.

@bklimt
Last active January 2, 2016 06:49
Show Gist options
  • Save bklimt/8266066 to your computer and use it in GitHub Desktop.
Save bklimt/8266066 to your computer and use it in GitHub Desktop.
Core Image filter kernel function crashes
/*
* I'm trying to write Core Image filter kernel functions in Quartz Composer,
* but it's crashing consistently on certain pieces of code that should be fine.
*/
// This works fine:
kernel vec4 coreImageKernel(sampler image, __color color1) {
vec4 inputColor = sample(image, samplerCoord(image));
return inputColor;
}
// And this works fine:
kernel vec4 coreImageKernel(sampler image, __color color1) {
return color1;
}
// But this crashes every time:
kernel vec4 coreImageKernel(sampler image, __color color1) {
vec4 inputColor = sample(image, samplerCoord(image));
return color1;
}
// This works fine:
kernel vec4 coreImageKernel(sampler image, __color color1) {
vec4 inputColor = sample(image, samplerCoord(image));
return color1 + inputColor * 0.0000000001;
}
// But this crashes:
kernel vec4 coreImageKernel(sampler image, __color color1) {
vec4 inputColor = sample(image, samplerCoord(image));
return color1 + inputColor * 0.000000000;
}
/*
* The crash is a SIGABORT "pointer being freed was not allocated" in
* com.apple.CoreImage FEApplyTreeNode::render2(...).
*
* How can that be? Is there something important I'm missing about how to write
* OpenGL shader functions for Core Image kernels? Or is Core Image / Quartz
* Composer just really buggy?
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment