17 #ifndef SPIRV_CROSS_BARRIER_HPP 18 #define SPIRV_CROSS_BARRIER_HPP 41 std::atomic_thread_fence(std::memory_order_seq_cst);
52 unsigned target_iteration =
iteration.load(std::memory_order_relaxed) + 1;
54 unsigned target_count =
divisor * target_iteration;
58 unsigned c =
count.fetch_add(1u, std::memory_order_relaxed);
60 if (
c + 1 == target_count)
62 iteration.store(target_iteration, std::memory_order_relaxed);
67 while (
iteration.load(std::memory_order_relaxed) != target_iteration)
68 std::this_thread::yield();
GLuint divisor
Definition: glext.h:6953
std::atomic< unsigned > iteration
Definition: barrier.hpp:75
std::atomic< unsigned > count
Definition: barrier.hpp:74
void wait()
Definition: barrier.hpp:50
const GLubyte * c
Definition: glext.h:9812
GLuint GLuint GLsizei count
Definition: glext.h:6292
Barrier()
Definition: barrier.hpp:28
Definition: barrier.hpp:23
void reset_counter()
Definition: barrier.hpp:44
Definition: barrier.hpp:25
unsigned divisor
Definition: barrier.hpp:73
void set_release_divisor(unsigned divisor)
Definition: barrier.hpp:34
static void memoryBarrier()
Definition: barrier.hpp:39