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=
"barrier">
9 <holder>Khronos Group
</holder>
12 <refentrytitle>barrier
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>barrier
</refname>
17 <refpurpose>synchronize execution of multiple shader invocations
</refpurpose>
19 <refsynopsisdiv><title>Declaration
</title>
22 <funcdef>void
<function>barrier
</function></funcdef>
23 <paramdef>void
</paramdef>
27 <refsect1 id=
"description"><title>Description
</title>
29 <emphasis>Available only in the Tessellation Control and Compute Shaders
</emphasis>,
<function>barrier
</function> provides
30 a partially defined order of execution between shader invocations. For any given static instance of
<function>barrier
</function>,
31 in a tessellation control shader, all invocations for a single input patch must enter it before any will be allowed
32 to continue beyond it. For any given static instance of
<function>barrier
</function> in a compute shader, all invocations
33 within a single work group must enter it before any are allowed to continue beyond it.
34 This ensures that values written by one invocation prior to a given static instance
35 of
<function>barrier
</function> can be safely read by other invocations after their call to the same static
36 instance of
<function>barrier
</function>. Because invocations may execute in undefined order between these
37 <function>barrier
</function> calls, the values of a per-vertex or per-patch output variable, or any shared variable will be undefined
41 <function>barrier
</function> may only be placed inside the function
<code>main()
</code> of the tessellation
42 control shader, but may be placed anywhere in a compute shader. Calls to
<function>barrier
</function> may not
43 be placed within any control flow. Barriers are also disallowed after a return
44 statement in the function
<code>main()
</code>.
47 <refsect1 id=
"versions"><title>Version Support
</title>
48 <informaltable frame=
"topbot">
53 <entry>barrier
</entry>#newin40#
59 <refsect1 id=
"Copyright"><title>Copyright
</title>
61 Copyright
<trademark class=
"copyright"></trademark> 2011-
2012 Khronos Group.
62 This material may be distributed subject to the terms and conditions set forth in
63 the Open Publication License, v
1.0,
8 June
1999.
64 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.