From ed40efbf71daaee371d7eb334b0b7a00919548bc Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 19 Feb 2010 22:16:40 +0100 Subject: fixed CLBufferTest.mapBufferTest() for non CPU contexts. --- src/com/mbien/opencl/CLPlatform.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/com/mbien') diff --git a/src/com/mbien/opencl/CLPlatform.java b/src/com/mbien/opencl/CLPlatform.java index 2f3cbf54..c3b1a1f2 100644 --- a/src/com/mbien/opencl/CLPlatform.java +++ b/src/com/mbien/opencl/CLPlatform.java @@ -98,6 +98,12 @@ public final class CLPlatform { //find all devices int ret = cl.clGetDeviceIDs(ID, type.TYPE, 0, null, ib); + + // return an empty array rather than throwing an exception + if(ret == CL.CL_DEVICE_NOT_FOUND) { + return new CLDevice[0]; + } + checkForError(ret, "error while enumerating devices"); PointerBuffer deviceIDs = PointerBuffer.allocateDirect(ib.get(0)); -- cgit v1.2.3