2a16b83c4870c29694cd3f6880985d161e1658be
[clinton/guile-figl.git] / upstream-man-pages / manglsl / atomicExchange.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id="atomicExchange">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>2012</year>
9 <holder>Khronos Group</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>atomicExchange</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>atomicExchange</refname>
17 <refpurpose>perform an atomic exchange operation to a variable</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>Declaration</title>
20 <funcsynopsis>
21 <funcprototype>
22 <funcdef>int <function>atomicExchange</function></funcdef>
23 <paramdef>inout int <parameter>mem</parameter></paramdef>
24 <paramdef>int <parameter>data</parameter></paramdef>
25 </funcprototype>
26 <funcprototype>
27 <funcdef>uint <function>atomicExchange</function></funcdef>
28 <paramdef>inout uint <parameter>mem</parameter></paramdef>
29 <paramdef>uint <parameter>data</parameter></paramdef>
30 </funcprototype>
31 </funcsynopsis>
32 </refsynopsisdiv>
33 <refsect1 id="parameters"><title>Parameters</title>
34 <variablelist>
35 <varlistentry>
36 <term><parameter>mem</parameter></term>
37 <listitem>
38 <para>
39 The variable to use as the target of the operation.
40 </para>
41 </listitem>
42 </varlistentry>
43 <varlistentry>
44 <term><parameter>data</parameter></term>
45 <listitem>
46 <para>
47 The data to be exchanged with <parameter>mem</parameter>.
48 </para>
49 </listitem>
50 </varlistentry>
51 </variablelist>
52 </refsect1>
53 <refsect1 id="description"><title>Description</title>
54 <para>
55 <function>atomicExchange</function> performs an atomic exhange of <parameter>data</parameter> with the contents of
56 <parameter>mem</parameter>. The content of <parameter>data</parameter> is written into <parameter>mem</parameter> and the original contents of <parameter>mem</parameter>
57 are returned. The contents of the memory being updated by the atomic operation are
58 guaranteed not to be modified by any other assignment or atomic memory function in any shader
59 invocation between the time the original value is read and the time the new value is written.
60 </para>
61 <para>
62 Atomic memory functions are supported only for a limited set of variables. A shader will fail to compile
63 if the value passed to the mem argument of an atomic memory function does not correspond to a buffer or
64 shared variable. It is acceptable to pass an element of an array or a single component of a vector to the
65 mem argument of an atomic memory function, as long as the underlying array or vector is a buffer or
66 shared variable.
67 </para>
68 </refsect1>
69 <refsect1 id="versions"><title>Version Support</title>
70 <informaltable frame="topbot">
71 #VARTABLECOLS#
72 <thead>
73 #FUNCTABLEHEADER#
74 <row>
75 <entry>atomicExchange</entry>#newin43#
76 </row>
77 </thead>
78 </tgroup>
79 </informaltable>
80 </refsect1>
81 <refsect1 id="seealso"><title>See Also</title>
82 <para>
83 <citerefentry><refentrytitle>atomicAdd</refentrytitle></citerefentry>,
84 <citerefentry><refentrytitle>atomicAnd</refentrytitle></citerefentry>,
85 <citerefentry><refentrytitle>atomicOr</refentrytitle></citerefentry>,
86 <citerefentry><refentrytitle>atomicXor</refentrytitle></citerefentry>,
87 <citerefentry><refentrytitle>atomicMin</refentrytitle></citerefentry>,
88 <citerefentry><refentrytitle>atomicMax</refentrytitle></citerefentry>,
89 <citerefentry><refentrytitle>atomicCompSwap</refentrytitle></citerefentry>
90 </para>
91 </refsect1>
92 <refsect1 id="Copyright"><title>Copyright</title>
93 <para>
94 Copyright <trademark class="copyright"></trademark> 2011-2012 Khronos Group.
95 This material may be distributed subject to the terms and conditions set forth in
96 the Open Publication License, v 1.0, 8 June 1999.
97 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
98 </para>
99 </refsect1>
100 </refentry>