ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/OpenCL/OpenCL.pm
(Generate patch)

Comparing OpenCL/OpenCL.pm (file contents):
Revision 1.77 by root, Sat May 5 12:54:03 2012 UTC vs.
Revision 1.88 by root, Tue Oct 22 17:25:38 2013 UTC

28specific device ("compiling and linking"), also binary programs. For each 28specific device ("compiling and linking"), also binary programs. For each
29kernel function in a program you can then create an OpenCL::Kernel object 29kernel function in a program you can then create an OpenCL::Kernel object
30which represents basically a function call with argument values. 30which represents basically a function call with argument values.
31 31
32OpenCL::Memory objects of various flavours: OpenCL::Buffer objects (flat 32OpenCL::Memory objects of various flavours: OpenCL::Buffer objects (flat
33memory areas, think arrays or structs) and OpenCL::Image objects (think 2d 33memory areas, think arrays or structs) and OpenCL::Image objects (think 2D
34or 3d array) for bulk data and input and output for kernels. 34or 3D array) for bulk data and input and output for kernels.
35 35
36OpenCL::Sampler objects, which are kind of like texture filter modes in 36OpenCL::Sampler objects, which are kind of like texture filter modes in
37OpenGL. 37OpenGL.
38 38
39OpenCL::Queue objects - command queues, which allow you to submit memory 39OpenCL::Queue objects - command queues, which allow you to submit memory
96initialised at creation time). 96initialised at creation time).
97 97
98Enqueue the kernel execution. 98Enqueue the kernel execution.
99 99
100Enqueue buffer reads for your output buffer to read results. 100Enqueue buffer reads for your output buffer to read results.
101
102=head1 OPENCL 1.1 VS. OPENCL 1.2
103
104This module supports both OpenCL version 1.1 and 1.2, although the OpenCL
1051.2 interface hasn't been tested much for lack of availability of an
106actual implementation.
107
108Every function or method in this manual page that interfaces to a
109particular OpenCL function has a link to the its C manual page.
110
111If the link contains a F<1.1>, then this function is an OpenCL 1.1
112function. Most but not all also exist in OpenCL 1.2, and this module
113tries to emulate the missing ones for you, when told to do so at
114compiletime. You cna check whether a function was removed in OpenCL 1.2 by
115replacing the F<1.1> component in the URL by F<1.2>.
116
117If the link contains a F<1.2>, then this is a OpenCL 1.2-only
118function. Even if the module was compiled with OpenCL 1.2 header files
119and has an 1.2 OpenCL library, calling such a function on a platform that
120doesn't implement 1.2 causes undefined behaviour, usually a crash (But
121this is not guaranteed).
122
123You can find out whether this module was compiled to prefer 1.1
124functionality by ooking at C<OpenCL::PREFER_1_1> - if it is true, then
1251.1 functions generally are implemented using 1.1 OpenCL functions. If it
126is false, then 1.1 functions missing from 1.2 are emulated by calling 1.2
127fucntions.
128
129This is a somewhat sorry state of affairs, but the Khronos group choose to
130make every release of OpenCL source and binary incompatible with previous
131releases.
132 101
133=head1 EXAMPLES 102=head1 EXAMPLES
134 103
135=head2 Enumerate all devices and get contexts for them. 104=head2 Enumerate all devices and get contexts for them.
136 105
244 $ev->wait; 213 $ev->wait;
245 214
246=head2 Use the OpenGL module to share a texture between OpenCL and OpenGL and draw some julia 215=head2 Use the OpenGL module to share a texture between OpenCL and OpenGL and draw some julia
247set flight effect. 216set flight effect.
248 217
249This is quite a long example to get you going - you can download it from 218This is quite a long example to get you going - you can also download it
250L<http://cvs.schmorp.de/OpenCL/examples/juliaflight>. 219from L<http://cvs.schmorp.de/OpenCL/examples/juliaflight>.
251 220
252 use OpenGL ":all"; 221 use OpenGL ":all";
253 use OpenCL; 222 use OpenCL;
254 223
255 my $S = $ARGV[0] || 256; # window/texture size, smaller is faster 224 my $S = $ARGV[0] || 256; # window/texture size, smaller is faster
263 # find and use the first opencl device that let's us get a shared opengl context 232 # find and use the first opencl device that let's us get a shared opengl context
264 my $platform; 233 my $platform;
265 my $dev; 234 my $dev;
266 my $ctx; 235 my $ctx;
267 236
237 sub get_context {
268 for (OpenCL::platforms) { 238 for (OpenCL::platforms) {
269 $platform = $_; 239 $platform = $_;
270 for ($platform->devices) { 240 for ($platform->devices) {
271 $dev = $_; 241 $dev = $_;
272 $ctx = $platform->context ([OpenCL::GLX_DISPLAY_KHR, undef, OpenCL::GL_CONTEXT_KHR, undef], [$dev]) 242 $ctx = eval { $platform->context ([OpenCL::GLX_DISPLAY_KHR, undef, OpenCL::GL_CONTEXT_KHR, undef], [$dev]) }
273 and last; 243 and return;
244 }
274 } 245 }
246
247 die "cannot find suitable OpenCL device\n";
275 } 248 }
276 249
277 $ctx 250 get_context;
278 or die "cannot find suitable OpenCL device\n";
279 251
280 my $queue = $ctx->queue ($dev); 252 my $queue = $ctx->queue ($dev);
281 253
282 # now attach an opencl image2d object to the opengl texture 254 # now attach an opencl image2d object to the opengl texture
283 my $tex = $ctx->gl_texture2d (OpenCL::MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, $texid); 255 my $tex = $ctx->gl_texture2d (OpenCL::MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, $texid);
419 391
420=item * When enqueuing commands, if the enqueue method is called in void 392=item * When enqueuing commands, if the enqueue method is called in void
421context, no event is created. In all other contexts an event is returned 393context, no event is created. In all other contexts an event is returned
422by the method. 394by the method.
423 395
424=item * This module expects all functions to return C<CL_SUCCESS>. If any 396=item * This module expects all functions to return C<OpenCL::SUCCESS>. If any
425other status is returned the function will throw an exception, so you 397other status is returned the function will throw an exception, so you
426don't normally have to to any error checking. 398don't normally have to to any error checking.
427 399
428=back 400=back
401
402=head2 CONSTANTS
403
404All C<CL_xxx> constants that this module supports are always available
405in the C<OpenCL> namespace as C<OpenCL::xxx> (i.e. without the C<CL_>
406prefix). Constants which are not defined in the header files used during
407compilation, or otherwise are not available, will have the value C<0> (in
408some cases, this will make them indistinguishable from real constants,
409sorry).
410
411The latest version of this module knows and exports the constants
412listed in L<http://cvs.schmorp.de/OpenCL/constiv.h>.
413
414=head2 OPENCL 1.1 VS. OPENCL 1.2
415
416This module supports both OpenCL version 1.1 and 1.2, although the OpenCL
4171.2 interface hasn't been tested much for lack of availability of an
418actual implementation.
419
420Every function or method in this manual page that interfaces to a
421particular OpenCL function has a link to the its C manual page.
422
423If the link contains a F<1.1>, then this function is an OpenCL 1.1
424function. Most but not all also exist in OpenCL 1.2, and this module
425tries to emulate the missing ones for you, when told to do so at
426compiletime. You can check whether a function was removed in OpenCL 1.2 by
427replacing the F<1.1> component in the URL by F<1.2>.
428
429If the link contains a F<1.2>, then this is a OpenCL 1.2-only
430function. Even if the module was compiled with OpenCL 1.2 header files
431and has an 1.2 OpenCL library, calling such a function on a platform that
432doesn't implement 1.2 causes undefined behaviour, usually a crash (But
433this is not guaranteed).
434
435You can find out whether this module was compiled to prefer 1.1
436functionality by ooking at C<OpenCL::PREFER_1_1> - if it is true, then
4371.1 functions generally are implemented using 1.1 OpenCL functions. If it
438is false, then 1.1 functions missing from 1.2 are emulated by calling 1.2
439fucntions.
440
441This is a somewhat sorry state of affairs, but the Khronos group choose to
442make every release of OpenCL source and binary incompatible with previous
443releases.
429 444
430=head2 PERL AND OPENCL TYPES 445=head2 PERL AND OPENCL TYPES
431 446
432This handy(?) table lists OpenCL types and their perl, PDL and pack/unpack 447This handy(?) table lists OpenCL types and their perl, PDL and pack/unpack
433format equivalents: 448format equivalents:
585use Async::Interrupt (); 600use Async::Interrupt ();
586 601
587our $POLL_FUNC; # set by XS 602our $POLL_FUNC; # set by XS
588 603
589BEGIN { 604BEGIN {
590 our $VERSION = '0.99'; 605 our $VERSION = '1.01';
591 606
592 require XSLoader; 607 require XSLoader;
593 XSLoader::load (__PACKAGE__, $VERSION); 608 XSLoader::load (__PACKAGE__, $VERSION);
594 609
595 @OpenCL::Platform::ISA = 610 @OpenCL::Platform::ISA =
631The last error returned by a function - it's only valid after an error occured 646The last error returned by a function - it's only valid after an error occured
632and before calling another OpenCL function. 647and before calling another OpenCL function.
633 648
634=item $str = OpenCL::err2str [$errval] 649=item $str = OpenCL::err2str [$errval]
635 650
636Converts an error value into a human readable string. IF no error value is 651Converts an error value into a human readable string. If no error value is
637given, then the last error will be used (as returned by OpenCL::errno). 652given, then the last error will be used (as returned by OpenCL::errno).
653
654The latest version of this module knows the error constants
655listed in L<http://cvs.schmorp.de/OpenCL/errstr.h>.
638 656
639=item $str = OpenCL::enum2str $enum 657=item $str = OpenCL::enum2str $enum
640 658
641Converts most enum values (of parameter names, image format constants, 659Converts most enum values (of parameter names, image format constants,
642object types, addressing and filter modes, command types etc.) into a 660object types, addressing and filter modes, command types etc.) into a
643human readable string. When confronted with some random integer it can be 661human readable string. When confronted with some random integer it can be
644very helpful to pass it through this function to maybe get some readable 662very helpful to pass it through this function to maybe get some readable
645string out of it. 663string out of it.
646 664
665The latest version of this module knows the enumaration constants
666listed in L<http://cvs.schmorp.de/OpenCL/enumstr.h>.
667
647=item @platforms = OpenCL::platforms 668=item @platforms = OpenCL::platforms
648 669
649Returns all available OpenCL::Platform objects. 670Returns all available OpenCL::Platform objects.
650 671
651L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetPlatformIDs.html> 672L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetPlatformIDs.html>
752L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html> 773L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html>
753 774
754=item $ctx = $platform->context ($properties, \@devices, $callback->($err, $pvt) = $print_stderr) 775=item $ctx = $platform->context ($properties, \@devices, $callback->($err, $pvt) = $print_stderr)
755 776
756Create a new OpenCL::Context object using the given device object(s)- a 777Create a new OpenCL::Context object using the given device object(s)- a
757CL_CONTEXT_PLATFORM property is supplied automatically. 778OpenCL::CONTEXT_PLATFORM property is supplied automatically.
758 779
759L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html> 780L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html>
760 781
761=item $packed_value = $platform->info ($name) 782=item $packed_value = $platform->info ($name)
762 783
807=over 4 828=over 4
808 829
809=item $packed_value = $device->info ($name) 830=item $packed_value = $device->info ($name)
810 831
811See C<< $platform->info >> for details. 832See C<< $platform->info >> for details.
833
834type: OpenCL::DEVICE_TYPE_DEFAULT, OpenCL::DEVICE_TYPE_CPU,
835OpenCL::DEVICE_TYPE_GPU, OpenCL::DEVICE_TYPE_ACCELERATOR,
836OpenCL::DEVICE_TYPE_CUSTOM, OpenCL::DEVICE_TYPE_ALL.
837
838fp_config: OpenCL::FP_DENORM, OpenCL::FP_INF_NAN, OpenCL::FP_ROUND_TO_NEAREST,
839OpenCL::FP_ROUND_TO_ZERO, OpenCL::FP_ROUND_TO_INF, OpenCL::FP_FMA,
840OpenCL::FP_SOFT_FLOAT, OpenCL::FP_CORRECTLY_ROUNDED_DIVIDE_SQRT.
841
842mem_cache_type: OpenCL::NONE, OpenCL::READ_ONLY_CACHE, OpenCL::READ_WRITE_CACHE.
843
844local_mem_type: OpenCL::LOCAL, OpenCL::GLOBAL.
845
846exec_capabilities: OpenCL::EXEC_KERNEL, OpenCL::EXEC_NATIVE_KERNEL.
847
848command_queue_properties: OpenCL::QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
849OpenCL::QUEUE_PROFILING_ENABLE.
850
851partition_properties: OpenCL::DEVICE_PARTITION_EQUALLY,
852OpenCL::DEVICE_PARTITION_BY_COUNTS, OpenCL::DEVICE_PARTITION_BY_COUNTS_LIST_END,
853OpenCL::DEVICE_PARTITION_BY_AFFINITY_DOMAIN.
854
855affinity_domain: OpenCL::DEVICE_AFFINITY_DOMAIN_NUMA,
856OpenCL::DEVICE_AFFINITY_DOMAIN_L4_CACHE, OpenCL::DEVICE_AFFINITY_DOMAIN_L3_CACHE,
857OpenCL::DEVICE_AFFINITY_DOMAIN_L2_CACHE, OpenCL::DEVICE_AFFINITY_DOMAIN_L1_CACHE,
858OpenCL::DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE.
812 859
813L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetDeviceInfo.html> 860L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetDeviceInfo.html>
814 861
815=item @devices = $device->sub_devices (\@properties) 862=item @devices = $device->sub_devices (\@properties)
816 863
1176OpenCL::MEM_USE_HOST_PTR, OpenCL::MEM_ALLOC_HOST_PTR, OpenCL::MEM_COPY_HOST_PTR, 1223OpenCL::MEM_USE_HOST_PTR, OpenCL::MEM_ALLOC_HOST_PTR, OpenCL::MEM_COPY_HOST_PTR,
1177OpenCL::MEM_HOST_WRITE_ONLY, OpenCL::MEM_HOST_READ_ONLY, OpenCL::MEM_HOST_NO_ACCESS. 1224OpenCL::MEM_HOST_WRITE_ONLY, OpenCL::MEM_HOST_READ_ONLY, OpenCL::MEM_HOST_NO_ACCESS.
1178 1225
1179L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateBuffer.html> 1226L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateBuffer.html>
1180 1227
1228A somewhat informative thread on the flags is:
1229
1230L<http://www.khronos.org/message_boards/viewtopic.php?f=28&t=2440>
1231
1181=item $buf = $ctx->buffer_sv ($flags, $data) 1232=item $buf = $ctx->buffer_sv ($flags, $data)
1182 1233
1183Creates a new OpenCL::Buffer (actually OpenCL::BufferObj) object and 1234Creates a new OpenCL::Buffer (actually OpenCL::BufferObj) object and
1184initialise it with the given data values. 1235initialise it with the given data values.
1185 1236
1195channel_type: OpenCL::SNORM_INT8, OpenCL::SNORM_INT16, OpenCL::UNORM_INT8, 1246channel_type: OpenCL::SNORM_INT8, OpenCL::SNORM_INT16, OpenCL::UNORM_INT8,
1196OpenCL::UNORM_INT16, OpenCL::UNORM_SHORT_565, OpenCL::UNORM_SHORT_555, 1247OpenCL::UNORM_INT16, OpenCL::UNORM_SHORT_565, OpenCL::UNORM_SHORT_555,
1197OpenCL::UNORM_INT_101010, OpenCL::SIGNED_INT8, OpenCL::SIGNED_INT16, 1248OpenCL::UNORM_INT_101010, OpenCL::SIGNED_INT8, OpenCL::SIGNED_INT16,
1198OpenCL::SIGNED_INT32, OpenCL::UNSIGNED_INT8, OpenCL::UNSIGNED_INT16, 1249OpenCL::SIGNED_INT32, OpenCL::UNSIGNED_INT8, OpenCL::UNSIGNED_INT16,
1199OpenCL::UNSIGNED_INT32, OpenCL::HALF_FLOAT, OpenCL::FLOAT. 1250OpenCL::UNSIGNED_INT32, OpenCL::HALF_FLOAT, OpenCL::FLOAT.
1200
1201 1251
1202type: OpenCL::MEM_OBJECT_BUFFER, OpenCL::MEM_OBJECT_IMAGE2D, 1252type: OpenCL::MEM_OBJECT_BUFFER, OpenCL::MEM_OBJECT_IMAGE2D,
1203OpenCL::MEM_OBJECT_IMAGE3D, OpenCL::MEM_OBJECT_IMAGE2D_ARRAY, 1253OpenCL::MEM_OBJECT_IMAGE3D, OpenCL::MEM_OBJECT_IMAGE2D_ARRAY,
1204OpenCL::MEM_OBJECT_IMAGE1D, OpenCL::MEM_OBJECT_IMAGE1D_ARRAY, 1254OpenCL::MEM_OBJECT_IMAGE1D, OpenCL::MEM_OBJECT_IMAGE1D_ARRAY,
1205OpenCL::MEM_OBJECT_IMAGE1D_BUFFER. 1255OpenCL::MEM_OBJECT_IMAGE1D_BUFFER.
1381 1431
1382=item $ev = $queue->copy_buffer ($src, $dst, $src_offset, $dst_offset, $len, $wait_events...) 1432=item $ev = $queue->copy_buffer ($src, $dst, $src_offset, $dst_offset, $len, $wait_events...)
1383 1433
1384L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyBuffer.html> 1434L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyBuffer.html>
1385 1435
1386=item $ev = $queue->read_buffer_rect (OpenCL::Memory buf, cl_bool blocking, $buf_x, $buf_y, $buf_z, $host_x, $host_y, $host_z, $width, $height, $depth, $buf_row_pitch, $buf_slice_pitch, $host_row_pitch, $host_slice_pitch, $data, $wait_events...) 1436$eue->read_buffer_rect ($buf, cl_bool blocking, $buf_x, $buf_y, $buf_z, $host_x, $host_y, $host_z, $width, $height, $depth, $buf_row_pitch, $buf_slice_pitch, $host_row_pitch, $host_slice_pitch, $data, $wait_events...)
1387 1437
1388http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueReadBufferRect.html 1438http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueReadBufferRect.html
1389 1439
1390=item $ev = $queue->write_buffer_rect (OpenCL::Memory buf, cl_bool blocking, $buf_x, $buf_y, $buf_z, $host_x, $host_y, $host_z, $width, $height, $depth, $buf_row_pitch, $buf_slice_pitch, $host_row_pitch, $host_slice_pitch, $data, $wait_events...) 1440=item $ev = $queue->write_buffer_rect ($buf, $blocking, $buf_y, $host_x, $host_z, $height, $buf_row_pitch, $host_row_pitch, $data, $wait_events...)
1391 1441
1392http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteBufferRect.html 1442http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteBufferRect.html
1393 1443
1394=item $ev = $queue->copy_buffer_to_image ($src_buffer, $dst_image, $src_offset, $dst_x, $dst_y, $dst_z, $width, $height, $depth, $wait_events...) 1444=item $ev = $queue->copy_buffer_to_image ($src_buffer, $dst_image, $src_offset, $dst_x, $dst_y, $dst_z, $width, $height, $depth, $wait_events...)
1395 1445
1579it. You are not necessarily meant to do it this way, this example just 1629it. You are not necessarily meant to do it this way, this example just
1580shows you the accessors to use :) 1630shows you the accessors to use :)
1581 1631
1582 my $mapped = $queue->map_image ($image, 1, OpenCL::MAP_WRITE); 1632 my $mapped = $queue->map_image ($image, 1, OpenCL::MAP_WRITE);
1583 1633
1584 $mapped->set ($_ * $mapped->row_pitch, pack "C", 5) 1634 $mapped->write ($_ * $mapped->row_pitch, pack "C", 5)
1585 for 0..$image->height; 1635 for 0 .. $mapped->height - 1;
1586 1636
1587 $mapped->unmap;. 1637 $mapped->unmap;.
1588 $mapped->wait; # only needed for out of order queues normally 1638 $mapped->wait; # only needed for out of order queues normally
1589 1639
1590=item $ev = $queue->unmap ($mapped, $wait_events...) 1640=item $ev = $queue->unmap ($mapped, $wait_events...)
1610 1660
1611See C<< $platform->info >> for details. 1661See C<< $platform->info >> for details.
1612 1662
1613L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html> 1663L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html>
1614 1664
1665=item $memory->destructor_callback ($cb->())
1666
1667Sets a callback that will be invoked after the memory object is destructed.
1668
1669L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clSetMemObjectDestructorCallback.html>
1670
1615=for gengetinfo begin mem 1671=for gengetinfo begin mem
1616 1672
1617=item $mem_object_type = $mem->type 1673=item $mem_object_type = $mem->type
1618 1674
1619Calls C<clGetMemObjectInfo> with C<OpenCL::MEM_TYPE> and returns the result. 1675Calls C<clGetMemObjectInfo> with C<OpenCL::MEM_TYPE> and returns the result.
1676=over 4 1732=over 4
1677 1733
1678=item $subbuf = $buf_obj->sub_buffer_region ($flags, $origin, $size) 1734=item $subbuf = $buf_obj->sub_buffer_region ($flags, $origin, $size)
1679 1735
1680Creates an OpenCL::Buffer objects from this buffer and returns it. The 1736Creates an OpenCL::Buffer objects from this buffer and returns it. The
1681C<buffer_create_type> is assumed to be C<CL_BUFFER_CREATE_TYPE_REGION>. 1737C<buffer_create_type> is assumed to be C<OpenCL::BUFFER_CREATE_TYPE_REGION>.
1682 1738
1683L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateSubBuffer.html> 1739L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateSubBuffer.html>
1684 1740
1685=back 1741=back
1686 1742
1702L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetImageInfo.html> 1758L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetImageInfo.html>
1703 1759
1704=item ($channel_order, $channel_data_type) = $image->format 1760=item ($channel_order, $channel_data_type) = $image->format
1705 1761
1706Returns the channel order and type used to create the image by calling 1762Returns the channel order and type used to create the image by calling
1707C<clGetImageInfo> with C<CL_IMAGE_FORMAT>. 1763C<clGetImageInfo> with C<OpenCL::IMAGE_FORMAT>.
1708 1764
1709=for gengetinfo begin image 1765=for gengetinfo begin image
1710 1766
1711=item $int = $image->element_size 1767=item $int = $image->element_size
1712 1768
1835=item $packed_value = $program->build_info ($device, $name) 1891=item $packed_value = $program->build_info ($device, $name)
1836 1892
1837Similar to C<< $platform->info >>, but returns build info for a previous 1893Similar to C<< $platform->info >>, but returns build info for a previous
1838build attempt for the given device. 1894build attempt for the given device.
1839 1895
1896binary_type: OpenCL::PROGRAM_BINARY_TYPE_NONE,
1897OpenCL::PROGRAM_BINARY_TYPE_COMPILED_OBJECT,
1898OpenCL::PROGRAM_BINARY_TYPE_LIBRARY,
1899OpenCL::PROGRAM_BINARY_TYPE_EXECUTABLE.
1900
1840L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetBuildInfo.html> 1901L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetBuildInfo.html>
1841 1902
1842=item $kernel = $program->kernel ($function_name) 1903=item $kernel = $program->kernel ($function_name)
1843 1904
1844Creates an OpenCL::Kernel object out of the named C<__kernel> function in 1905Creates an OpenCL::Kernel object out of the named C<__kernel> function in
1863Calls C<clGetProgramBuildInfo> with C<OpenCL::PROGRAM_BUILD_OPTIONS> and returns the result. 1924Calls C<clGetProgramBuildInfo> with C<OpenCL::PROGRAM_BUILD_OPTIONS> and returns the result.
1864 1925
1865=item $string = $program->build_log ($device) 1926=item $string = $program->build_log ($device)
1866 1927
1867Calls C<clGetProgramBuildInfo> with C<OpenCL::PROGRAM_BUILD_LOG> and returns the result. 1928Calls C<clGetProgramBuildInfo> with C<OpenCL::PROGRAM_BUILD_LOG> and returns the result.
1929
1930=item $binary_type = $program->binary_type ($device)
1931
1932Calls C<clGetProgramBuildInfo> with C<OpenCL::PROGRAM_BINARY_TYPE> and returns the result.
1868 1933
1869=for gengetinfo end program_build 1934=for gengetinfo end program_build
1870 1935
1871=item $packed_value = $program->info ($name) 1936=item $packed_value = $program->info ($name)
1872 1937
2287 2352
2288This is a subclass of OpenCL::Mapped, representing mapped images. 2353This is a subclass of OpenCL::Mapped, representing mapped images.
2289 2354
2290=over 4 2355=over 4
2291 2356
2357=item $pixels = $mapped->width
2358
2359=item $pixels = $mapped->height
2360
2361=item $pixels = $mapped->depth
2362
2363Return the width/height/depth of the mapped image region, in pixels.
2364
2292=item $bytes = $mapped->row_pitch 2365=item $bytes = $mapped->row_pitch
2293 2366
2294=item $bytes = $mapped->slice_pitch 2367=item $bytes = $mapped->slice_pitch
2295 2368
2296Return the row or slice pitch of the image that has been mapped. 2369Return the row or slice pitch of the image that has been mapped.
2297 2370
2371=item $bytes = $mapped->element_size
2372
2373Return the size of a single pixel.
2374
2375=item $data = $mapped->get_row ($count, $x=0, $y=0, $z=0)
2376
2377Return C<$count> pixels from the given coordinates. The pixel data must
2378be completely contained within a single row.
2379
2380If C<$count> is C<undef>, then all the remaining pixels in that row are
2381returned.
2382
2383=item $mapped->set_row ($data, $x=0, $y=0, $z=0)
2384
2385Write the given pixel data at the given coordinate. The pixel data must
2386be completely contained within a single row.
2387
2298=back 2388=back
2299
2300 2389
2301=cut 2390=cut
2302 2391
23031; 23921;
2304 2393

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines