Skip to content

Instantly share code, notes, and snippets.

@JoshuaSullivan
Created January 26, 2016 19:47
Show Gist options
  • Save JoshuaSullivan/b17778ccd445559d9087 to your computer and use it in GitHub Desktop.
Save JoshuaSullivan/b17778ccd445559d9087 to your computer and use it in GitHub Desktop.
A confusing issue with the CIKernel's sample() method. Assigning the result of samplerTransform() to a variable and then using it in the sample() method breaks everything.
// This works.
kernel vec4 simpleFilter(sampler p)
{
vec2 dc = destCoord();
return sample(p, samplerTransform(p, dc));
}
// This does not. It produces [0, 0, 0, 255] for the first 255 pixels and then [0, 0, 0, 0] thereafter.
kernel vec4 simpleFilter(sampler p)
{
vec2 dc = destCoord();
vec2 tc = samplerTransform(p, dc);
return sample(p, tc);
}
@matt-curtis
Copy link

Seeing the same, many years later :))))) 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment