diff --git a/jme3-core/src/main/java/com/jme3/opencl/Buffer.java b/jme3-core/src/main/java/com/jme3/opencl/Buffer.java index ebb7d2bb2..a65381f31 100644 --- a/jme3-core/src/main/java/com/jme3/opencl/Buffer.java +++ b/jme3-core/src/main/java/com/jme3/opencl/Buffer.java @@ -423,5 +423,10 @@ public abstract class Buffer extends AbstractOpenCLObject { //default implementation, overwrite for better performance releaseBufferForSharingAsync(queue).release(); } - + + @Override + public String toString() { + return "Buffer (" + getSize() + "B)"; + } + } diff --git a/jme3-core/src/main/java/com/jme3/opencl/Context.java b/jme3-core/src/main/java/com/jme3/opencl/Context.java index fed3cd2a3..455ae3851 100644 --- a/jme3-core/src/main/java/com/jme3/opencl/Context.java +++ b/jme3-core/src/main/java/com/jme3/opencl/Context.java @@ -436,4 +436,10 @@ public abstract class Context extends AbstractOpenCLObject { * @return the new program */ public abstract Program createProgramFromBinary(ByteBuffer binaries, Device device); + + @Override + public String toString() { + return "Context (" + getDevices() + ')'; + } + } diff --git a/jme3-core/src/main/java/com/jme3/opencl/Image.java b/jme3-core/src/main/java/com/jme3/opencl/Image.java index f9d9d9f28..22c092fe2 100644 --- a/jme3-core/src/main/java/com/jme3/opencl/Image.java +++ b/jme3-core/src/main/java/com/jme3/opencl/Image.java @@ -532,6 +532,26 @@ memory layout in which channels are stored in the image. //default implementation, overwrite it for performance improvements releaseImageForSharingAsync(queue).release(); } + + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + str.append("Image ("); + ImageType t = getImageType(); + str.append(t); + str.append(", w=").append(getWidth()); + if (t == ImageType.IMAGE_2D || t == ImageType.IMAGE_3D) { + str.append(", h=").append(getHeight()); + } + if (t == ImageType.IMAGE_3D) { + str.append(", d=").append(getDepth()); + } + if (t == ImageType.IMAGE_1D_ARRAY || t == ImageType.IMAGE_2D_ARRAY) { + str.append(", arrays=").append(getArraySize()); + } + str.append(", ").append(getImageFormat()); + str.append(')'); + return str.toString(); + } - //TODO: add variants of the above two methods that don't create the event object, but release the event immediately } diff --git a/jme3-core/src/main/java/com/jme3/opencl/Kernel.java b/jme3-core/src/main/java/com/jme3/opencl/Kernel.java index 09f22a813..7415f12d5 100644 --- a/jme3-core/src/main/java/com/jme3/opencl/Kernel.java +++ b/jme3-core/src/main/java/com/jme3/opencl/Kernel.java @@ -424,7 +424,12 @@ public abstract class Kernel extends AbstractOpenCLObject { setArgs(args); RunNoEvent(queue); } - + + @Override + public String toString() { + return "Kernel (" + getName() + ")"; + } + /** * A placeholder for kernel arguments representing local kernel memory. * This defines the size of available shared memory of a {@code __shared} kernel @@ -468,6 +473,12 @@ public abstract class Kernel extends AbstractOpenCLObject { } return true; } + + @Override + public String toString() { + return "LocalMem (" + size + "B)"; + } + } /** @@ -519,6 +530,12 @@ public abstract class Kernel extends AbstractOpenCLObject { } return true; } + + @Override + public String toString() { + return "LocalMemPerElement (" + size + "B)"; + } + } /** @@ -623,6 +640,21 @@ public abstract class Kernel extends AbstractOpenCLObject { } return true; } + + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + str.append("WorkSize["); + for (int i=0; i0) { + str.append(", "); + } + str.append(sizes[i]); + } + str.append(']'); + return str.toString(); + } + } } diff --git a/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclPlatform.java b/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclPlatform.java index 56d551180..a481e8818 100644 --- a/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclPlatform.java +++ b/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclPlatform.java @@ -124,4 +124,9 @@ public final class JoclPlatform implements Platform { return platform.getExtensions(); } + @Override + public String toString() { + return getName(); + } + } diff --git a/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java b/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java index 7d22d0aca..610b07e47 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java +++ b/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java @@ -124,4 +124,9 @@ public final class LwjglPlatform implements Platform { return Arrays.asList(platform.getInfoString(CL10.CL_PLATFORM_EXTENSIONS).split(" ")); } + @Override + public String toString() { + return getName(); + } + } diff --git a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java index 74fc685c1..24b95f6c3 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java @@ -125,4 +125,9 @@ public final class LwjglPlatform implements Platform { return Arrays.asList(Info.clGetPlatformInfoStringASCII(platform.address(), CL10.CL_PLATFORM_EXTENSIONS).split(" ")); } + @Override + public String toString() { + return getName(); + } + }