【发布时间】:2019-04-16 13:54:00
【问题描述】:
我开发了一个 iOS 金属相机应用,但出现错误:
Compute Function(kernel_function): missing buffer binding at index 0 for timeDelta[0].
内核代码如下:
kernel void kernel_function(
texture2d<float, access::sample> inTexture [[texture(0)]],
texture2d<float, access::write> outTexture [[texture(1)]],
const device float *timeDelta [[buffer(0)]],
uint2 gid [[thread_position_in_grid]],
uint2 tpg [[threads_per_grid]])
{
float time = timeDelta[0];
.......
问题似乎是timeDelta 错过了缓冲区绑定。如果我删除 timeDelta[0] 并设置
float time = 1.0
没有错误,应用程序可以流畅运行。但是屏幕效果是固定的画面而不是动画。所以timeDelta就是让效果随时间变化成为一个视频。有没有人知道如何在内核函数上应用时间或在 iOS Metal 中绑定 timeDelta 缓冲区来解决错误?非常感谢。
【问题讨论】: