You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/guide/agent-functions/interacting-with-environment.rst
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,9 @@ Environmental macro properties can be read, via the returned :class:`DeviceMacro
76
76
77
77
They can also be updated with a selection of functions, which execute atomically. These functions will update a single variable and return information related to it's old or new state. This can be useful, for simple actions such as conflict resolution and counting. However, if a basic read is subsequently required, a separate host or agent function in a following layer must be used (otherwise there would be a race condition). If running with ``FLAMEGPU_SEATBELTS`` error checking enabled, an exception should be thrown where potential race conditions are detected.
78
78
79
-
Macro properties support the normal :func:`+<flamegpu::DeviceMacroProperty::operator+>`, :func:`-<flamegpu::DeviceMacroProperty::operator->`, :func:`+=<flamegpu::DeviceMacroProperty::operator+=>`, :func:`-=<flamegpu::DeviceMacroProperty::operator-=>`, :func:`++<flamegpu::DeviceMacroProperty::operator++>` (only C++ supports pre and post increment), :func:`--<flamegpu::DeviceMacroProperty::operator-->` (only C++ supports pre and post decrement) operations. They also have access to a limited set of additional functions, explained in the table below.
79
+
Macro properties support the normal :func:`+=<flamegpu::DeviceMacroProperty::operator+=>`, :func:`-=<flamegpu::DeviceMacroProperty::operator-=>`, :func:`++<flamegpu::DeviceMacroProperty::operator++>` (only C++ supports pre and post increment), :func:`--<flamegpu::DeviceMacroProperty::operator-->` (only C++ supports pre and post decrement) operations. They also have access to a limited set of additional functions, explained in the table below.
80
+
81
+
They can also make use of :func:`+<flamegpu::DeviceMacroProperty::operator+>`, :func:`-<flamegpu::DeviceMacroProperty::operator->`, however, these do not operate atomically as they do not mutate the macro environment property.
80
82
81
83
.. note::
82
84
@@ -90,6 +92,8 @@ Method Supported Typ
90
92
:func:`max(val)<flamegpu::DeviceMacroProperty::max>` ``int32_t``, ``uint32_t``, ``uint64_t`` Update property according to ``val > old ? val : old`` and return it's new value.
91
93
:func:`CAS(compare, val)<flamegpu::DeviceMacroProperty::CAS>` ``int32_t``, ``uint32_t``, ``uint64_t``, ``uint16_t`` Update property according to ``old == compare ? val : old`` and return ``old``.
92
94
:func:`exchange(val)<flamegpu::DeviceMacroProperty::exchange>` ``int32_t``, ``uint32_t``, ``float`` Update property to match val, and return ``old``.
95
+
:func:`addAtomic(val)<flamegpu::DeviceMacroProperty::addAtomic>` ``int32_t``, ``uint32_t``, ``uint64_t``, ``float``, ``double`` Atomically add val and return the result.
96
+
:func:`subAtomic(val)<flamegpu::DeviceMacroProperty::addAtomic>` ``int32_t``, ``uint32_t``, ``uint64_t``, ``float``, ``double`` Atomically subtract val and return the result.
0 commit comments