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

Comparing OpenCL/OpenCL.pm (file contents):
Revision 1.27 by root, Wed Nov 23 03:02:38 2011 UTC vs.
Revision 1.33 by root, Thu Apr 19 12:55:30 2012 UTC

105 for my $platform (OpenCL::platforms) { 105 for my $platform (OpenCL::platforms) {
106 printf "platform: %s\n", $platform->name; 106 printf "platform: %s\n", $platform->name;
107 printf "extensions: %s\n", $platform->extensions; 107 printf "extensions: %s\n", $platform->extensions;
108 for my $device ($platform->devices) { 108 for my $device ($platform->devices) {
109 printf "+ device: %s\n", $device->name; 109 printf "+ device: %s\n", $device->name;
110 my $ctx = $device->context; 110 my $ctx = $platform->context (undef, [$device]);
111 # do stuff 111 # do stuff
112 } 112 }
113 } 113 }
114 114
115=head2 Get a useful context and a command queue. 115=head2 Get a useful context and a command queue.
149 149
150=head2 Create and build a program, then create a kernel out of one of its 150=head2 Create and build a program, then create a kernel out of one of its
151functions. 151functions.
152 152
153 my $src = ' 153 my $src = '
154 __kernel void 154 kernel void
155 squareit (__global float *input, __global float *output) 155 squareit (global float *input, global float *output)
156 { 156 {
157 $id = get_global_id (0); 157 $id = get_global_id (0);
158 output [id] = input [id] * input [id]; 158 output [id] = input [id] * input [id];
159 } 159 }
160 '; 160 ';
286 286
287Comverts an error value into a human readable string. 287Comverts an error value into a human readable string.
288 288
289=item $str = OpenCL::enum2str $enum 289=item $str = OpenCL::enum2str $enum
290 290
291Converts most enum values (inof parameter names, image format constants, 291Converts most enum values (of parameter names, image format constants,
292object types, addressing and filter modes, command types etc.) into a 292object types, addressing and filter modes, command types etc.) into a
293human readbale string. When confronted with some random integer it can be 293human readable string. When confronted with some random integer it can be
294very helpful to pass it through this function to maybe get some readable 294very helpful to pass it through this function to maybe get some readable
295string out of it. 295string out of it.
296 296
297=item @platforms = OpenCL::platforms 297=item @platforms = OpenCL::platforms
298 298
326 326
327Tries to create a context. Never worked for me, and you need devices explicitly anyway. 327Tries to create a context. Never worked for me, and you need devices explicitly anyway.
328 328
329L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html> 329L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContextFromType.html>
330 330
331=item $ctx = $device->context ($properties = undef, @$devices, $notify = undef) 331=item $ctx = $platform->context ($properties = undef, @$devices, $notify = undef)
332 332
333Create a new OpenCL::Context object using the given device object(s)- a 333Create a new OpenCL::Context object using the given device object(s)- a
334CL_CONTEXT_PLATFORM property is supplied automatically. 334CL_CONTEXT_PLATFORM property is supplied automatically.
335 335
336L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html> 336L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateContext.html>
691 691
692Creates a new OpenCL::Image3D object and optionally initialises it with 692Creates a new OpenCL::Image3D object and optionally initialises it with
693the given data values. 693the given data values.
694 694
695L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateImage3D.html> 695L<http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateImage3D.html>
696
697=item $buffer = $ctx->gl_buffer ($flags, $bufobj)
698
699Creates a new OpenCL::Buffer (actually OpenCL::BufferObj) object that refers to the given
700OpenGL buffer object.
701
702http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateFromGLBuffer.html
703
704=item $ctx->gl_texture2d ($flags, $target, $miplevel, $texture)
705
706Creates a new OpenCL::Image2D object that refers to the given OpenGL
7072D texture object.
708
709http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateFromGLTexture2D.html
710
711=item $ctx->gl_texture3d ($flags, $target, $miplevel, $texture)
712
713Creates a new OpenCL::Image3D object that refers to the given OpenGL
7143D texture object.
715
716http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateFromGLTexture3D.html
717
718=item $ctx->gl_renderbuffer ($flags, $renderbuffer)
719
720Creates a new OpenCL::Image2D object that refers to the given OpenGL
721render buffer.
722
723http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateFromGLRenderbuffer.html
696 724
697=item @formats = $ctx->supported_image_formats ($flags, $image_type) 725=item @formats = $ctx->supported_image_formats ($flags, $image_type)
698 726
699Returns a list of matching image formats - each format is an arrayref with 727Returns a list of matching image formats - each format is an arrayref with
700two values, $channel_order and $channel_type, in it. 728two values, $channel_order and $channel_type, in it.
1302package OpenCL; 1330package OpenCL;
1303 1331
1304use common::sense; 1332use common::sense;
1305 1333
1306BEGIN { 1334BEGIN {
1307 our $VERSION = '0.59'; 1335 our $VERSION = '0.92';
1308 1336
1309 require XSLoader; 1337 require XSLoader;
1310 XSLoader::load (__PACKAGE__, $VERSION); 1338 XSLoader::load (__PACKAGE__, $VERSION);
1311 1339
1312 @OpenCL::Buffer::ISA = 1340 @OpenCL::Buffer::ISA =

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines