mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Raw10/12 CTS tests (#1830)
Add support for cl_ext_image_raw10_raw12 testing on test_image_streams. Signed-off-by: John Kesapides <john.kesapides@arm.com>
This commit is contained in:
@@ -16,6 +16,7 @@ set(${MODULE_NAME}_SOURCES
|
||||
test_write_3D.cpp
|
||||
test_cl_ext_image_requirements_info.cpp
|
||||
test_cl_ext_image_from_buffer.cpp
|
||||
test_cl_ext_image_raw10_raw12.cpp
|
||||
../common.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -89,6 +89,8 @@ extern int image_from_buffer_fill_positive(cl_device_id device,
|
||||
extern int image_from_buffer_read_positive(cl_device_id device,
|
||||
cl_context context,
|
||||
cl_command_queue queue);
|
||||
extern int ext_image_raw10_raw12(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue);
|
||||
|
||||
/** read_write images only support sampler-less read buildt-ins which require special settings
|
||||
* for some global parameters. This pair of functions temporarily overwrite those global parameters
|
||||
@@ -367,6 +369,12 @@ int test_image_from_buffer_read_positive(cl_device_id device,
|
||||
return image_from_buffer_read_positive(device, context, queue);
|
||||
}
|
||||
|
||||
int test_cl_ext_image_raw10_raw12(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, int num_elements)
|
||||
{
|
||||
return ext_image_raw10_raw12(device, context, queue);
|
||||
}
|
||||
|
||||
test_definition test_list[] = {
|
||||
ADD_TEST(1D),
|
||||
ADD_TEST(2D),
|
||||
@@ -385,6 +393,7 @@ test_definition test_list[] = {
|
||||
ADD_TEST_VERSION(image_from_small_buffer_negative, Version(3, 0)),
|
||||
ADD_TEST_VERSION(image_from_buffer_fill_positive, Version(3, 0)),
|
||||
ADD_TEST_VERSION(image_from_buffer_read_positive, Version(3, 0)),
|
||||
ADD_TEST_VERSION(cl_ext_image_raw10_raw12, Version(1, 2)),
|
||||
};
|
||||
|
||||
const int test_num = ARRAY_SIZE( test_list );
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// Copyright (c) 2023 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#include "../testBase.h"
|
||||
#include "../common.h"
|
||||
#include "test_cl_ext_image_buffer.hpp"
|
||||
|
||||
extern int gTypesToTest;
|
||||
extern int gtestTypesToRun;
|
||||
extern bool gTestImage2DFromBuffer;
|
||||
extern cl_mem_flags gMemFlagsToUse;
|
||||
|
||||
static int test_image_set(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, cl_mem_object_type imageType)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
// Grab the list of supported image formats for integer reads
|
||||
std::vector<cl_image_format> formatList = {
|
||||
{ CL_R, CL_UNSIGNED_INT_RAW10_EXT }, { CL_R, CL_UNSIGNED_INT_RAW12_EXT }
|
||||
};
|
||||
|
||||
// First time through, we'll go ahead and print the formats supported,
|
||||
// regardless of type
|
||||
log_info("---- Supported %s %s formats for this device for "
|
||||
"cl_ext_image_raw10_raw12---- \n",
|
||||
convert_image_type_to_string(imageType), "read");
|
||||
log_info(" %-7s %-24s %d\n", "CL_R", "CL_UNSIGNED_INT_RAW10_EXT", 0);
|
||||
log_info(" %-7s %-24s %d\n", "CL_R", "CL_UNSIGNED_INT_RAW12_EXT", 0);
|
||||
log_info("------------------------------------------- \n");
|
||||
|
||||
image_sampler_data imageSampler;
|
||||
ImageTestTypes test{ kTestUInt, kUInt, uintFormats, "uint" };
|
||||
if (gTypesToTest & test.type)
|
||||
{
|
||||
std::vector<bool> filterFlags(formatList.size(), false);
|
||||
imageSampler.filter_mode = CL_FILTER_NEAREST;
|
||||
ret = test_read_image_formats(device, context, queue, formatList,
|
||||
filterFlags, &imageSampler,
|
||||
test.explicitType, imageType);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ext_image_raw10_raw12(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (0 == is_extension_available(device, "cl_ext_image_raw10_raw12"))
|
||||
{
|
||||
log_info("-----------------------------------------------------\n");
|
||||
log_info("This device does not support "
|
||||
"cl_ext_image_raw10_raw12.\n");
|
||||
log_info("Skipping cl_ext_image_raw10_raw12 "
|
||||
"image test.\n");
|
||||
log_info("-----------------------------------------------------\n\n");
|
||||
return 0;
|
||||
}
|
||||
gtestTypesToRun = kReadTests;
|
||||
|
||||
ret += test_image_set(device, context, queue, CL_MEM_OBJECT_IMAGE2D);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1663,7 +1663,9 @@ int test_read_image_set_2D(cl_device_id device, cl_context context,
|
||||
{
|
||||
for( imageInfo.width = 1; imageInfo.width < 13; imageInfo.width++ )
|
||||
{
|
||||
imageInfo.rowPitch = imageInfo.width * pixelSize;
|
||||
if (!is_width_compatible(imageInfo)) continue;
|
||||
imageInfo.rowPitch = calculate_row_pitch(imageInfo, pixelSize);
|
||||
|
||||
for( imageInfo.height = 1; imageInfo.height < 9; imageInfo.height++ )
|
||||
{
|
||||
if( gTestMipmaps )
|
||||
@@ -1688,10 +1690,28 @@ int test_read_image_set_2D(cl_device_id device, cl_context context,
|
||||
|
||||
for( size_t idx = 0; idx < numbeOfSizes; idx++ )
|
||||
{
|
||||
imageInfo.width = sizes[ idx ][ 0 ];
|
||||
imageInfo.height = sizes[ idx ][ 1 ];
|
||||
imageInfo.rowPitch = imageInfo.width * pixelSize;
|
||||
log_info("Testing %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ]);
|
||||
if (imageInfo.format->image_channel_data_type
|
||||
== CL_UNSIGNED_INT_RAW10_EXT)
|
||||
{
|
||||
imageInfo.width = sizes[idx][0] & ~0x3ULL;
|
||||
}
|
||||
else if (imageInfo.format->image_channel_data_type
|
||||
== CL_UNSIGNED_INT_RAW12_EXT)
|
||||
{
|
||||
imageInfo.width = sizes[idx][0] & ~0x1ULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
imageInfo.width = sizes[idx][0];
|
||||
}
|
||||
|
||||
imageInfo.height = sizes[idx][1];
|
||||
imageInfo.rowPitch = calculate_row_pitch(imageInfo, pixelSize);
|
||||
|
||||
if (0 == imageInfo.width) continue;
|
||||
|
||||
log_info("Testing %d x %d\n", (int)imageInfo.width,
|
||||
(int)imageInfo.height);
|
||||
|
||||
if( gTestMipmaps )
|
||||
imageInfo.num_mip_levels = (size_t) random_in_range(2, compute_max_mip_levels(imageInfo.width, imageInfo.height, 0)-1, seed);
|
||||
@@ -1759,7 +1779,8 @@ int test_read_image_set_2D(cl_device_id device, cl_context context,
|
||||
imageInfo.width = (size_t)random_log_in_range( 16, maxWidthRange, seed );
|
||||
imageInfo.height = (size_t)random_log_in_range( 16, maxHeightRange, seed );
|
||||
|
||||
imageInfo.rowPitch = imageInfo.width * pixelSize;
|
||||
imageInfo.rowPitch = calculate_row_pitch(imageInfo, pixelSize);
|
||||
|
||||
if( gTestMipmaps )
|
||||
{
|
||||
imageInfo.num_mip_levels = (size_t) random_in_range(2, compute_max_mip_levels(imageInfo.width, imageInfo.height, 0)-1, seed);
|
||||
@@ -1782,7 +1803,8 @@ int test_read_image_set_2D(cl_device_id device, cl_context context,
|
||||
|
||||
size = (size_t)imageInfo.rowPitch * (size_t)imageInfo.height * 4;
|
||||
}
|
||||
} while( size > maxAllocSize || ( size * 3 ) > memSize );
|
||||
} while (size > maxAllocSize || (size * 3) > memSize
|
||||
|| !is_width_compatible(imageInfo));
|
||||
|
||||
if( gDebugTrace )
|
||||
log_info( " at size %d,%d (row pitch %d) out of %d,%d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.rowPitch, (int)maxWidth, (int)maxHeight );
|
||||
|
||||
Reference in New Issue
Block a user