Skip to content

Commit

Permalink
Add exception handler to gaussian blur sample
Browse files Browse the repository at this point in the history
  • Loading branch information
DuncanMcBain committed Jan 30, 2019
1 parent a44a8cf commit 7a29dfe
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion samples/gaussian-blur/gaussian-blur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,16 @@ int main(int argc, char* argv[]) {
range<2> imgRange(inputWidth, inputHeight);
/* This is the range representing the size of the blur. */
range<2> gaussianRange(6 * stddev, 6 * stddev);
queue myQueue;
queue myQueue([](cl::sycl::exception_list l) {
for (auto ep : l) {
try {
std::rethrow_exception(ep);
} catch (const cl::sycl::exception& e) {
std::cout << "Async exception caught:\n" << e.what() << "\n";
throw;
}
}
});

{
buffer<float, 2> gaussian(gaussianRange);
Expand Down Expand Up @@ -174,6 +183,7 @@ int main(int argc, char* argv[]) {
outPtr.write(outputCoords, newPixel);
});
});
myQueue.wait_and_throw();
}

/* Attempt to change the name from x.png or x.jpg to x-blurred.png and so
Expand Down

0 comments on commit 7a29dfe

Please sign in to comment.