Conditionally test BGRA in Basic readimage3d (#623) (#624)

* 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:
Kévin Petit
2020-03-05 18:47:51 +00:00
committed by GitHub
parent e62cd4a2b9
commit 4c5a8fff6d
4 changed files with 145 additions and 127 deletions

View File

@@ -14,6 +14,9 @@
// limitations under the License.
//
#include "../testBase.h"
#include "harness/imageHelpers.h"
#include <algorithm>
#include <iterator>
extern cl_filter_mode gFilterModeToUse;
extern cl_addressing_mode gAddressModeToUse;
@@ -36,6 +39,30 @@ static const char *str_3d_image = "3D";
static const char *str_1d_image_array = "1D array";
static const char *str_2d_image_array = "2D array";
static 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)
{
bool passed = true;
Version version = get_device_cl_version(device);
std::vector<cl_image_format> formatsToSupport;
build_required_image_formats(flags, image_type, device, formatsToSupport);
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;
}
}
return passed;
}
static const char *convert_image_type_to_string(cl_mem_object_type image_type)
{
const char *p;