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
<!ENTITY commonFunctionsInc SYSTEM "commonFunctionsInc.xml">
10
<keyword>clamp</keyword>
15
<refentrytitle>clamp</refentrytitle>
19
<year>2007-2011</year>
20
<holder>The Khronos Group Inc.
21
Permission is hereby granted, free of charge, to any person obtaining a
22
copy of this software and/or associated documentation files (the
23
"Materials"), to deal in the Materials without restriction, including
24
without limitation the rights to use, copy, modify, merge, publish,
25
distribute, sublicense, and/or sell copies of the Materials, and to
26
permit persons to whom the Materials are furnished to do so, subject to
27
the condition that this copyright notice and permission notice shall be included
28
in all copies or substantial portions of the Materials.</holder>
31
<manvolnum>3</manvolnum>
34
<!-- ================================ SYNOPSIS -->
36
<refnamediv id="clamp">
37
<refname>clamp</refname>
40
Clamp <varname>x</varname> to range given by <varname>min</varname>, <varname>max</varname>
44
<refsynopsisdiv xmlns:xlink="http://www.w3.org/1999/xlink"><title></title>
54
<paramdef>gentype<parameter>x</parameter></paramdef>
55
<paramdef>gentype<parameter>minval</parameter></paramdef>
56
<paramdef>gentype<parameter>maxval</parameter></paramdef>
68
<paramdef>gentypef<parameter>x</parameter></paramdef>
69
<paramdef><link xlink:href="scalarDataTypes.html">float</link><parameter>minval</parameter></paramdef>
70
<paramdef><link xlink:href="scalarDataTypes.html">float</link><parameter>maxval</parameter></paramdef>
82
<paramdef>gentyped<parameter>x</parameter></paramdef>
83
<paramdef><link xlink:href="scalarDataTypes.html">double</link><parameter>minval</parameter></paramdef>
84
<paramdef><link xlink:href="scalarDataTypes.html">double</link><parameter>maxval</parameter></paramdef>
90
<!-- Optional Half prototypes -->
92
<refsect2 xmlns:xlink="http://www.w3.org/1999/xlink" id="double">
95
<informaltable frame="none">
96
<tgroup cols="1" align="left" colsep="0" rowsep="0">
97
<colspec colname="col1" colnum="1" />
102
<type>gentype</type> <function>clamp</function> (<type>gentype</type> <varname>x</varname>,
103
<type>gentype</type> <varname>minval</varname>,
104
<type>gentype</type> <varname>maxval</varname>) // if half extension enabled
110
<type>gentype</type> <function>clamp</function> (<type>gentype</type> <varname>x</varname>,
111
<type><link xlink:href="scalarDataTypes.html">half</link></type> <varname>minval</varname>,
112
<type><link xlink:href="scalarDataTypes.html">half</link></type> <varname>maxval</varname>) // if half extension enabled
121
<!-- ================================ DESCRIPTION -->
123
<refsect1 id="description"><title>Description</title>
125
Returns <function>min</function>(<function>fmax</function>(<varname>x</varname>,
126
<varname>minval</varname>), <varname>maxval</varname>).
130
Results are undefined if <varname>minval</varname> > <varname>maxval</varname>.
134
<!-- ================================ NOTES -->
136
<refsect1 id="notes"><title>Notes</title>
139
If extended with <citerefentry><refentrytitle>cl_khr_fp16</refentrytitle></citerefentry>,
140
generic type name <type>gentype</type> may indicate <type>half</type> and
141
<type>half{2|3|4|8|16}</type> as arguments and return values.
145
<!-- ================================ EXAMPLE -->
146
<!-- DO NOT DELETE IN CASE AN EXAMPLE IS ADDED IN THE FUTURE -->
148
<refsect2 id="example1">
153
<informaltable frame="none">
154
<tgroup cols="1" align="left" colsep="0" rowsep="0">
155
<colspec colname="col1" colnum="1" />
159
Example goes here - it will be set in "code" type with white space preserved.
168
<!-- ================================ SPECIFICATION -->
169
<!-- Set the "uri" attribute in the <olink /> element to the "named destination" for the PDF page
171
<refsect1 id="specification"><title>Specification</title>
174
<imagedata fileref="pdficon_small1.gif" format="gif" />
177
<olink uri="commonFunctions">OpenCL Specification</olink>
181
<!-- ================================ ALSO SEE -->
183
<refsect1 id="seealso"><title>Also see</title>
185
<citerefentry href="commonFunctions"><refentrytitle>Common Functions</refentrytitle></citerefentry>
189
<!-- ============================== COPYRIGHT -->
190
<!-- Content included from copyright.inc.xsl -->
192
<refsect3 id="Copyright"><title></title>
194
<imagedata fileref="KhronosLogo.jpg" format="jpg" />