From 0874fa955c0401dba9f54816a9654bb4380abed8 Mon Sep 17 00:00:00 2001 From: Wade Walker Date: Sat, 8 Feb 2014 14:00:41 -0600 Subject: Fix unit test bugs on Mac OS X 64-bit. This commit fixes bugs 959 (local work size set incorrectly), 960 (concurrencyTest() throws ConcurrentModificationException) 963 (programBinariesTest() causes SIGSEGV) and 964 (builderTest() cases CL_INVALID_VALUE). After this commit, all JOCL tests should pass on 64-bit Mac OS X. --- src/com/jogamp/opencl/CLProgramBuilder.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/com/jogamp/opencl/CLProgramBuilder.java') diff --git a/src/com/jogamp/opencl/CLProgramBuilder.java b/src/com/jogamp/opencl/CLProgramBuilder.java index e80b9923..dd0c64f9 100644 --- a/src/com/jogamp/opencl/CLProgramBuilder.java +++ b/src/com/jogamp/opencl/CLProgramBuilder.java @@ -276,14 +276,16 @@ public final class CLProgramBuilder implements CLProgramConfiguration, Serializa private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); - String suffix = null; + String suffix = ""; if(!binariesMap.isEmpty()) { - CLPlatform platform = binariesMap.keySet().iterator().next().getPlatform(); - suffix = platform.getICDSuffix(); + CLDevice device = binariesMap.keySet().iterator().next(); + if(device.isICDAvailable()) + suffix = device.getPlatform().getICDSuffix(); } - out.writeUTF(suffix); // null if we have no binaries or no devices specified + // empty string if we have no binaries or no devices specified, or if cl_khr_icd isn't supported + out.writeUTF(suffix); out.writeInt(binariesMap.size()); // may be 0 for (Map.Entry entry : binariesMap.entrySet()) { @@ -299,22 +301,22 @@ public final class CLProgramBuilder implements CLProgramConfiguration, Serializa private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); - String suffix = in.readUTF(); + String suffix = in.readUTF(); // empty string means no suffix was written; just picks first platform CLPlatform platform = null; for (CLPlatform p : CLPlatform.listCLPlatforms()) { - if(p.getICDSuffix().equals(suffix)) { + if(suffix.isEmpty() || p.getICDSuffix().equals(suffix)) { platform = p; break; } } - + this.binariesMap = new LinkedHashMap(); List devices; if(platform != null) { - devices = new ArrayList(Arrays.asList(platform.listCLDevices())); + devices = new ArrayList(Arrays.asList(platform.listCLDevices())); }else{ - devices = Collections.EMPTY_LIST; + devices = Collections.emptyList(); } int mapSize = in.readInt(); -- cgit v1.2.3