diff options
author | Michael Bien <[email protected]> | 2010-02-22 23:38:56 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-02-22 23:38:56 +0100 |
commit | d78faf0ef678cc87f5220d2cb8eccbe173449541 (patch) | |
tree | 8a4dcff14f70c88869d6bdc095817474ae729311 /src/com/mbien/opencl/CLSampler.java | |
parent | 7c83da1d2e3e8d122e562408a63a13928cc97c83 (diff) |
introduced CLObject as common superclass for all OpenCL objects.
Diffstat (limited to 'src/com/mbien/opencl/CLSampler.java')
-rw-r--r-- | src/com/mbien/opencl/CLSampler.java | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/com/mbien/opencl/CLSampler.java b/src/com/mbien/opencl/CLSampler.java index 6732abaf..e12fc43b 100644 --- a/src/com/mbien/opencl/CLSampler.java +++ b/src/com/mbien/opencl/CLSampler.java @@ -5,32 +5,28 @@ import java.nio.Buffer; import static com.mbien.opencl.CLException.*; import static com.mbien.opencl.CL.*; +import static com.mbien.opencl.CLUtils.*; /** * Object representing an OpenCL sampler. * @author Michael Bien */ -public class CLSampler implements CLResource { - - public final long ID; - - private final CLContext context; - private final CL cl; +public class CLSampler extends CLObject implements CLResource { private final CLSamplerInfoAccessor samplerInfo; - CLSampler(CLContext context, AddressingMode addrMode, FilteringMode filtMode, boolean normalizedCoords) { - - this.context = context; - this.cl = context.cl; - + private CLSampler(CLContext context, long id, AddressingMode addrMode, FilteringMode filtMode, boolean normalizedCoords) { + super(context, id); this.samplerInfo = new CLSamplerInfoAccessor(); + } + static CLSampler create(CLContext context, AddressingMode addrMode, FilteringMode filtMode, boolean normalizedCoords) { int[] error = new int[1]; - ID = cl.clCreateSampler(context.ID, normalizedCoords?CL_TRUE:CL_FALSE, addrMode.MODE, filtMode.MODE, error, 0); + long id = context.cl.clCreateSampler(context.ID, clBoolean(normalizedCoords), addrMode.MODE, filtMode.MODE, error, 0); checkForError(error[0], "can not create sampler"); + return new CLSampler(context, id, addrMode, filtMode, normalizedCoords); } public FilteringMode getFilteringMode() { |