Reputation:
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.
Upvotes: 3
Views: 1572
Reputation:
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 operationkernel
computes a min value for a specific coordinate using atomic_fetch_min_explicit(buf[pos], val, memory_order_relaxed)
Upvotes: 1