在金属的内核函数中水平翻转纹理

时间:2018-10-03 12:31:30

标签: swift metal metalkit

我只需要使用金属中的内核函数水平翻转纹理即可。这是我的内核。

kernel void compute(
                    texture2d<float,access::read> des [[texture(0)]],
                    texture2d<float, access::write> src [[texture(1)]],
                    uint2 gid [[thread_position_in_grid]])
{


    float4 flipColor = src.read(uint2(gid.x,1536 - gid.y));

    des.write(flipColor, gid);
}

这里源纹理是我需要翻转的纹理。我正在从源纹理读取并写入目标纹理。但是它不能正常工作。 (赋予透明纹理)

这是什么原因?有建议吗?

0 个答案:

没有答案