Jogamp
fixed old TODO + better toString() formatting.
authorMichael Bien <mbien@fh-landshut.de>
Wed, 11 May 2011 00:55:33 +0000 (02:55 +0200)
committerMichael Bien <mbien@fh-landshut.de>
Wed, 11 May 2011 00:55:33 +0000 (02:55 +0200)
src/com/jogamp/opencl/CLPlatform.java

index 611513a..4637a11 100644 (file)
@@ -510,11 +510,13 @@ public final class CLPlatform {
      * Returns a info string in exchange for a key (CL_PLATFORM_*).
      */
     public String getInfoString(int key) {
+
         NativeSizeBuffer size = NativeSizeBuffer.allocateDirect(1);
-        // TODO use cache/query size
-        ByteBuffer bb = ByteBuffer.allocateDirect(512);
+        int ret = cl.clGetPlatformInfo(ID, key, 0, null, size);
+        checkForError(ret, "can not receive info string");
 
-        int ret = cl.clGetPlatformInfo(ID, key, bb.capacity(), bb, size);
+        ByteBuffer bb = ByteBuffer.allocateDirect((int)size.get(0));
+        ret = cl.clGetPlatformInfo(ID, key, bb.capacity(), bb, null);
         checkForError(ret, "can not receive info string");
 
         return CLUtil.clString2JavaString(bb, (int)size.get(0));
@@ -522,10 +524,10 @@ public final class CLPlatform {
 
     @Override
     public String toString() {
-        return "CLPlatform [name:" + getName()
-                         +" vendor:"+getVendor()
-                         +" profile:"+getProfile()
-                         +" version:"+getVersion()+"]";
+        return "CLPlatform [name: " + getName()
+                         +", vendor: "+getVendor()
+                         +", profile: "+getProfile()
+                         +", version: "+getVersion()+"]";
     }
 
     @Override
http://JogAmp.org git info: FAQ, tutorial and man pages.