【发布时间】:2020-10-28 05:40:44
【问题描述】:
我在 Core Image Kernel Language 中有以下功能,我需要在 Metal Shading Language 中等效的功能,但我对 destCoord 、 unpremultiply 和 premultiply 功能有疑问。
kernel vec4 MyFunc(sampler src, __color color, float distance, float slope) {
vec4 t;
float d;
d = destCoord().y * slope + distance;
t = unpremultiply(sample(src, samplerCoord(src)));
t = (t - d*color) / (1.0-d);
return premultiply(t);
}
到目前为止,我在 MSL 中的功能是:
float4 MyFunc(sample_t image, float3 color, float dist, float slope) {
float4 t;
float d;
d = color[1] * slope + dist
...
return t;
}
任何帮助将不胜感激!
【问题讨论】:
标签: c metal core-image cifilter metalkit