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

Comparing OpenCL/OpenCL.pm (file contents):
Revision 1.66 by root, Tue May 1 16:37:23 2012 UTC vs.
Revision 1.67 by root, Tue May 1 22:04:56 2012 UTC

558 @OpenCL::Image1DArray::ISA = 558 @OpenCL::Image1DArray::ISA =
559 @OpenCL::Image1DBuffer::ISA = OpenCL::Image::; 559 @OpenCL::Image1DBuffer::ISA = OpenCL::Image::;
560 560
561 @OpenCL::UserEvent::ISA = OpenCL::Event::; 561 @OpenCL::UserEvent::ISA = OpenCL::Event::;
562 562
563 @OpenCL::MappedBuffer = 563 @OpenCL::MappedBuffer::ISA =
564 @OpenCL::MappedImage = OpenCL::Mapped::; 564 @OpenCL::MappedImage::ISA = OpenCL::Mapped::;
565} 565}
566 566
567=head2 THE OpenCL PACKAGE 567=head2 THE OpenCL PACKAGE
568 568
569=over 4 569=over 4
1977copied. 1977copied.
1978 1978
1979When the object is destroyed it will enqueue an implicit unmap operation 1979When the object is destroyed it will enqueue an implicit unmap operation
1980on the queue that was used to create it. 1980on the queue that was used to create it.
1981 1981
1982Keep in mind that you I<need> to unmap (or destroy) mapped objects before
1983OpenCL sees the changes, even if some implementations don't need this
1984sometimes.
1985
1982Example, replace the first two floats in the mapped buffer by 1 and 2. 1986Example, replace the first two floats in the mapped buffer by 1 and 2.
1983 1987
1984 my $mapped = $queue->map_buffer ($buf, ... 1988 my $mapped = $queue->map_buffer ($buf, ...
1985 $mapped->event->wait; # make sure it's there 1989 $mapped->event->wait; # make sure it's there
1986 1990
1989 # (and of course, we assume iee 754 single precision floats :) 1993 # (and of course, we assume iee 754 single precision floats :)
1990 substr $$mapped, 0, 8, pack "f*", 1, 2; 1994 substr $$mapped, 0, 8, pack "f*", 1, 2;
1991 1995
1992=over 4 1996=over 4
1993 1997
1998=item $ev = $mapped->unmap ($wait_events...)
1999
2000Unmaps the mapped memory object, using the queue originally used to create
2001it, quite similarly to C<< $queue->unmap ($mapped, ...) >>.
2002
1994=item $bool = $mapped->mapped 2003=item $bool = $mapped->mapped
1995 2004
1996Returns whether the object is still mapped - true before an C<unmap> is 2005Returns whether the object is still mapped - true before an C<unmap> is
1997enqueued, false afterwards. 2006enqueued, false afterwards.
1998 2007
2013 2022
2014=item $ptr = $mapped->ptr 2023=item $ptr = $mapped->ptr
2015 2024
2016Returns the raw memory address of the mapped area - same as C<$mapped+0>. 2025Returns the raw memory address of the mapped area - same as C<$mapped+0>.
2017 2026
2027=item $mapped->set ($offset, $data)
2028
2029Replaces the data at the given C<$offset> in the memory area by the new
2030C<$data>. This method is safer but slower than direct manipulation of
2031C<$$mapped> with substr.
2032
2033=item $data = $mapped->get ($offset, $length)
2034
2035Returns (without copying) a scalar representing the data at the given
2036C<$offset> and C<$length> in the mapped memory area. This is the same as
2037the following substr, except much slower:
2038
2039 $data = substr $$mapped, $offset, $length
2040
2041#TODO: really?
2042
2043=cut
2044
2045sub get {
2046 substr ${$_[0]}, $_[1], $_[2]
2047}
2048
2018=back 2049=back
2019 2050
2020=head2 THE OpenCL::MappedBuffer CLASS 2051=head2 THE OpenCL::MappedBuffer CLASS
2021 2052
2022This is a subclass of OpenCL::Mapped, representing mapped buffers. 2053This is a subclass of OpenCL::Mapped, representing mapped buffers.
2023 2054
2055=head2 THE OpenCL::MappedImage CLASS
2056
2057This is a subclass of OpenCL::Mapped, representing mapped images.
2058
2024=over 4 2059=over 4
2025 2060
2026=back 2061=item $bytes = $mapped->row_pitch
2027 2062
2028=head2 THE OpenCL::MappedImage CLASS 2063=item $bytes = $mapped->slice_pitch
2029 2064
2030This is a subclass of OpenCL::Mapped, representing mapped images. 2065Return the row or slice pitch of the image that has been mapped.
2031
2032=over 4
2033 2066
2034=back 2067=back
2035 2068
2036 2069
2037=cut 2070=cut

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines