The texture2d
access::read_write
qualifier seems only available on OSX. Is there a way to read/write the same texture inside a kernel
(or other) metal function?
The reason is the written texture values may not be final and can be updated by other threads.
Thanks for the hint @warrenm. It works using an atomic buffer
device atomic_uint *buf [[ buffer(0) ]]
performing following steps:
kernel
function that runs before the operation kernel
computes a min value for a specific coordinate using atomic_fetch_min_explicit(buf[pos], val, memory_order_relaxed)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.