mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
* imageHelpers: Created generic function that returns a vector of required image formats. An upcoming commit requires access to the vector of required image formats, separatley from check_minimum_supported. * imageHelpers: Added a new function is_image_format_required. This function can be used to determine for any given cl_image_format, whether the implementaion is required to support it. Conditionally test BGRA in Basic readimage3d (#623) This change adds checks to see if testing against an embedded implementation and if so, queries whether BGRA is supported or not. * Refactor based on PR review. * Update passed message code. * Changed scope of struct to be within test_readimage3d.
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#if !defined (_WIN32) && !defined(__APPLE__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#if !defined (_WIN32)
|
||||
@@ -3664,16 +3663,15 @@ bool find_format( cl_image_format *formatList, unsigned int numFormats, cl_image
|
||||
return false;
|
||||
}
|
||||
|
||||
bool check_minimum_supported(cl_image_format *formatList,
|
||||
unsigned int numFormats,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_object_type image_type,
|
||||
cl_device_id device)
|
||||
void build_required_image_formats(cl_mem_flags flags,
|
||||
cl_mem_object_type image_type,
|
||||
cl_device_id device,
|
||||
std::vector<cl_image_format>& formatsToSupport)
|
||||
{
|
||||
bool passed = true;
|
||||
std::vector<cl_image_format> formatsToSupport;
|
||||
Version version = get_device_cl_version(device);
|
||||
|
||||
formatsToSupport.clear();
|
||||
|
||||
// Required embedded formats.
|
||||
static std::vector<cl_image_format> embeddedProfReadOrWriteFormats
|
||||
{
|
||||
@@ -3810,18 +3808,26 @@ bool check_minimum_supported(cl_image_format *formatList,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &format: formatsToSupport)
|
||||
{
|
||||
if( !find_format( formatList, numFormats, &format ) )
|
||||
{
|
||||
log_error( "ERROR: Format required by OpenCL %s is not supported: ", version.to_string().c_str() );
|
||||
print_header( &format, true );
|
||||
passed = false;
|
||||
}
|
||||
}
|
||||
bool is_image_format_required(cl_image_format format,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_object_type image_type,
|
||||
cl_device_id device)
|
||||
{
|
||||
std::vector<cl_image_format> formatsToSupport;
|
||||
build_required_image_formats(flags, image_type, device, formatsToSupport);
|
||||
|
||||
return passed;
|
||||
for (auto &formatItr: formatsToSupport)
|
||||
{
|
||||
if (formatItr.image_channel_order == format.image_channel_order &&
|
||||
formatItr.image_channel_data_type == format.image_channel_data_type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
cl_uint compute_max_mip_levels( size_t width, size_t height, size_t depth)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <unistd.h>
|
||||
@@ -71,11 +72,14 @@ extern void print_read_header( cl_image_format *format, image_sampler_data *samp
|
||||
extern void print_write_header( cl_image_format *format, bool err);
|
||||
extern void print_header( cl_image_format *format, bool err );
|
||||
extern bool find_format( cl_image_format *formatList, unsigned int numFormats, cl_image_format *formatToFind );
|
||||
extern bool check_minimum_supported(cl_image_format *formatList,
|
||||
unsigned int numFormats,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_object_type image_type,
|
||||
cl_device_id device);
|
||||
extern bool is_image_format_required(cl_image_format format,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_object_type image_type,
|
||||
cl_device_id device);
|
||||
extern void build_required_image_formats(cl_mem_flags flags,
|
||||
cl_mem_object_type image_type,
|
||||
cl_device_id device,
|
||||
std::vector<cl_image_format>& formatsToSupport);
|
||||
|
||||
extern size_t get_format_type_size( const cl_image_format *format );
|
||||
extern size_t get_channel_data_type_size( cl_channel_type channelType );
|
||||
|
||||
Reference in New Issue
Block a user