diff options
author | Zoltan Gilian <zoltan.gilian@gmail.com> | 2015-08-15 14:05:43 +0200 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2016-03-03 20:15:58 +0000 |
commit | 1274800d6418266c28e744712a0714b1ffb44560 (patch) | |
tree | db0889f62888f94fb6cc444329c196eae6d0abb9 /tests | |
parent | 7632ba0e02d4a03fad8dcd1bf8c6808f682c0aaa (diff) |
cl: add image writing tests
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cl/program/execute/image-write-2d.cl | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/cl/program/execute/image-write-2d.cl b/tests/cl/program/execute/image-write-2d.cl new file mode 100644 index 000000000..25429df07 --- /dev/null +++ b/tests/cl/program/execute/image-write-2d.cl @@ -0,0 +1,81 @@ +/*! +[config] +name: 2D image writing + +dimensions: 2 +global_size: 2 3 0 +local_size: 1 1 0 + +[test] +name: write float to CL_FLOAT CL_RGBA image. +kernel_name: writef + +arg_out: 0 image float4 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 \ + 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 \ + 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 \ + image_type 2d \ + image_width 2 \ + image_height 3 \ + image_channel_order RGBA \ + image_channel_data_type FLOAT +arg_in: 1 buffer float4[6] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 \ + 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 \ + 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 \ + +[test] +name: write signed integer to CL_SIGNED_INT8 CL_RGBA image. +kernel_name: writei + +arg_out: 0 image char4 -0 -1 -2 -3 -4 -5 -6 -7 \ + -10 -11 -12 -13 -14 -15 -16 -17 \ + -20 -21 -22 -23 -24 -25 -26 -27 \ + image_type 2d \ + image_width 2 \ + image_height 3 \ + image_channel_order RGBA \ + image_channel_data_type SIGNED_INT8 +arg_in: 1 buffer int4[6] -0 -1 -2 -3 -4 -5 -6 -7 \ + -10 -11 -12 -13 -14 -15 -16 -17 \ + -20 -21 -22 -23 -24 -25 -26 -27 + +[test] +name: write unsigned integer to CL_UNSIGNED_INT8 CL_RGBA image. +kernel_name: writeui + +arg_out: 0 image uchar4 0 1 2 3 4 5 6 7 \ + 10 11 12 13 14 15 16 17 \ + 20 21 22 23 24 25 26 27 \ + image_type 2d \ + image_width 2 \ + image_height 3 \ + image_channel_order RGBA \ + image_channel_data_type UNSIGNED_INT8 +arg_in: 1 buffer uint4[6] 0 1 2 3 4 5 6 7 \ + 10 11 12 13 14 15 16 17 \ + 20 21 22 23 24 25 26 27 + +!*/ + +kernel void writef(write_only image2d_t img, global float4 *colors) { + const int i = get_global_id(0); + const int j = get_global_id(1); + const int k = i + j * get_image_width(img); + int2 coord = (int2)(i, j); + write_imagef(img, coord, colors[k]); +} + +kernel void writei(write_only image2d_t img, global int4 *colors) { + const int i = get_global_id(0); + const int j = get_global_id(1); + const int k = i + j * get_image_width(img); + int2 coord = (int2)(i, j); + write_imagei(img, coord, colors[k]); +} + +kernel void writeui(write_only image2d_t img, global uint4 *colors) { + const int i = get_global_id(0); + const int j = get_global_id(1); + const int k = i + j * get_image_width(img); + int2 coord = (int2)(i, j); + write_imageui(img, coord, colors[k]); +} |