aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/CLImage.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-02-27 00:44:33 +0100
committerMichael Bien <[email protected]>2010-02-27 00:44:33 +0100
commit34bb39283a30919212b682c34bb54d8cd3626cbd (patch)
tree5f70f3473cdfffa8562a558cebcec6aa30af8fc7 /src/com/mbien/opencl/CLImage.java
parent75d392f3fff6d47fdccae9a8915fea61cdbef990 (diff)
refactored CLGLBuffer into seperate OpenGL buffer and image types.
Diffstat (limited to 'src/com/mbien/opencl/CLImage.java')
-rw-r--r--src/com/mbien/opencl/CLImage.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/com/mbien/opencl/CLImage.java b/src/com/mbien/opencl/CLImage.java
index a5e44fc0..1da1cc65 100644
--- a/src/com/mbien/opencl/CLImage.java
+++ b/src/com/mbien/opencl/CLImage.java
@@ -11,7 +11,7 @@ import static com.mbien.opencl.CL.*;
*/
public abstract class CLImage<B extends Buffer> extends CLMemory<B> {
- protected final CLImageFormat format;
+ protected CLImageFormat format;
final CLInfoAccessor imageInfo;
@@ -19,8 +19,12 @@ public abstract class CLImage<B extends Buffer> extends CLMemory<B> {
public final int height;
protected CLImage(CLContext context, B directBuffer, CLImageFormat format, int width, int height, long id) {
+ this(context, directBuffer, format, new CLImageInfoAccessor(context.cl, id), width, height, id);
+ }
+
+ protected CLImage(CLContext context, B directBuffer, CLImageFormat format, CLImageInfoAccessor accessor, int width, int height, long id) {
super(context, directBuffer, id);
- this.imageInfo = new CLImageInfoAccessor();
+ this.imageInfo = accessor;
this.format = format;
this.width = width;
this.height = height;
@@ -63,11 +67,18 @@ public abstract class CLImage<B extends Buffer> extends CLMemory<B> {
}
+ protected final static class CLImageInfoAccessor extends CLInfoAccessor {
- private final class CLImageInfoAccessor extends CLInfoAccessor {
+ private final long id;
+ private final CL cl;
+
+ public CLImageInfoAccessor(CL cl, long id) {
+ this.cl = cl;
+ this.id = id;
+ }
@Override
protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) {
- return cl.clGetImageInfo(ID, name, valueSize, value, valueSizeRet);
+ return cl.clGetImageInfo(id, name, valueSize, value, valueSizeRet);
}
}