From 0d74b3f926e547b2ae6d13de55b16aa5a6711265 Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Fri, 15 Jan 2021 17:31:03 +0100 Subject: [PATCH] Test api fix - sampler properties is 0 in compatibility mode (#1106) --- test_conformance/api/test_queries.cpp | 42 ++++++++++++++++++--------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/test_conformance/api/test_queries.cpp b/test_conformance/api/test_queries.cpp index 91678a20..469a1934 100644 --- a/test_conformance/api/test_queries.cpp +++ b/test_conformance/api/test_queries.cpp @@ -231,23 +231,39 @@ int test_sampler_params(cl_device_id deviceID, cl_context context, error, "clGetSamplerInfo failed asking for CL_SAMPLER_PROPERTIES size."); - if (set_size != test_properties.size() * sizeof(cl_sampler_properties)) + if (is_compatibility) { - log_error("ERROR: CL_SAMPLER_PROPERTIES size is %d, expected %d.\n", - set_size, - test_properties.size() * sizeof(cl_sampler_properties)); - return TEST_FAIL; + if (set_size != 0) + { + log_error( + "ERROR: CL_SAMPLER_PROPERTIES size is %d, expected 0\n", + set_size); + return TEST_FAIL; + } } + else + { + if (set_size + != test_properties.size() * sizeof(cl_sampler_properties)) + { + log_error( + "ERROR: CL_SAMPLER_PROPERTIES size is %d, expected %d.\n", + set_size, + test_properties.size() * sizeof(cl_sampler_properties)); + return TEST_FAIL; + } - cl_uint number_of_props = set_size / sizeof(cl_sampler_properties); - check_properties.resize(number_of_props); - error = clGetSamplerInfo(sampler, CL_SAMPLER_PROPERTIES, set_size, - check_properties.data(), 0); - test_error(error, - "clGetSamplerInfo failed asking for CL_SAMPLER_PROPERTIES."); + cl_uint number_of_props = set_size / sizeof(cl_sampler_properties); + check_properties.resize(number_of_props); + error = clGetSamplerInfo(sampler, CL_SAMPLER_PROPERTIES, set_size, + check_properties.data(), 0); + test_error( + error, + "clGetSamplerInfo failed asking for CL_SAMPLER_PROPERTIES."); - error = compareProperties(check_properties, test_properties); - test_error(error, "checkProperties mismatch."); + error = compareProperties(check_properties, test_properties); + test_error(error, "checkProperties mismatch."); + } } return 0; }