• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (c) 2017 The Khronos Group Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //    http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #include "../testBase.h"
17 #include "../common.h"
18 
19 extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo,
20                                    const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d );
21 
set_image_dimensions(image_descriptor * imageInfo,size_t width,size_t height,size_t arraySize,size_t rowPadding,size_t slicePadding)22 static void set_image_dimensions( image_descriptor *imageInfo, size_t width, size_t height, size_t arraySize, size_t rowPadding, size_t slicePadding )
23 {
24     size_t pixelSize = get_pixel_size( imageInfo->format );
25 
26     imageInfo->width = width;
27     imageInfo->height = height;
28     imageInfo->arraySize = arraySize;
29     imageInfo->rowPitch = imageInfo->width * pixelSize + rowPadding;
30 
31     if (gEnablePitch)
32     {
33         do {
34             rowPadding++;
35             imageInfo->rowPitch = imageInfo->width * pixelSize + rowPadding;
36         } while ((imageInfo->rowPitch % pixelSize) != 0);
37     }
38 
39     if (arraySize == 0)
40     {
41         imageInfo->type = CL_MEM_OBJECT_IMAGE2D;
42         imageInfo->slicePitch = 0;
43     }
44     else
45     {
46         imageInfo->type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
47         imageInfo->slicePitch = imageInfo->rowPitch * (imageInfo->height + slicePadding);
48     }
49 }
50 
51 
test_copy_image_size_2D_2D_array(cl_context context,cl_command_queue queue,image_descriptor * srcImageInfo,image_descriptor * dstImageInfo,MTdata d)52 int test_copy_image_size_2D_2D_array( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, MTdata d )
53 {
54     size_t sourcePos[ 4 ] = { 0 }, destPos[ 4 ] = { 0 }, regionSize[ 3 ];
55     int ret = 0, retCode;
56 
57     image_descriptor *threeImage, *twoImage;
58 
59     if( srcImageInfo->arraySize > 0 )
60     {
61         threeImage = srcImageInfo;
62         twoImage = dstImageInfo;
63     }
64     else
65     {
66         threeImage = dstImageInfo;
67         twoImage = srcImageInfo;
68     }
69 
70     size_t twoImage_lod = 0, twoImage_width_lod = twoImage->width, twoImage_row_pitch_lod;
71     size_t twoImage_height_lod = twoImage->height;
72     size_t threeImage_lod = 0, threeImage_width_lod = threeImage->width, threeImage_row_pitch_lod, threeImage_slice_pitch_lod;
73     size_t threeImage_height_lod = threeImage->height;
74     size_t width_lod, height_lod;
75     size_t twoImage_max_mip_level,threeImage_max_mip_level;
76 
77     if( gTestMipmaps )
78     {
79         twoImage_max_mip_level = twoImage->num_mip_levels;
80         threeImage_max_mip_level = threeImage->num_mip_levels;
81         // Work at random mip levels
82         twoImage_lod = (size_t)random_in_range( 0, twoImage_max_mip_level ? twoImage_max_mip_level - 1 : 0, d );
83         threeImage_lod = (size_t)random_in_range( 0, threeImage_max_mip_level ? threeImage_max_mip_level - 1 : 0, d );
84         twoImage_width_lod = ( twoImage->width >> twoImage_lod )? ( twoImage->width >> twoImage_lod ) : 1;
85         threeImage_width_lod = ( threeImage->width >> threeImage_lod )? ( threeImage->width >> threeImage_lod ) : 1;
86         twoImage_height_lod = ( twoImage->height >> twoImage_lod )? ( twoImage->height >> twoImage_lod ) : 1;
87         threeImage_height_lod = ( threeImage->height >> threeImage_lod )? ( threeImage->height >> threeImage_lod ) : 1;
88         twoImage_row_pitch_lod = twoImage_width_lod * get_pixel_size( twoImage->format );
89         threeImage_row_pitch_lod = threeImage_width_lod * get_pixel_size( threeImage->format );
90         threeImage_slice_pitch_lod = threeImage_height_lod * threeImage_row_pitch_lod;
91     }
92     width_lod  = ( twoImage_width_lod > threeImage_width_lod ) ? threeImage_width_lod : twoImage_width_lod;
93     height_lod  = ( twoImage_height_lod > threeImage_height_lod ) ? threeImage_height_lod : twoImage_height_lod;
94 
95     // First, try just a full covering region
96     sourcePos[ 0 ] = sourcePos[ 1 ] = sourcePos[ 2 ] = sourcePos[ 3 ] = 0;
97     destPos[ 0 ] = destPos[ 1 ] = destPos[ 2 ] = destPos[ 3 ] = 0;
98     regionSize[ 0 ] = width_lod;
99     regionSize[ 1 ] = height_lod;
100     regionSize[ 2 ] = 1;
101 
102     if( srcImageInfo->arraySize == 0 )
103     {
104         // 2D to 2D array
105         destPos[ 2 ] = (size_t)random_in_range( 0, (int)dstImageInfo->arraySize - 1, d );
106         if(gTestMipmaps)
107         {
108             sourcePos[ 2 ] = twoImage_lod;
109             destPos[ 3 ] = threeImage_lod;
110             regionSize[ 0 ] = width_lod;
111             regionSize[ 1 ] = height_lod;
112         }
113     }
114     else
115     {
116         // 2D array to 2D
117         sourcePos[ 2 ] = (size_t)random_in_range( 0, (int)srcImageInfo->arraySize - 1, d );
118         if(gTestMipmaps)
119         {
120             sourcePos[ 3 ] = threeImage_lod;
121             destPos[ 2 ] = twoImage_lod;
122             regionSize[ 0 ] = width_lod;
123             regionSize[ 1 ] = height_lod;
124         }
125     }
126 
127     retCode = test_copy_image_generic( context, queue, srcImageInfo, dstImageInfo, sourcePos, destPos, regionSize, d );
128     if( retCode < 0 )
129         return retCode;
130     else
131         ret += retCode;
132 
133     // Now try a sampling of different random regions
134     for( int i = 0; i < 8; i++ )
135     {
136         if( gTestMipmaps )
137         {
138             // Work at a random mip level
139             twoImage_lod = (size_t)random_in_range( 0, twoImage_max_mip_level ? twoImage_max_mip_level - 1 : 0, d );
140             threeImage_lod = (size_t)random_in_range( 0, threeImage_max_mip_level ? threeImage_max_mip_level - 1 : 0, d );
141             twoImage_width_lod = ( twoImage->width >> twoImage_lod )? ( twoImage->width >> twoImage_lod ) : 1;
142             threeImage_width_lod = ( threeImage->width >> threeImage_lod )? ( threeImage->width >> threeImage_lod ) : 1;
143             twoImage_height_lod = ( twoImage->height >> twoImage_lod )? ( twoImage->height >> twoImage_lod ) : 1;
144             threeImage_height_lod = ( threeImage->height >> threeImage_lod )? ( threeImage->height >> threeImage_lod ) : 1;
145             width_lod  = ( twoImage_width_lod > threeImage_width_lod ) ? threeImage_width_lod : twoImage_width_lod;
146             height_lod  = ( twoImage_height_lod > threeImage_height_lod ) ? threeImage_height_lod : twoImage_height_lod;
147         }
148         // Pick a random size
149         regionSize[ 0 ] = random_in_ranges( 8, srcImageInfo->width, dstImageInfo->width, d );
150         regionSize[ 1 ] = random_in_ranges( 8, srcImageInfo->height, dstImageInfo->height, d );
151         if( gTestMipmaps )
152         {
153             regionSize[ 0 ] = ( width_lod > 8 ) ? random_in_range( 8, width_lod, d ) : width_lod;
154             regionSize[ 1 ] = ( height_lod > 8) ? random_in_range( 8, height_lod, d ): height_lod;
155         }
156 
157         // Now pick positions within valid ranges
158         sourcePos[ 0 ] = ( srcImageInfo->width > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( srcImageInfo->width - regionSize[ 0 ] - 1 ), d ) : 0;
159         sourcePos[ 1 ] = ( srcImageInfo->height > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( srcImageInfo->height - regionSize[ 1 ] - 1 ), d ) : 0;
160         sourcePos[ 2 ] = ( srcImageInfo->arraySize > 0 ) ? (size_t)random_in_range( 0, (int)( srcImageInfo->arraySize - 1 ), d ) : gTestMipmaps ? twoImage_lod : 0;
161         if (gTestMipmaps)
162         {
163             if( srcImageInfo->arraySize > 0 )
164             {
165                 sourcePos[ 0 ] = ( threeImage_width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( threeImage_width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
166                 sourcePos[ 1 ] = ( threeImage_height_lod > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( threeImage_height_lod - regionSize[ 1 ] - 1 ), d ) : 0;
167                 sourcePos[ 3 ] = threeImage_lod;
168             }
169             else
170             {
171                 sourcePos[ 0 ] = ( twoImage_width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( twoImage_width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
172                 sourcePos[ 1 ] = ( twoImage_height_lod > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( twoImage_height_lod - regionSize[ 1 ] - 1 ), d ) : 0;
173 
174             }
175         }
176 
177         destPos[ 0 ] = ( dstImageInfo->width > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( dstImageInfo->width - regionSize[ 0 ] - 1 ), d ) : 0;
178         destPos[ 1 ] = ( dstImageInfo->height > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( dstImageInfo->height - regionSize[ 1 ] - 1 ), d ) : 0;
179         destPos[ 2 ] = ( dstImageInfo->arraySize > 0 ) ? (size_t)random_in_range( 0, (int)( dstImageInfo->arraySize - 1 ), d ) : gTestMipmaps ? twoImage_lod : 0;
180         if (gTestMipmaps)
181         {
182             if( dstImageInfo->arraySize > 0 )
183             {
184                 destPos[ 0 ] = ( threeImage_width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( threeImage_width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
185                 destPos[ 1 ] = ( threeImage_height_lod > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( threeImage_height_lod - regionSize[ 1 ] - 1 ), d ) : 0;
186                 destPos[ 3 ] = threeImage_lod;
187             }
188             else
189             {
190                 destPos[ 0 ] = ( twoImage_width_lod > regionSize[ 0 ] ) ? (size_t)random_in_range( 0, (int)( twoImage_width_lod - regionSize[ 0 ] - 1 ), d ) : 0;
191                 destPos[ 1 ] = ( twoImage_height_lod > regionSize[ 1 ] ) ? (size_t)random_in_range( 0, (int)( twoImage_height_lod - regionSize[ 1 ] - 1 ), d ) : 0;
192 
193             }
194         }
195 
196         // Go for it!
197         retCode = test_copy_image_generic( context, queue, srcImageInfo, dstImageInfo, sourcePos, destPos, regionSize, d );
198         if( retCode < 0 )
199             return retCode;
200         else
201             ret += retCode;
202     }
203 
204     return ret;
205 }
206 
207 
test_copy_image_set_2D_2D_array(cl_device_id device,cl_context context,cl_command_queue queue,cl_image_format * format,bool reverse=false)208 int test_copy_image_set_2D_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, bool reverse = false )
209 {
210     size_t maxWidth, maxHeight, maxArraySize;
211     cl_ulong maxAllocSize, memSize;
212     image_descriptor srcImageInfo = { 0 };
213     image_descriptor dstImageInfo = { 0 };
214     RandomSeed  seed( gRandomSeed );
215 
216     srcImageInfo.format = dstImageInfo.format = format;
217 
218     int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
219     error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
220     error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE, sizeof( maxArraySize ), &maxArraySize, NULL );
221     error |= clGetDeviceInfo( device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof( maxAllocSize ), &maxAllocSize, NULL );
222     error |= clGetDeviceInfo( device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof( memSize ), &memSize, NULL );
223     test_error( error, "Unable to get max image 2D size from device" );
224 
225     if (memSize > (cl_ulong)SIZE_MAX) {
226       memSize = (cl_ulong)SIZE_MAX;
227     }
228 
229     if( gTestSmallImages )
230     {
231         for( dstImageInfo.width = 4; dstImageInfo.width < 17; dstImageInfo.width++ )
232         {
233             for( dstImageInfo.height = 4; dstImageInfo.height < 13; dstImageInfo.height++ )
234             {
235                 for( dstImageInfo.arraySize = 4; dstImageInfo.arraySize < 9; dstImageInfo.arraySize++ )
236                 {
237                     size_t rowPadding = gEnablePitch ? 256 : 0;
238                     size_t slicePadding = gEnablePitch ? 3 : 0;
239 
240                     set_image_dimensions( &dstImageInfo, dstImageInfo.width, dstImageInfo.height, dstImageInfo.arraySize, rowPadding, slicePadding );
241                     set_image_dimensions( &srcImageInfo, dstImageInfo.width, dstImageInfo.height, 0, rowPadding, slicePadding );
242 
243                     if (gTestMipmaps)
244                     {
245                       srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
246                       srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
247                       dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, 0), seed);
248                       dstImageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
249                       srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
250                       srcImageInfo.slicePitch = 0;
251                       dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
252                       dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
253                     }
254 
255                     if( gDebugTrace )
256                     {
257                         if (reverse)
258                             log_info( "   at size %d,%d,%d to %d,%d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height );
259                         else
260                             log_info( "   at size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
261                     }
262                     int ret;
263                     if( reverse )
264                         ret = test_copy_image_size_2D_2D_array( context, queue, &dstImageInfo, &srcImageInfo, seed );
265                     else
266                         ret = test_copy_image_size_2D_2D_array( context, queue, &srcImageInfo, &dstImageInfo, seed );
267                     if( ret )
268                         return -1;
269                 }
270             }
271         }
272     }
273     else if( gTestMaxImages )
274     {
275         // Try a specific set of maximum sizes
276         size_t numberOfSizes2DArray, numberOfSizes2D;
277         size_t sizes2DArray[100][3], sizes2D[100][3];
278 
279         // Try to allocate a bit smaller images because we need the 2D ones as well for the copy.
280         get_max_sizes(&numberOfSizes2DArray, 100, sizes2DArray, maxWidth, maxHeight, 1, maxArraySize, maxAllocSize/2, memSize/2, CL_MEM_OBJECT_IMAGE2D_ARRAY, dstImageInfo.format);
281         get_max_sizes(&numberOfSizes2D, 100, sizes2D, maxWidth, maxHeight, 1, 1, maxAllocSize/2, memSize/2, CL_MEM_OBJECT_IMAGE2D, dstImageInfo.format);
282 
283         for( size_t i = 0; i < numberOfSizes2D; i++ )
284         {
285           for( size_t j = 0; j < numberOfSizes2DArray; j++ )
286           {
287             size_t rowPadding = gEnablePitch ? 256 : 0;
288             size_t slicePadding = gEnablePitch ? 3 : 0;
289 
290             set_image_dimensions( &dstImageInfo, sizes2DArray[ j ][ 0 ], sizes2DArray[ j ][ 1 ], sizes2DArray[ j ][ 2 ], rowPadding, slicePadding );
291             set_image_dimensions( &srcImageInfo, sizes2D[ i ][ 0 ], sizes2D[ i ][ 1 ], 0, rowPadding, slicePadding );
292 
293             cl_ulong dstSize = get_image_size(&dstImageInfo);
294             cl_ulong srcSize = get_image_size(&srcImageInfo);
295 
296             if (gTestMipmaps)
297             {
298               srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
299               srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
300               dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, 0), seed);
301               dstImageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
302               srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
303               srcImageInfo.slicePitch = 0;
304               dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
305               dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
306               dstSize = 4 * compute_mipmapped_image_size( dstImageInfo );
307               srcSize = 4 * compute_mipmapped_image_size( srcImageInfo );
308             }
309 
310             if( dstSize < maxAllocSize && dstSize < ( memSize / 3 ) && srcSize < maxAllocSize && srcSize < ( memSize / 3 ) )
311             {
312               if (reverse)
313                 log_info( "Testing %d x %d x %d to %d x %d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height );
314               else
315                 log_info( "Testing %d x %d to %d x %d x %d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
316 
317               if( gDebugTrace )
318               {
319                 if (reverse)
320                   log_info( "   at max size %d,%d,%d to %d,%d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height );
321                 else
322                   log_info( "   at max size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
323               }
324               int ret;
325               if( reverse )
326                 ret = test_copy_image_size_2D_2D_array( context, queue, &dstImageInfo, &srcImageInfo, seed );
327               else
328                 ret = test_copy_image_size_2D_2D_array( context, queue, &srcImageInfo, &dstImageInfo, seed );
329               if( ret )
330                 return -1;
331             }
332             else
333             {
334               if (reverse)
335                 log_info("Not testing max size %d x %d x %d to %d x %d due to memory constraints.\n",
336                 (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height);
337               else
338                 log_info("Not testing max size %d x %d to %d x %d x %d due to memory constraints.\n",
339                 (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize);
340             }
341 
342           }
343         }
344     }
345     else
346     {
347         for( int i = 0; i < NUM_IMAGE_ITERATIONS; i++ )
348         {
349             cl_ulong srcSize, dstSize;
350             size_t rowPadding = gEnablePitch ? 256 : 0;
351             size_t slicePadding = gEnablePitch ? 3 : 0;
352             // Loop until we get a size that a) will fit in the max alloc size and b) that an allocation of that
353             // image, the result array, plus offset arrays, will fit in the global ram space
354             do
355             {
356                 dstImageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
357                 dstImageInfo.height = (size_t)random_log_in_range( 16, (int)maxHeight / 32, seed );
358                 dstImageInfo.arraySize = (size_t)random_log_in_range( 16, (int)maxArraySize / 32, seed );
359                 srcImageInfo.width = (size_t)random_log_in_range( 16, (int)maxWidth / 32, seed );
360                 srcImageInfo.height = (size_t)random_log_in_range( 16, (int)maxHeight / 32, seed );
361 
362                 if (gTestMipmaps)
363                 {
364                     srcImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(srcImageInfo.width, srcImageInfo.height, 0), seed);
365                     srcImageInfo.type = CL_MEM_OBJECT_IMAGE2D;
366                     dstImageInfo.num_mip_levels = (cl_uint) random_log_in_range(2, (int)compute_max_mip_levels(dstImageInfo.width, dstImageInfo.height, 0), seed);
367                     dstImageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
368                     srcImageInfo.rowPitch = srcImageInfo.width * get_pixel_size( srcImageInfo.format );
369                     srcImageInfo.slicePitch = 0;
370                     dstImageInfo.rowPitch = dstImageInfo.width * get_pixel_size( dstImageInfo.format );
371                     dstImageInfo.slicePitch = dstImageInfo.rowPitch * dstImageInfo.height;
372                     srcSize = 4 * compute_mipmapped_image_size( srcImageInfo );
373                     dstSize = 4 * compute_mipmapped_image_size( dstImageInfo );
374                 }
375                 else
376                 {
377                     set_image_dimensions( &srcImageInfo, srcImageInfo.width, srcImageInfo.height, 0, rowPadding, slicePadding );
378                     set_image_dimensions( &dstImageInfo, dstImageInfo.width, dstImageInfo.height, dstImageInfo.arraySize, rowPadding, slicePadding );
379 
380                     srcSize = (cl_ulong)srcImageInfo.rowPitch * (cl_ulong)srcImageInfo.height * 4;
381                     dstSize = (cl_ulong)dstImageInfo.slicePitch * (cl_ulong)dstImageInfo.arraySize * 4;
382                 }
383             } while( srcSize > maxAllocSize || ( srcSize * 3 ) > memSize || dstSize > maxAllocSize || ( dstSize * 3 ) > memSize);
384 
385             if( gDebugTrace )
386             {
387                 if (reverse)
388                     log_info( "   at size %d,%d,%d to %d,%d\n", (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize, (int)srcImageInfo.width, (int)srcImageInfo.height );
389                 else
390                     log_info( "   at size %d,%d to %d,%d,%d\n", (int)srcImageInfo.width, (int)srcImageInfo.height, (int)dstImageInfo.width, (int)dstImageInfo.height, (int)dstImageInfo.arraySize );
391             }
392             int ret;
393             if( reverse )
394                 ret = test_copy_image_size_2D_2D_array( context, queue, &dstImageInfo, &srcImageInfo, seed );
395             else
396                 ret = test_copy_image_size_2D_2D_array( context, queue, &srcImageInfo, &dstImageInfo, seed );
397             if( ret )
398                 return -1;
399         }
400     }
401 
402     return 0;
403 }
404