[英]How to convert a MTLTexture to CVpixelBuffer to write into an AVAssetWriter?
[英]Read/Write same MTLTexture on iOS
texture2d
access::read_write
texture2d
限定符似乎仅在OSX上可用。 有没有办法在kernel
(或其他)金属函数中读/写相同的纹理?
原因是写入的纹理值可能不是最终的,可以由其他线程更新。
感谢@warrenm的提示。 它使用原子缓冲区
device atomic_uint *buf [[ buffer(0) ]]
执行以下步骤:
kernel
函数中初始化我的原子缓冲区,该函数在操作之前运行 kernel
使用atomic_fetch_min_explicit(buf[pos], val, memory_order_relaxed)
计算特定坐标的atomic_fetch_min_explicit(buf[pos], val, memory_order_relaxed)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.