How to implement HLSL's globallycoherent for Metal?

Hello all

We would like to use AMD's FidelityFx Downsampler in our custom game engine and we are having difficulties to correctly implement it for Metal due to its use of the globallycoherent keyword. We have done extensive search online but have not succeeded in finding an answer. What we have found is the largely undocumented 'volatile' keyword, so we were hypothesising that marking a texture with 'volatile' (which implies 'device volatile' since it's a texture) could have the same effect but we are far from convinced it would work. Does anyone have insights into this?

Answered by Graphics and Games Engineer in 790074022

In Metal 3.2, we’ve introduced thecoherent(device) (§4.8 of the MSL Specification and an additional template parameter (memory_coherence) on texture types to allow threads in different threadgroups to cooperate with each other through device memory. The threads must still be properly synchronized using device atomics and the new atomic_thread_fence with thread_scope_device (§6.15.2 and §6.15.3).

In Metal 3.2, we’ve introduced thecoherent(device) (§4.8 of the MSL Specification and an additional template parameter (memory_coherence) on texture types to allow threads in different threadgroups to cooperate with each other through device memory. The threads must still be properly synchronized using device atomics and the new atomic_thread_fence with thread_scope_device (§6.15.2 and §6.15.3).

How to implement HLSL's globallycoherent for Metal?
 
 
Q