… | |
… | |
537 | =item $int = OpenCL::errno |
537 | =item $int = OpenCL::errno |
538 | |
538 | |
539 | The last error returned by a function - it's only valid after an error occured |
539 | The last error returned by a function - it's only valid after an error occured |
540 | and before calling another OpenCL function. |
540 | and before calling another OpenCL function. |
541 | |
541 | |
542 | =item $str = OpenCL::err2str $errval |
542 | =item $str = OpenCL::err2str [$errval] |
543 | |
543 | |
544 | Comverts an error value into a human readable string. |
544 | Converts an error value into a human readable string. IF no error value is |
|
|
545 | given, then the last error will be used (as returned by OpenCL::errno). |
545 | |
546 | |
546 | =item $str = OpenCL::enum2str $enum |
547 | =item $str = OpenCL::enum2str $enum |
547 | |
548 | |
548 | Converts most enum values (of parameter names, image format constants, |
549 | Converts most enum values (of parameter names, image format constants, |
549 | object types, addressing and filter modes, command types etc.) into a |
550 | object types, addressing and filter modes, command types etc.) into a |
… | |
… | |
1007 | require Carp; |
1008 | require Carp; |
1008 | |
1009 | |
1009 | $prog = $self->program_with_source ($prog) |
1010 | $prog = $self->program_with_source ($prog) |
1010 | unless ref $prog; |
1011 | unless ref $prog; |
1011 | |
1012 | |
1012 | # we build separately per device so we instantly know which one failed |
1013 | eval { $prog->build (undef, $options); 1 } |
|
|
1014 | or errno == BUILD_PROGRAM_FAILURE |
|
|
1015 | or Carp::croak "OpenCL::Context->build_program: " . err2str; |
|
|
1016 | |
|
|
1017 | # we check status for all devices |
1013 | for my $dev ($self->devices) { |
1018 | for my $dev ($self->devices) { |
1014 | eval { $prog->build ([$dev], $options); 1 } |
1019 | $prog->build_status ($dev) == BUILD_SUCCESS |
1015 | or Carp::croak ("Building OpenCL program for device '" . $dev->name . "' failed:\n" |
1020 | or Carp::croak ("Building OpenCL program for device '" . $dev->name . "' failed:\n" |
1016 | . $prog->build_log ($dev)); |
1021 | . $prog->build_log ($dev)); |
1017 | } |
1022 | } |
1018 | |
1023 | |
1019 | $prog |
1024 | $prog |