glsl: Implement use_scoped_barrier option
When the option is enabled, lower memory/control barriers to nir_intrinsic_scoped_barrier, which has more details about the memory barrier semantics.
The translation of the following is based on https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_gl_spirv.txt
- memoryBarrier()
- memoryBarrierBuffer()
- memoryBarrierImage()
- memoryBarrierShared()
- groupMemoryBarrier()
Also use scoped barrier for the memory counterparts of the GLSL (control) barrier() when the option is enabled.
For memoryBarrierAtomicCounter() there's no corresponding nir_var_atomic_counter mode. Since atomic counters are lowered to SSBOs, use the nir_var_mem_ssbo mode in the scoped barrier instead.
Edited by Caio Oliveira