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>clEnqueueFillBuffer</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="clEnqueueFillBuffer">
42
Enqueues a command to fill a buffer object with a pattern of a given pattern size.
46
<refsynopsisdiv xmlns:xlink="http://www.w3.org/1999/xlink"><title></title>
50
<link xlink:href="scalarDataTypes.html">cl_int</link>
51
<function>clEnqueueFillBuffer</function>
54
<link xlink:href="abstractDataTypes.html">cl_command_queue</link>
55
<parameter>command_queue</parameter>
58
<link xlink:href="abstractDataTypes.html">cl_mem</link>
59
<parameter>buffer</parameter>
62
<link xlink:href="scalarDataTypes.html">void</link>
63
<parameter>*pattern</parameter>
66
<link xlink:href="scalarDataTypes.html">size_t</link>
67
<parameter>pattern_size</parameter>
70
<link xlink:href="scalarDataTypes.html">size_t</link>
71
<parameter>offset</parameter>
74
<link xlink:href="scalarDataTypes.html">size_t</link>
75
<parameter>size</parameter>
78
<link xlink:href="scalarDataTypes.html">cl_uint</link>
79
<parameter>num_events_in_wait_list</parameter>
82
<link xlink:href="abstractDataTypes.html">cl_event</link>
83
<parameter>*event_wait_list</parameter>
86
<link xlink:href="abstractDataTypes.html">cl_event</link>
87
<parameter>*event</parameter>
94
<!-- ================================ PARAMETERS -->
96
<refsect1 id="parameters">
97
<title>Parameters</title>
100
<term> <varname> command_queue </varname> </term>
103
Refers to the command-queue in which the fill command will be queued.
104
The OpenCL context associated with <varname>command_queue</varname>
105
and <varname>buffer</varname> must be the same.
111
<term> <varname> buffer </varname> </term>
114
A valid buffer object.
120
<term> <varname> pattern </varname> </term>
123
A pointer to the data pattern of size <varname>pattern_size</varname>
124
in bytes. <varname>pattern</varname> will be used to fill a region
125
in <varname>buffer</varname> starting at <varname>offset</varname>
126
and is <varname>size</varname> bytes in size. The data pattern
127
must be a scalar or vector integer or floating-point data type. For
128
example, if <varname>buffer</varname> is to be filled with a pattern of
129
<type>float4</type> values, then <varname>pattern</varname> will be a pointer
130
to a <type>cl_float4</type> value and <varname>pattern_size</varname>
131
will be <code>sizeof(cl_float4)</code>. The maximum value of
132
<varname>pattern_size</varname> is the size of the largest integer
133
or floating-point vector data type supported by the OpenCL device.
134
The memory associated with <varname>pattern</varname> can be reused or
135
freed after the function returns.
141
<term> <varname> offset </varname> </term>
144
The location in bytes of the region being filled in <varname>buffer</varname>
145
and must be a multiple of <varname>pattern_size</varname>.
151
<term> <varname> size </varname> </term>
154
The size in bytes of region being filled in <varname>buffer</varname>
155
and must be a multiple of <varname>pattern_size</varname>.
166
num_events_in_wait_list
172
Specify events that need to complete before this particular
173
command can be executed. If <varname>event_wait_list</varname>
174
is NULL, then this particular command does not wait on any
175
event to complete. If <varname>event_wait_list</varname> is
176
NULL, <varname>num_events_in_wait_list</varname> must be 0. If
177
<varname>event_wait_list</varname> is not NULL, the list of events
178
pointed to by <varname>event_wait_list</varname> must be valid
179
and <varname>num_events_in_wait_list</varname> must be greater
180
than 0. The events specified in <varname>event_wait_list</varname>
181
act as synchronization points. The context associated with events in
182
<varname>event_wait_list</varname> and <varname>command_queue</varname> must
183
be the same. The memory associated with <varname>event_wait_list</varname>
184
can be reused or freed after the function returns.
190
<term> <varname> event </varname> </term>
193
Returns an event object that identifies this particular write
194
command and can be used to query or queue a wait for this particular
195
command to complete. <varname>event</varname> can be NULL in
196
which case it will not be possible for the application to query the
197
status of this command or queue a wait for this command to complete.
198
<citerefentry><refentrytitle>clEnqueueBarrierWithWaitList</refentrytitle></citerefentry>
199
can be used instead. If the <varname>event_wait_list</varname>
200
and the <varname>event</varname> arguments are not NULL, the
201
<varname>event</varname> argument should not refer to an element of the
202
<varname>event_wait_list</varname> array.
209
<!-- ================================ NOTES -->
211
<refsect1 id="notes"><title>Notes</title>
213
Enqueues a command to fill a buffer object with a pattern of a given pattern size. The
214
usage information which indicates whether the memory object can be read or written by
215
a kernel and/or the host and is given by the <type>cl_mem_flags</type> argument value
216
specified when buffer is created is ignored by <function>clEnqueueFillBuffer</function>.
220
<!-- ================================ ERRORS -->
222
<refsect1 id="errors"><title>Errors</title>
224
<function>clEnqueueFillBuffer</function> returns <errorname>CL_SUCCESS</errorname> if
225
the function is executed successfully. Otherwise, it returns one of the following errors.
228
<itemizedlist mark="disc">
230
<errorname>CL_INVALID_COMMAND_QUEUE</errorname> if <varname>command_queue</varname>
231
is not a valid command-queue.
235
<errorname>CL_INVALID_CONTEXT</errorname> if the context associated with
236
<varname>command_queue</varname> and <varname>buffer</varname> are not the same
237
or if the context associated with <varname>command_queue</varname> and events in
238
<varname>event_wait_list</varname> are not the same.
242
<errorname>CL_INVALID_MEM_OBJECT</errorname> if <varname>buffer</varname> is not
243
a valid buffer object.
247
<errorname>CL_INVALID_VALUE</errorname> if <varname>offset</varname> or
248
<varname>offset</varname> + <varname>size</varname> require accessing elements
249
outside the <varname>buffer</varname> buffer object respectively.
253
<errorname>CL_INVALID_VALUE</errorname> if <varname>pattern</varname> is NULL
254
or if <varname>pattern_size</varname> is 0 or if <varname>pattern_size</varname>
255
is not one of {1, 2, 4, 8, 16, 32, 64, 128}.
259
<errorname>CL_INVALID_VALUE</errorname> if <varname>offset</varname> and
260
<varname>size</varname> are not a multiple of <varname>pattern_size</varname>.
264
<errorname>CL_INVALID_EVENT_WAIT_LIST</errorname>
265
if <varname>event_wait_list</varname> is NULL and
266
<varname>num_events_in_wait_list</varname> > 0,
267
or <varname>event_wait_list</varname> is not NULL and
268
<varname>num_events_in_wait_list</varname> is 0, or if event objects in
269
<varname>event_wait_list</varname> are not valid events.
273
<errorname>CL_MISALIGNED_SUB_BUFFER_OFFSET</errorname> if <varname>buffer</varname>
274
is a sub-buffer object and offset specified when the sub-buffer object is created
275
is not aligned to <constant>CL_DEVICE_MEM_BASE_ADDR_ALIGN</constant> value for
276
device associated with <varname>queue</varname>.
280
<errorname>CL_MEM_OBJECT_ALLOCATION_FAILURE</errorname> if there is a failure to
281
allocate memory for data store associated with <varname>buffer</varname>.
285
<errorname>CL_OUT_OF_RESOURCES</errorname> if there is a failure to allocate
286
resources required by the OpenCL implementation on the device.
290
<errorname>CL_OUT_OF_HOST_MEMORY</errorname> if there is a failure to allocate
291
resources required by the OpenCL implementation on the host.
296
<!-- ================================ EXAMPLE -->
297
<!-- DO NOT DELETE IN CASE AN EXAMPLE IS ADDED IN THE FUTURE -->
299
<refsect2 id="example1">
304
<informaltable frame="none">
305
<tgroup cols="1" align="left" colsep="0" rowsep="0">
306
<colspec colname="col1" colnum="1" />
310
Example goes here - it will be set in "code" type with white space preserved.
319
<!-- ================================ SPECIFICATION -->
320
<!-- Set the "uri" attribute in the <olink /> element to the "named destination" for the PDF page
322
<refsect1 id="specification"><title>Specification</title>
325
<imagedata fileref="pdficon_small1.gif" format="gif" />
328
<olink uri="clEnqueueFillBuffer">OpenCL Specification</olink>
332
<!-- ================================ ALSO SEE -->
334
<refsect1 id="seealso"><title>Also see</title>
336
<citerefentry><refentrytitle>clEnqueueBarrierWithWaitList</refentrytitle></citerefentry>
340
<!-- ================================ COPYRIGHT -->
341
<!-- Content included from copyright.inc.xsl -->
343
<refsect3 id="Copyright"><title></title>
345
<imagedata fileref="KhronosLogo.jpg" format="jpg" />