go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkOpenCLBuffer.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18/*=========================================================================
19 *
20 * Copyright UMC Utrecht and contributors
21 *
22 * Licensed under the Apache License, Version 2.0 (the "License");
23 * you may not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
25 *
26 * http://www.apache.org/licenses/LICENSE-2.0.txt
27 *
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
33 *
34 *=========================================================================*/
35#ifndef itkOpenCLBuffer_h
36#define itkOpenCLBuffer_h
37
39#include "itkOpenCLEvent.h"
40
41namespace itk
42{
50// Forward declaration
51class OpenCLImage;
52
54{
55public:
58
60 OpenCLBuffer() = default;
61
66 OpenCLBuffer(OpenCLContext * context, const cl_mem id);
67
69 OpenCLBuffer(const OpenCLBuffer & other);
70
73 operator=(const OpenCLBuffer & other);
74
80 bool
81 Read(void * data, const std::size_t size, const std::size_t offset = 0);
82
90 ReadAsync(void * data,
91 const std::size_t size,
92 const OpenCLEventList & event_list = OpenCLEventList(),
93 const std::size_t offset = 0);
94
101 bool
102 Write(const void * data, const std::size_t size, const std::size_t offset = 0);
103
111 WriteAsync(const void * data,
112 const std::size_t size,
113 const OpenCLEventList & event_list = OpenCLEventList(),
114 const std::size_t offset = 0);
115
123 bool
124 ReadRect(void * data,
125 const RectangleType & rect,
126 const std::size_t bufferBytesPerLine,
127 const std::size_t hostBytesPerLine);
128
136 ReadRectAsync(void * data,
137 const RectangleType & rect,
138 const std::size_t bufferBytesPerLine,
139 const std::size_t hostBytesPerLine,
140 const OpenCLEventList & event_list = OpenCLEventList());
141
150 bool
151 ReadRect(void * data,
152 const std::size_t origin[3],
153 const std::size_t size[3],
154 const std::size_t bufferBytesPerLine,
155 const std::size_t bufferBytesPerSlice,
156 const std::size_t hostBytesPerLine,
157 const std::size_t hostBytesPerSlice);
158
166 ReadRectAsync(void * data,
167 const std::size_t origin[3],
168 const std::size_t size[3],
169 const std::size_t bufferBytesPerLine,
170 const std::size_t bufferBytesPerSlice,
171 const std::size_t hostBytesPerLine,
172 const std::size_t hostBytesPerSlice,
173 const OpenCLEventList & event_list = OpenCLEventList());
174
181 bool
182 WriteRect(const void * data,
183 const RectangleType & rect,
184 const std::size_t bufferBytesPerLine,
185 const std::size_t hostBytesPerLine);
186
194 WriteRectAsync(const void * data,
195 const RectangleType & rect,
196 const std::size_t bufferBytesPerLine,
197 const std::size_t hostBytesPerLine,
198 const OpenCLEventList & event_list = OpenCLEventList());
199
207 bool
208 WriteRect(const void * data,
209 const std::size_t origin[3],
210 const std::size_t size[3],
211 const std::size_t bufferBytesPerLine,
212 const std::size_t bufferBytesPerSlice,
213 const std::size_t hostBytesPerLine,
214 const std::size_t hostBytesPerSlice);
215
223 WriteRectAsync(const void * data,
224 const std::size_t origin[3],
225 const std::size_t size[3],
226 const std::size_t bufferBytesPerLine,
227 const std::size_t bufferBytesPerSlice,
228 const std::size_t hostBytesPerLine,
229 const std::size_t hostBytesPerSlice,
230 const OpenCLEventList & event_list = OpenCLEventList());
231
238 bool
240 const std::size_t size,
241 const std::size_t dst_offset = 0,
242 const std::size_t offset = 0);
243
252 const std::size_t size,
253 const OpenCLEventList & event_list = OpenCLEventList(),
254 const std::size_t dst_offset = 0,
255 const std::size_t offset = 0);
256
262 bool
264 const OpenCLSize & origin,
265 const OpenCLSize & region,
266 const std::size_t src_offset = 0);
267
276 const OpenCLSize & origin,
277 const OpenCLSize & region,
278 const OpenCLEventList & event_list = OpenCLEventList(),
279 const std::size_t src_offset = 0);
280
288 bool
290 const RectangleType & rect,
291 const PointType & destPoint,
292 const std::size_t bufferBytesPerLine,
293 std::size_t destBytesPerLine);
294
303 const RectangleType & rect,
304 const PointType & destPoint,
305 const std::size_t bufferBytesPerLine,
306 const std::size_t destBytesPerLine,
307 const OpenCLEventList & event_list = OpenCLEventList());
308
317 bool
319 const std::size_t origin[3],
320 const std::size_t size[3],
321 const std::size_t destOrigin[3],
322 const std::size_t bufferBytesPerLine,
323 const std::size_t bufferBytesPerSlice,
324 const std::size_t destBytesPerLine,
325 const std::size_t destBytesPerSlice);
326
335 const std::size_t origin[3],
336 const std::size_t size[3],
337 const std::size_t destOrigin[3],
338 const std::size_t bufferBytesPerLine,
339 const std::size_t bufferBytesPerSlice,
340 const std::size_t destBytesPerLine,
341 const std::size_t destBytesPerSlice,
342 const OpenCLEventList & event_list = OpenCLEventList());
343
350 void *
351 Map(const OpenCLMemoryObject::Access access, const std::size_t size, const std::size_t offset = 0);
352
360 MapAsync(void ** ptr,
361 const OpenCLMemoryObject::Access access,
362 const std::size_t size,
363 const OpenCLEventList & event_list = OpenCLEventList(),
364 const std::size_t offset = 0);
365
369 void *
371
378 CreateSubBuffer(const OpenCLMemoryObject::Access access, const std::size_t size, const std::size_t offset = 0);
379
384
388 std::size_t
389 GetOffset() const;
390};
391
392} // end namespace itk
393
394#endif /* itkOpenCLBuffer_h */
The OpenCLBuffer class represents an OpenCL buffer object.
bool CopyToImage(const OpenCLImage &dest, const OpenCLSize &origin, const OpenCLSize &region, const std::vcl_size_t src_offset=0)
OpenCLBuffer CreateSubBuffer(const OpenCLMemoryObject::Access access, const std::vcl_size_t size, const std::vcl_size_t offset=0)
bool CopyToBuffer(const OpenCLBuffer &dest, const std::vcl_size_t size, const std::vcl_size_t dst_offset=0, const std::vcl_size_t offset=0)
OpenCLEvent MapAsync(void **ptr, const OpenCLMemoryObject::Access access, const std::vcl_size_t size, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t offset=0)
bool CopyToRect(const OpenCLBuffer &dest, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t destOrigin[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t destBytesPerLine, const std::vcl_size_t destBytesPerSlice)
OpenCLEvent WriteAsync(const void *data, const std::vcl_size_t size, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t offset=0)
void * Map(const OpenCLMemoryObject::Access access, const std::vcl_size_t size, const std::vcl_size_t offset=0)
OpenCLEvent CopyToImageAsync(const OpenCLImage &dest, const OpenCLSize &origin, const OpenCLSize &region, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t src_offset=0)
OpenCLEvent WriteRectAsync(const void *data, const RectangleType &rect, const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t hostBytesPerLine, const OpenCLEventList &event_list=OpenCLEventList())
bool Read(void *data, const std::vcl_size_t size, const std::vcl_size_t offset=0)
bool ReadRect(void *data, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t hostBytesPerLine, const std::vcl_size_t hostBytesPerSlice)
void * Map(const OpenCLMemoryObject::Access access)
OpenCLEvent ReadAsync(void *data, const std::vcl_size_t size, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t offset=0)
std::vcl_size_t GetOffset() const
OpenCLEvent WriteRectAsync(const void *data, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t hostBytesPerLine, const std::vcl_size_t hostBytesPerSlice, const OpenCLEventList &event_list=OpenCLEventList())
bool ReadRect(void *data, const RectangleType &rect, const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t hostBytesPerLine)
OpenCLBuffer()=default
OpenCLEvent CopyToRectAsync(const OpenCLBuffer &dest, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t destOrigin[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t destBytesPerLine, const std::vcl_size_t destBytesPerSlice, const OpenCLEventList &event_list=OpenCLEventList())
OpenCLEvent CopyToRectAsync(const OpenCLBuffer &dest, const RectangleType &rect, const PointType &destPoint, const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t destBytesPerLine, const OpenCLEventList &event_list=OpenCLEventList())
OpenCLEvent ReadRectAsync(void *data, const RectangleType &rect, const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t hostBytesPerLine, const OpenCLEventList &event_list=OpenCLEventList())
bool Write(const void *data, const std::vcl_size_t size, const std::vcl_size_t offset=0)
OpenCLBuffer & operator=(const OpenCLBuffer &other)
OpenCLBuffer(const OpenCLBuffer &other)
OpenCLEvent ReadRectAsync(void *data, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t hostBytesPerLine, const std::vcl_size_t hostBytesPerSlice, const OpenCLEventList &event_list=OpenCLEventList())
bool WriteRect(const void *data, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t hostBytesPerLine, const std::vcl_size_t hostBytesPerSlice)
OpenCLEvent CopyToBufferAsync(const OpenCLBuffer &dest, const std::vcl_size_t size, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t dst_offset=0, const std::vcl_size_t offset=0)
OpenCLBuffer(OpenCLContext *context, const cl_mem id)
bool WriteRect(const void *data, const RectangleType &rect, const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t hostBytesPerLine)
bool CopyToRect(const OpenCLBuffer &dest, const RectangleType &rect, const PointType &destPoint, const std::vcl_size_t bufferBytesPerLine, std::vcl_size_t destBytesPerLine)
OpenCLBuffer GetParentBuffer() const
The OpenCLContext class represents an OpenCL context.
OpenCLEventList class represents a list of OpenCLEvent objects.
OpenCLEvent class represents an OpenCL event object.
The OpenCLImage class represents an image object is used to store a one, two or three dimensional tex...
The OpenCLMemoryObject class represents all common memory objects such as buffers and image objects.
Point< std::vcl_size_t, 2 > PointType
The OpenCLSize class defines the size of an item of work for an OpenCL kernel.
Definition: itkOpenCLSize.h:50
#define ITKOpenCL_EXPORT


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo