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">
8
<keyword>clCreateSampler</keyword>
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="clCreateSampler">
42
Creates a sampler object.
46
<refsynopsisdiv xmlns:xlink="http://www.w3.org/1999/xlink"><title></title>
50
<link xlink:href="abstractDataTypes.html">cl_sampler</link> <function>clCreateSampler</function>
53
<paramdef><link xlink:href="abstractDataTypes.html">cl_context</link><parameter>context</parameter></paramdef>
54
<paramdef><link xlink:href="enums.html#cl_bool">cl_bool</link><parameter>normalized_coords</parameter></paramdef>
55
<paramdef><link xlink:href="enums.html#cl_addressing_mode">cl_addressing_mode</link><parameter>addressing_mode</parameter></paramdef>
56
<paramdef><link xlink:href="enums.html#cl_filter_mode">cl_filter_mode</link><parameter>filter_mode</parameter></paramdef>
57
<paramdef><link xlink:href="scalarDataTypes.html">cl_int</link><parameter>*errcode_ret</parameter></paramdef>
63
<!-- ================================ PARAMETERS -->
65
<refsect1 id="parameters">
66
<title>Parameters</title>
70
<term> <varname> context </varname> </term>
72
<para> <!-- parameter description -->
73
Must be a valid OpenCL context.
79
<term> <varname> normalized_coords </varname> </term>
81
<para> <!-- parameter description -->
82
Determines if the image coordinates specified are normalized (if
83
<varname>normalized_coords</varname> is <constant>CL_TRUE</constant>) or
84
not (if <varname>normalized_coords</varname> is <constant>CL_FALSE</constant>).
90
<term> <varname> addressing_mode </varname> </term>
92
<para> <!-- parameter description -->
93
Specifies how out-of-range image coordinates are handled when reading from
94
an image. This can be set to <constant>CL_ADDRESS_MIRRORED_REPEAT</constant>,
95
<constant>CL_ADDRESS_REPEAT</constant>, <constant>CL_ADDRESS_CLAMP_TO_EDGE</constant>,
96
<constant>CL_ADDRESS_CLAMP</constant>, and <constant>CL_ADDRESS_NONE</constant>.
102
<term> <varname> filter_mode </varname> </term>
104
<para> <!-- parameter description -->
105
Specifies the type of filter that must be applied when reading an image. This can be
106
<constant>CL_FILTER_NEAREST</constant> or <constant>CL_FILTER_LINEAR</constant>.
112
<term> <varname> errcode_ret </varname> </term>
115
<!-- parameter description --> Returns an appropriate error code. If
116
<varname>errcode_ret</varname> is NULL, no error code is returned.
123
<!-- ================================ NOTES -->
125
<refsect1 id="notes"><title>Notes</title>
127
<!-- should this paragraph be replicated in other sampler-related pages? [core spec
128
p. 126, section 5.5.1] --> A sampler object describes how to sample an image when the
129
image is read in the kernel. The built-in functions to read from an image in a kernel
130
take a sampler as an argument. The sampler arguments to the image read function can
131
be sampler objects created using OpenCL functions and passed as argument values to
132
the kernel or can be samplers declared inside a kernel. In this section we discuss
133
how sampler objects are created using OpenCL functions.
137
For more information about working with samplers, see
138
<citerefentry><refentrytitle>sampler_t</refentrytitle></citerefentry>
142
<!-- ================================ ERRORS -->
144
<refsect1 id="errors"><title>Errors</title>
146
Returns a valid non-zero sampler object and <varname>errcode_ret</varname> is set to
147
<errorname>CL_SUCCESS</errorname> if the sampler object is created successfully.
148
Otherwise, it returns a NULL value with one of the following error values returned in
149
<varname>errcode_ret</varname>:
152
<itemizedlist mark="disc">
154
<errorname>CL_INVALID_CONTEXT</errorname> if <varname>context</varname>
155
is not a valid context.
159
<errorname>CL_INVALID_VALUE</errorname> if <varname>addressing_mode</varname>,
160
<varname>filter_mode</varname>, or <varname>normalized_coords</varname> or a
161
combination of these argument values are not valid.
165
<errorname>CL_INVALID_OPERATION</errorname> if images are not
166
supported by any device associated with <varname>context</varname>
167
(i.e. <errorname>CL_DEVICE_IMAGE_SUPPORT</errorname>
168
specified in the table of OpenCL Device Queries for
169
<citerefentry><refentrytitle>clGetDeviceInfo</refentrytitle></citerefentry>
170
is <errorname>CL_FALSE</errorname>).
174
<errorname>CL_OUT_OF_RESOURCES</errorname> if there is a failure to allocate
175
resources required by the OpenCL implementation on the device.
179
<errorname>CL_OUT_OF_HOST_MEMORY</errorname> if there is a failure to allocate
180
resources required by the OpenCL implementation on the host.
185
<!-- ================================ EXAMPLE -->
186
<!-- DO NOT DELETE IN CASE AN EXAMPLE IS ADDED IN THE FUTURE -->
188
<refsect2 id="example1">
193
<informaltable frame="none">
194
<tgroup cols="1" align="left" colsep="0" rowsep="0">
195
<colspec colname="col1" colnum="1" />
199
Example goes here - it will be set in "code" type with white space preserved.
208
<!-- ================================ SPECIFICATION -->
209
<!-- Set the "uri" attribute in the <olink /> element to the "named destination" for the PDF page
211
<refsect1 id="specification"><title>Specification</title>
214
<imagedata fileref="pdficon_small1.gif" format="gif" />
217
<olink uri="clCreateSampler">OpenCL Specification</olink>
221
<!-- ================================ ALSO SEE -->
223
<refsect1 id="seealso"><title>Also see</title>
225
<citerefentry><refentrytitle>clRetainSampler</refentrytitle></citerefentry>,
226
<citerefentry><refentrytitle>clReleaseSampler</refentrytitle></citerefentry>,
227
<citerefentry><refentrytitle>clGetSamplerInfo</refentrytitle></citerefentry>,
228
<citerefentry href="classDiagram"><refentrytitle>Cardinality Diagram</refentrytitle></citerefentry>
229
<citerefentry><refentrytitle>sampler_t</refentrytitle></citerefentry>
233
<!-- ================================ COPYRIGHT -->
234
<!-- Content included from copyright.inc.xsl -->
236
<refsect3 id="Copyright"><title></title>
238
<imagedata fileref="KhronosLogo.jpg" format="jpg" />