vtk-m2/vtkm/rendering
Kenneth Moreland 28ecf3636d Change interface of atomic compare and swap
The old atomic compare and swap operations (`vtkm::AtomicCompareAndSwap`
and `vtkm::exec::AtomicArrayExecutionObject::CompareAndSwap`) had an
order of arguments that was confusing. The order of the arguments was
shared pointer (or index), desired value, expected value. Most people
probably assume expected value comes before desired value. And this
order conflicts with the order in the `std` methods, GCC atomics, and
Kokkos.

Change the interface of atomic operations to be patterned off the
`std::atomic_compare_exchange` and `std::atomic<T>::compare_exchange`
methods. First, these methods have a more intuitive order of parameters
(shared pointer, expected, desired). Second, rather than take a value
for the expected and return the actual old value, they take a pointer to
the expected value (or reference in `AtomicArrayExecutionObject`) and
modify this value in the case that it does not match the actual value.
This makes it harder to mix up the expected and desired parameters.
Also, because the methods return a bool indicating whether the value was
changed, there is an additional benefit that compare-exchange loops are
implemented easier.

For example, consider you want to apply the function `MyOp` on a
`sharedValue` atomically. With the old interface, you would have to do
something like this.

```cpp
T oldValue;
T newValue;
do
{
  oldValue = *sharedValue;
  newValue = MyOp(oldValue);
} while (vtkm::AtomicCompareAndSwap(sharedValue, newValue, oldValue) != oldValue);
```

With the new interface, this is simplfied to this.

```cpp
T oldValue = *sharedValue;
while (!vtkm::AtomicCompareExchange(sharedValue, &oldValue, MyOp(oldValue));
```
2020-10-20 08:39:22 -06:00
..
internal
raytracing clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
testing Simplify getting test file names 2020-08-25 06:17:59 -06:00
Actor.cxx Remove virtual methods from ColorTable 2020-09-14 13:26:16 -06:00
Actor.h
AxisAnnotation2D.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
AxisAnnotation2D.h
AxisAnnotation3D.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
AxisAnnotation3D.h
AxisAnnotation.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
AxisAnnotation.h
BitmapFont.cxx
BitmapFont.h
BitmapFontFactory.cxx
BitmapFontFactory.h
BoundingBoxAnnotation.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
BoundingBoxAnnotation.h
Camera.cxx
Camera.h
Canvas.cxx Move ColorTable::Sample methods to vtkm_cont 2020-09-14 16:40:26 -06:00
Canvas.h Deprecate Camera::Activate() and Camera::Finish() 2020-06-14 11:04:06 -04:00
CanvasRayTracer.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
CanvasRayTracer.h
CMakeLists.txt
Color.cxx
Color.h
ColorBarAnnotation.cxx Remove virtual methods from ColorTable 2020-09-14 13:26:16 -06:00
ColorBarAnnotation.h
ColorLegendAnnotation.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
ColorLegendAnnotation.h
ConnectivityProxy.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
ConnectivityProxy.h
Cylinderizer.h
DecodePNG.h
EncodePNG.h
LineRenderer.cxx
LineRenderer.h
Mapper.cxx Move ColorTable::Sample methods to vtkm_cont 2020-09-14 16:40:26 -06:00
Mapper.h Fix warnings about overriding deprecated methods 2020-06-17 17:58:07 -06:00
MapperConnectivity.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
MapperConnectivity.h Fix warnings about overriding deprecated methods 2020-06-17 17:58:07 -06:00
MapperCylinder.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
MapperCylinder.h Fix warnings about overriding deprecated methods 2020-06-17 17:58:07 -06:00
MapperPoint.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
MapperPoint.h Fix warnings about overriding deprecated methods 2020-06-17 17:58:07 -06:00
MapperQuad.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
MapperQuad.h Fix warnings about overriding deprecated methods 2020-06-17 17:58:07 -06:00
MapperRayTracer.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
MapperRayTracer.h Fix warnings about overriding deprecated methods 2020-06-17 17:58:07 -06:00
MapperVolume.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
MapperVolume.h Fix warnings about overriding deprecated methods 2020-06-17 17:58:07 -06:00
MapperWireframer.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
MapperWireframer.h Fix warnings about overriding deprecated methods 2020-06-17 17:58:07 -06:00
MatrixHelpers.h
Quadralizer.h
ScalarRenderer.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
ScalarRenderer.h
Scene.cxx Deprecate StartScene() and EndScene() 2020-06-14 11:27:45 -04:00
Scene.h
TextAnnotation.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
TextAnnotation.h
TextAnnotationBillboard.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
TextAnnotationBillboard.h
TextAnnotationScreen.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
TextAnnotationScreen.h
TextRenderer.cxx
TextRenderer.h
Texture2D.h clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
Triangulator.h Trivial typo fix. 2020-05-08 10:59:09 -04:00
View1D.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
View1D.h
View2D.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
View2D.h
View3D.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
View3D.h
View.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
View.h Add option to enable/disable world annotations. 2020-07-09 14:38:39 -04:00
Wireframer.h Change interface of atomic compare and swap 2020-10-20 08:39:22 -06:00
WorldAnnotator.cxx clang-format: reformat the repository with clang-format-9 2020-08-24 14:01:08 -04:00
WorldAnnotator.h