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

Comparing OpenCL/OpenCL.pm (file contents):
Revision 1.80 by root, Sat May 5 13:55:59 2012 UTC vs.
Revision 1.84 by root, Sat May 5 16:44:02 2012 UTC

213 $ev->wait; 213 $ev->wait;
214 214
215=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
216set flight effect. 216set flight effect.
217 217
218This 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
219L<http://cvs.schmorp.de/OpenCL/examples/juliaflight>. 219from L<http://cvs.schmorp.de/OpenCL/examples/juliaflight>.
220 220
221 use OpenGL ":all"; 221 use OpenGL ":all";
222 use OpenCL; 222 use OpenCL;
223 223
224 my $S = $ARGV[0] || 256; # window/texture size, smaller is faster 224 my $S = $ARGV[0] || 256; # window/texture size, smaller is faster
398 398
399=head2 CONSTANTS 399=head2 CONSTANTS
400 400
401All C<CL_xxx> constants that this module supports are always available 401All C<CL_xxx> constants that this module supports are always available
402in the C<OpenCL> namespace as C<OpenCL::xxx> (i.e. without the C<CL_> 402in the C<OpenCL> namespace as C<OpenCL::xxx> (i.e. without the C<CL_>
403prefix). Constants which are not defined in the heaer files used during 403prefix). Constants which are not defined in the header files used during
404compilation, or otherwise are not available, will have the value C<-1>. 404compilation, or otherwise are not available, will have the value C<-1>.
405
406The latest version of this module knows and exports the constants
407listed in L<http://cvs.schmorp.de/OpenCL/constiv.h>.
405 408
406=head2 OPENCL 1.1 VS. OPENCL 1.2 409=head2 OPENCL 1.1 VS. OPENCL 1.2
407 410
408This module supports both OpenCL version 1.1 and 1.2, although the OpenCL 411This module supports both OpenCL version 1.1 and 1.2, although the OpenCL
4091.2 interface hasn't been tested much for lack of availability of an 4121.2 interface hasn't been tested much for lack of availability of an
413particular OpenCL function has a link to the its C manual page. 416particular OpenCL function has a link to the its C manual page.
414 417
415If the link contains a F<1.1>, then this function is an OpenCL 1.1 418If the link contains a F<1.1>, then this function is an OpenCL 1.1
416function. Most but not all also exist in OpenCL 1.2, and this module 419function. Most but not all also exist in OpenCL 1.2, and this module
417tries to emulate the missing ones for you, when told to do so at 420tries to emulate the missing ones for you, when told to do so at
418compiletime. You cna check whether a function was removed in OpenCL 1.2 by 421compiletime. You can check whether a function was removed in OpenCL 1.2 by
419replacing the F<1.1> component in the URL by F<1.2>. 422replacing the F<1.1> component in the URL by F<1.2>.
420 423
421If the link contains a F<1.2>, then this is a OpenCL 1.2-only 424If the link contains a F<1.2>, then this is a OpenCL 1.2-only
422function. Even if the module was compiled with OpenCL 1.2 header files 425function. Even if the module was compiled with OpenCL 1.2 header files
423and has an 1.2 OpenCL library, calling such a function on a platform that 426and has an 1.2 OpenCL library, calling such a function on a platform that
638The last error returned by a function - it's only valid after an error occured 641The last error returned by a function - it's only valid after an error occured
639and before calling another OpenCL function. 642and before calling another OpenCL function.
640 643
641=item $str = OpenCL::err2str [$errval] 644=item $str = OpenCL::err2str [$errval]
642 645
643Converts an error value into a human readable string. IF no error value is 646Converts an error value into a human readable string. If no error value is
644given, then the last error will be used (as returned by OpenCL::errno). 647given, then the last error will be used (as returned by OpenCL::errno).
648
649The latest version of this module knows the error constants
650listed in L<http://cvs.schmorp.de/OpenCL/errstr.h>.
645 651
646=item $str = OpenCL::enum2str $enum 652=item $str = OpenCL::enum2str $enum
647 653
648Converts most enum values (of parameter names, image format constants, 654Converts most enum values (of parameter names, image format constants,
649object types, addressing and filter modes, command types etc.) into a 655object types, addressing and filter modes, command types etc.) into a
650human readable string. When confronted with some random integer it can be 656human readable string. When confronted with some random integer it can be
651very helpful to pass it through this function to maybe get some readable 657very helpful to pass it through this function to maybe get some readable
652string out of it. 658string out of it.
659
660The latest version of this module knows the enumaration constants
661listed in L<http://cvs.schmorp.de/OpenCL/enumstr.h>.
653 662
654=item @platforms = OpenCL::platforms 663=item @platforms = OpenCL::platforms
655 664
656Returns all available OpenCL::Platform objects. 665Returns all available OpenCL::Platform objects.
657 666
1413 1422
1414=item $ev = $queue->copy_buffer ($src, $dst, $src_offset, $dst_offset, $len, $wait_events...) 1423=item $ev = $queue->copy_buffer ($src, $dst, $src_offset, $dst_offset, $len, $wait_events...)
1415 1424
1416L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyBuffer.html> 1425L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyBuffer.html>
1417 1426
1418=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...) 1427$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...)
1419 1428
1420http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueReadBufferRect.html 1429http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueReadBufferRect.html
1421 1430
1422=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...) 1431=item $ev = $queue->write_buffer_rect ($buf, $blocking, $buf_y, $host_x, $host_z, $height, $buf_row_pitch, $host_row_pitch, $data, $wait_events...)
1423 1432
1424http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteBufferRect.html 1433http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteBufferRect.html
1425 1434
1426=item $ev = $queue->copy_buffer_to_image ($src_buffer, $dst_image, $src_offset, $dst_x, $dst_y, $dst_z, $width, $height, $depth, $wait_events...) 1435=item $ev = $queue->copy_buffer_to_image ($src_buffer, $dst_image, $src_offset, $dst_x, $dst_y, $dst_z, $width, $height, $depth, $wait_events...)
1427 1436
1611it. You are not necessarily meant to do it this way, this example just 1620it. You are not necessarily meant to do it this way, this example just
1612shows you the accessors to use :) 1621shows you the accessors to use :)
1613 1622
1614 my $mapped = $queue->map_image ($image, 1, OpenCL::MAP_WRITE); 1623 my $mapped = $queue->map_image ($image, 1, OpenCL::MAP_WRITE);
1615 1624
1616 $mapped->set ($_ * $mapped->row_pitch, pack "C", 5) 1625 $mapped->write ($_ * $mapped->row_pitch, pack "C", 5)
1617 for 0..$image->height; 1626 for 0 .. $mapped->height - 1;
1618 1627
1619 $mapped->unmap;. 1628 $mapped->unmap;.
1620 $mapped->wait; # only needed for out of order queues normally 1629 $mapped->wait; # only needed for out of order queues normally
1621 1630
1622=item $ev = $queue->unmap ($mapped, $wait_events...) 1631=item $ev = $queue->unmap ($mapped, $wait_events...)
1641=item $packed_value = $memory->info ($name) 1650=item $packed_value = $memory->info ($name)
1642 1651
1643See C<< $platform->info >> for details. 1652See C<< $platform->info >> for details.
1644 1653
1645L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html> 1654L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html>
1655
1656=item $memory->destructor_callback ($cb->())
1657
1658Sets a callback that will be invoked after the memory object is destructed.
1659
1660L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clSetMemObjectDestructorCallback.html>
1646 1661
1647=for gengetinfo begin mem 1662=for gengetinfo begin mem
1648 1663
1649=item $mem_object_type = $mem->type 1664=item $mem_object_type = $mem->type
1650 1665
2328 2343
2329This is a subclass of OpenCL::Mapped, representing mapped images. 2344This is a subclass of OpenCL::Mapped, representing mapped images.
2330 2345
2331=over 4 2346=over 4
2332 2347
2348=item $pixels = $mapped->width
2349
2350=item $pixels = $mapped->height
2351
2352=item $pixels = $mapped->depth
2353
2354Return the width/height/depth of the mapped image region, in pixels.
2355
2333=item $bytes = $mapped->row_pitch 2356=item $bytes = $mapped->row_pitch
2334 2357
2335=item $bytes = $mapped->slice_pitch 2358=item $bytes = $mapped->slice_pitch
2336 2359
2337Return the row or slice pitch of the image that has been mapped. 2360Return the row or slice pitch of the image that has been mapped.
2338 2361
2362=item $bytes = $mapped->element_size
2363
2364Return the size of a single pixel.
2365
2366=item $data = $mapped->get_row ($count, $x=0, $y=0, $z=0)
2367
2368Return C<$count> pixels from the given coordinates. The pixel data must
2369be completely contained within a single row.
2370
2371If C<$count> is C<undef>, then all the remaining pixels in that row are
2372returned.
2373
2374=item $mapped->set_row ($data, $x=0, $y=0, $z=0)
2375
2376Write the given pixel data at the given coordinate. The pixel data must
2377be completely contained within a single row.
2378
2339=back 2379=back
2340
2341 2380
2342=cut 2381=cut
2343 2382
23441; 23831;
2345 2384

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines