Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
shaderinput.cc
Go to the documentation of this file.
1 
18 #include "ion/gfx/shaderinput.h"
19 #include <limits>
20 
21 namespace ion {
22 namespace gfx {
23 
29  static std::atomic<uint32> s_stamp1_counter(1U);
30  static std::atomic<uint32> s_stamp2_counter(0U);
31 
32  uint64 stamp_loworder = s_stamp1_counter++; // Post-increment
33  uint64 stamp_highorder;
35  if (stamp_loworder == std::numeric_limits<uint32>::max()) {
36  stamp_highorder = s_stamp2_counter++;
37  } else {
38  stamp_highorder = s_stamp2_counter;
39  }
40  return stamp_loworder | (stamp_highorder << 32);
41 }
42 
43 } // namespace gfx
44 } // namespace ion
static uint64 GetNewStamp()
Returns atomically post-incremented stamp.
Definition: shaderinput.cc:24