From d9066dda35bc633f8b910ab56b8cbcfff61e6662 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Wed, 11 May 2011 02:55:33 +0200 Subject: fixed old TODO + better toString() formatting. --- src/com/jogamp/opencl/CLPlatform.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/com/jogamp/opencl') diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java index 611513a8..4637a114 100644 --- a/src/com/jogamp/opencl/CLPlatform.java +++ b/src/com/jogamp/opencl/CLPlatform.java @@ -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 -- cgit v1.2.3