… | |
… | |
399 | =head2 CONSTANTS |
399 | =head2 CONSTANTS |
400 | |
400 | |
401 | All C<CL_xxx> constants that this module supports are always available |
401 | All C<CL_xxx> constants that this module supports are always available |
402 | in the C<OpenCL> namespace as C<OpenCL::xxx> (i.e. without the C<CL_> |
402 | in the C<OpenCL> namespace as C<OpenCL::xxx> (i.e. without the C<CL_> |
403 | prefix). Constants which are not defined in the header files used during |
403 | prefix). Constants which are not defined in the header files used during |
404 | compilation, or otherwise are not available, will have the value C<-1>. |
404 | compilation, or otherwise are not available, will have the value C<0> (in |
|
|
405 | some cases, this will make them indistinguishable from real constants, |
|
|
406 | sorry). |
405 | |
407 | |
406 | The latest version of this module knows and exports the constants |
408 | The latest version of this module knows and exports the constants |
407 | listed in L<http://cvs.schmorp.de/OpenCL/constiv.h>. |
409 | listed in L<http://cvs.schmorp.de/OpenCL/constiv.h>. |
408 | |
410 | |
409 | =head2 OPENCL 1.1 VS. OPENCL 1.2 |
411 | =head2 OPENCL 1.1 VS. OPENCL 1.2 |
… | |
… | |
595 | use Async::Interrupt (); |
597 | use Async::Interrupt (); |
596 | |
598 | |
597 | our $POLL_FUNC; # set by XS |
599 | our $POLL_FUNC; # set by XS |
598 | |
600 | |
599 | BEGIN { |
601 | BEGIN { |
600 | our $VERSION = '0.99'; |
602 | our $VERSION = '1.0'; |
601 | |
603 | |
602 | require XSLoader; |
604 | require XSLoader; |
603 | XSLoader::load (__PACKAGE__, $VERSION); |
605 | XSLoader::load (__PACKAGE__, $VERSION); |
604 | |
606 | |
605 | @OpenCL::Platform::ISA = |
607 | @OpenCL::Platform::ISA = |
… | |
… | |
1422 | |
1424 | |
1423 | =item $ev = $queue->copy_buffer ($src, $dst, $src_offset, $dst_offset, $len, $wait_events...) |
1425 | =item $ev = $queue->copy_buffer ($src, $dst, $src_offset, $dst_offset, $len, $wait_events...) |
1424 | |
1426 | |
1425 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyBuffer.html> |
1427 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueCopyBuffer.html> |
1426 | |
1428 | |
1427 | =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...) |
1429 | $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...) |
1428 | |
1430 | |
1429 | http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueReadBufferRect.html |
1431 | http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueReadBufferRect.html |
1430 | |
1432 | |
1431 | =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...) |
1433 | =item $ev = $queue->write_buffer_rect ($buf, $blocking, $buf_y, $host_x, $host_z, $height, $buf_row_pitch, $host_row_pitch, $data, $wait_events...) |
1432 | |
1434 | |
1433 | http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteBufferRect.html |
1435 | http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteBufferRect.html |
1434 | |
1436 | |
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...) |
1437 | =item $ev = $queue->copy_buffer_to_image ($src_buffer, $dst_image, $src_offset, $dst_x, $dst_y, $dst_z, $width, $height, $depth, $wait_events...) |
1436 | |
1438 | |
… | |
… | |
1620 | it. You are not necessarily meant to do it this way, this example just |
1622 | it. You are not necessarily meant to do it this way, this example just |
1621 | shows you the accessors to use :) |
1623 | shows you the accessors to use :) |
1622 | |
1624 | |
1623 | my $mapped = $queue->map_image ($image, 1, OpenCL::MAP_WRITE); |
1625 | my $mapped = $queue->map_image ($image, 1, OpenCL::MAP_WRITE); |
1624 | |
1626 | |
1625 | $mapped->set ($_ * $mapped->row_pitch, pack "C", 5) |
1627 | $mapped->write ($_ * $mapped->row_pitch, pack "C", 5) |
1626 | for 0..$image->height; |
1628 | for 0 .. $mapped->height - 1; |
1627 | |
1629 | |
1628 | $mapped->unmap;. |
1630 | $mapped->unmap;. |
1629 | $mapped->wait; # only needed for out of order queues normally |
1631 | $mapped->wait; # only needed for out of order queues normally |
1630 | |
1632 | |
1631 | =item $ev = $queue->unmap ($mapped, $wait_events...) |
1633 | =item $ev = $queue->unmap ($mapped, $wait_events...) |
… | |
… | |
1650 | =item $packed_value = $memory->info ($name) |
1652 | =item $packed_value = $memory->info ($name) |
1651 | |
1653 | |
1652 | See C<< $platform->info >> for details. |
1654 | See C<< $platform->info >> for details. |
1653 | |
1655 | |
1654 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html> |
1656 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetMemObjectInfo.html> |
|
|
1657 | |
|
|
1658 | =item $memory->destructor_callback ($cb->()) |
|
|
1659 | |
|
|
1660 | Sets a callback that will be invoked after the memory object is destructed. |
|
|
1661 | |
|
|
1662 | L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clSetMemObjectDestructorCallback.html> |
1655 | |
1663 | |
1656 | =for gengetinfo begin mem |
1664 | =for gengetinfo begin mem |
1657 | |
1665 | |
1658 | =item $mem_object_type = $mem->type |
1666 | =item $mem_object_type = $mem->type |
1659 | |
1667 | |
… | |
… | |
2337 | |
2345 | |
2338 | This is a subclass of OpenCL::Mapped, representing mapped images. |
2346 | This is a subclass of OpenCL::Mapped, representing mapped images. |
2339 | |
2347 | |
2340 | =over 4 |
2348 | =over 4 |
2341 | |
2349 | |
|
|
2350 | =item $pixels = $mapped->width |
|
|
2351 | |
|
|
2352 | =item $pixels = $mapped->height |
|
|
2353 | |
|
|
2354 | =item $pixels = $mapped->depth |
|
|
2355 | |
|
|
2356 | Return the width/height/depth of the mapped image region, in pixels. |
|
|
2357 | |
2342 | =item $bytes = $mapped->row_pitch |
2358 | =item $bytes = $mapped->row_pitch |
2343 | |
2359 | |
2344 | =item $bytes = $mapped->slice_pitch |
2360 | =item $bytes = $mapped->slice_pitch |
2345 | |
2361 | |
2346 | Return the row or slice pitch of the image that has been mapped. |
2362 | Return the row or slice pitch of the image that has been mapped. |
2347 | |
2363 | |
|
|
2364 | =item $bytes = $mapped->element_size |
|
|
2365 | |
|
|
2366 | Return the size of a single pixel. |
|
|
2367 | |
|
|
2368 | =item $data = $mapped->get_row ($count, $x=0, $y=0, $z=0) |
|
|
2369 | |
|
|
2370 | Return C<$count> pixels from the given coordinates. The pixel data must |
|
|
2371 | be completely contained within a single row. |
|
|
2372 | |
|
|
2373 | If C<$count> is C<undef>, then all the remaining pixels in that row are |
|
|
2374 | returned. |
|
|
2375 | |
|
|
2376 | =item $mapped->set_row ($data, $x=0, $y=0, $z=0) |
|
|
2377 | |
|
|
2378 | Write the given pixel data at the given coordinate. The pixel data must |
|
|
2379 | be completely contained within a single row. |
|
|
2380 | |
2348 | =back |
2381 | =back |
2349 | |
|
|
2350 | |
2382 | |
2351 | =cut |
2383 | =cut |
2352 | |
2384 | |
2353 | 1; |
2385 | 1; |
2354 | |
2386 | |