diff options
author | Michael Bien <[email protected]> | 2011-09-13 17:23:51 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-09-13 17:23:51 +0200 |
commit | 749b7ecbe80164788264d460814a8454d063a6db (patch) | |
tree | 233dfbc5f8f8020cf4d7a82a85dffe9568215aab | |
parent | c967d61484154911245d213fe0820e2b2d2af549 (diff) |
toString and better exception messages.
-rw-r--r-- | src/com/jogamp/opencl/CLWork.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/com/jogamp/opencl/CLWork.java b/src/com/jogamp/opencl/CLWork.java index 09e45604..575846ab 100644 --- a/src/com/jogamp/opencl/CLWork.java +++ b/src/com/jogamp/opencl/CLWork.java @@ -96,7 +96,7 @@ public class CLWork { protected void checkSize(long worksize, long groupsize) { if(groupsize != 0 && worksize%groupsize != 0) { - throw new IllegalArgumentException("worksize must be a multiple of groupsize"); + throw new IllegalArgumentException("worksize must be a multiple of groupsize: {ws: "+worksize+", gs:"+groupsize+"}"); } } @@ -147,6 +147,27 @@ public class CLWork { return workSize; } + @Override + public String toString() { + return getClass().getSimpleName()+ " [" +kernel+toStr(workOffset)+toStr(workSize)+toStr(groupSize)+"]"; + } + + private String toStr(NativeSizeBuffer buffer) { + if(buffer == null) { + return null; + } + StringBuilder sb = new StringBuilder(); + sb.append('{'); + for (int i = buffer.position(); i < buffer.capacity(); i++) { + sb.append(buffer.get(i)); + if(i != buffer.capacity()-1) { + sb.append(", "); + } + } + return sb.append('}').toString(); + } + + /** * 1 dimensional {@link CLWork}. * @author Michael Bien |