【发布时间】:2010-07-11 10:34:09
【问题描述】:
我正在尝试将以下内核例程包含到我的 Cocoa / Objective C 项目中。但是我在构建项目时遇到了编译器错误。第一行用语法错误标记,在 'vec4' 之前显示“expected '=', ',', ';', 'asm' or 'attribute'.
任何想法这意味着什么以及如何解决它?据我所知,该声明看起来与我能找到的所有其他内核示例非常相似。
kernel vec4 threshold(sampler image, float midPoint, float range ) // First error on this line
//This from http://www.codingadventures.com/2008/06/threshold-filter-in-glsl/
{
vec4 pixel=unpremultiply( sample(image, samplerCoord(image)) );
float high = midPoint + range * 0.5;
float low = midPoint - range * 0.5;
high = min(1.0, high);
low = max(0.0, low);
float brightness = 0.3 * pixel.x + 0.59 * pixel.y+ 0.11 *pixel.z;
brightness = step( low, brightness ) * brightness;
brightness = brightness + step( high, brightness );
brightness = min( 1.0, brightness );
pixel.x = pixel.y =pixel.z = brightness;
return premultiply(pixel);
}
【问题讨论】:
标签: objective-c cocoa