summaryrefslogtreecommitdiffstats
path: root/test/com/jogamp/opencl/CLImageTest.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-03 16:35:47 +0200
committerSven Gothel <[email protected]>2014-07-03 16:35:47 +0200
commita90ee128ce0550cd05f969d0283312c2f42b8254 (patch)
treedade644101970d8f69ea3845db310499f2b66a76 /test/com/jogamp/opencl/CLImageTest.java
parenta0e0c8a39d0ef41ff6b64d9b40d058f21b786e81 (diff)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
Diffstat (limited to 'test/com/jogamp/opencl/CLImageTest.java')
-rw-r--r--test/com/jogamp/opencl/CLImageTest.java56
1 files changed, 28 insertions, 28 deletions
diff --git a/test/com/jogamp/opencl/CLImageTest.java b/test/com/jogamp/opencl/CLImageTest.java
index 5f5c0503..17bcd65f 100644
--- a/test/com/jogamp/opencl/CLImageTest.java
+++ b/test/com/jogamp/opencl/CLImageTest.java
@@ -60,18 +60,18 @@ public class CLImageTest extends UITestCase {
@BeforeClass
public static void init() throws IOException {
- BufferedImage bi = ImageIO.read(CLImageTest.class.getResourceAsStream("jogamp.png"));
+ final BufferedImage bi = ImageIO.read(CLImageTest.class.getResourceAsStream("jogamp.png"));
pixels = new int[128*128*4];
bi.getData().getPixels(0, 0, 128, 128, pixels);
}
public CLDevice getCompatibleDevice() {
- CLPlatform[] platforms = CLPlatform.listCLPlatforms();
- for (CLPlatform platform : platforms) {
- CLDevice[] devices = platform.listCLDevices();
+ final CLPlatform[] platforms = CLPlatform.listCLPlatforms();
+ for (final CLPlatform platform : platforms) {
+ final CLDevice[] devices = platform.listCLDevices();
- for (CLDevice device : devices) {
+ for (final CLDevice device : devices) {
if(device.isImageSupportAvailable()) {
return device;
}
@@ -84,15 +84,15 @@ public class CLImageTest extends UITestCase {
@Test
public void supportedImageFormatsTest() {
- CLDevice device = getCompatibleDevice();
+ final CLDevice device = getCompatibleDevice();
if(device == null) {
out.println("WARNING: can not test image api.");
return;
}
- CLContext context = CLContext.create(device);
+ final CLContext context = CLContext.create(device);
try{
- CLImageFormat[] formats = context.getSupportedImage2dFormats();
+ final CLImageFormat[] formats = context.getSupportedImage2dFormats();
assertTrue(formats.length > 0);
out.println("sample image format: "+formats[0]);
// for (CLImageFormat format : formats) {
@@ -106,28 +106,28 @@ public class CLImageTest extends UITestCase {
@Test
public void image2dCopyTest() throws IOException {
- CLDevice device = getCompatibleDevice();
+ final CLDevice device = getCompatibleDevice();
if(device == null) {
out.println("WARNING: can not test image api.");
return;
}
- CLContext context = CLContext.create(device);
+ final CLContext context = CLContext.create(device);
- CLCommandQueue queue = device.createCommandQueue();
+ final CLCommandQueue queue = device.createCommandQueue();
try{
- CLImageFormat format = new CLImageFormat(RGBA, UNSIGNED_INT32);
+ final CLImageFormat format = new CLImageFormat(RGBA, UNSIGNED_INT32);
- CLImage2d<IntBuffer> imageA = context.createImage2d(newDirectIntBuffer(pixels), 128, 128, format);
- CLImage2d<IntBuffer> imageB = context.createImage2d(newDirectIntBuffer(pixels.length), 128, 128, format);
+ final CLImage2d<IntBuffer> imageA = context.createImage2d(newDirectIntBuffer(pixels), 128, 128, format);
+ final CLImage2d<IntBuffer> imageB = context.createImage2d(newDirectIntBuffer(pixels.length), 128, 128, format);
queue.putWriteImage(imageA, false)
.putCopyImage(imageA, imageB)
.putReadImage(imageB, true);
- IntBuffer bufferA = imageA.getBuffer();
- IntBuffer bufferB = imageB.getBuffer();
+ final IntBuffer bufferA = imageA.getBuffer();
+ final IntBuffer bufferB = imageB.getBuffer();
while(bufferA.hasRemaining()) {
assertEquals(bufferA.get(), bufferB.get());
@@ -141,14 +141,14 @@ public class CLImageTest extends UITestCase {
@Test
public void image2dKernelCopyTest() throws IOException {
- CLDevice device = getCompatibleDevice();
+ final CLDevice device = getCompatibleDevice();
if(device == null) {
out.println("WARNING: can not test image api.");
return;
}
- CLContext context = CLContext.create(device);
+ final CLContext context = CLContext.create(device);
- String src =
+ final String src =
"constant sampler_t imageSampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST; \n" +
"kernel void image2dCopy(read_only image2d_t input, write_only image2d_t output) { \n" +
" int2 coord = (int2)(get_global_id(0), get_global_id(1)); \n" +
@@ -156,24 +156,24 @@ public class CLImageTest extends UITestCase {
" write_imageui(output, coord, temp); \n" +
"} \n";
- CLKernel kernel = context.createProgram(src).build().createCLKernel("image2dCopy");
+ final CLKernel kernel = context.createProgram(src).build().createCLKernel("image2dCopy");
- CLCommandQueue queue = device.createCommandQueue();
+ final CLCommandQueue queue = device.createCommandQueue();
try{
- CLImageFormat format = new CLImageFormat(RGBA, UNSIGNED_INT32);
+ final CLImageFormat format = new CLImageFormat(RGBA, UNSIGNED_INT32);
- CLImage2d<IntBuffer> imageA = context.createImage2d(newDirectIntBuffer(pixels), 128, 128, format);
- CLImage2d<IntBuffer> imageB = context.createImage2d(newDirectIntBuffer(pixels.length), 128, 128, format);
+ final CLImage2d<IntBuffer> imageA = context.createImage2d(newDirectIntBuffer(pixels), 128, 128, format);
+ final CLImage2d<IntBuffer> imageB = context.createImage2d(newDirectIntBuffer(pixels.length), 128, 128, format);
kernel.putArgs(imageA, imageB);
queue.putWriteImage(imageA, false)
.put2DRangeKernel(kernel, 0, 0, 128, 128, 0, 0)
.putReadImage(imageB, true);
- IntBuffer bufferA = imageA.getBuffer();
- IntBuffer bufferB = imageB.getBuffer();
+ final IntBuffer bufferA = imageA.getBuffer();
+ final IntBuffer bufferB = imageB.getBuffer();
while(bufferA.hasRemaining()) {
assertEquals(bufferA.get(), bufferB.get());
@@ -184,8 +184,8 @@ public class CLImageTest extends UITestCase {
}
}
- public static void main(String[] args) throws IOException {
- String tstname = CLImageTest.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = CLImageTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}