The only test is for devices without image support. --- tests/cl.py | 1 + tests/cl/api/CMakeLists.cl.txt | 1 + tests/cl/api/create-sampler.c | 86 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 tests/cl/api/create-sampler.c
diff --git a/tests/cl.py b/tests/cl.py index 187022d..fd698fc 100644 --- a/tests/cl.py +++ b/tests/cl.py @@ -65,6 +65,7 @@ add_plain_test(api, 'clGetCommandQueueInfo', ['cl-api-get-command-queue-info']) # Memory objects add_plain_test(api, 'clCreateBuffer', ['cl-api-create-buffer']) add_plain_test(api, 'clCreateImage', ['cl-api-create-image']) +add_plain_test(api, 'clCreateSampler', ['cl-api-create-sampler']) add_plain_test(api, 'clEnqueueCopyBuffer', ['cl-api-enqueue-copy-buffer']) add_plain_test(api, 'clEnqueueCopyBufferRect', ['cl-api-enqueue-copy-buffer-rect']) add_plain_test(api, 'clEnqueueReadBuffer and clEnqueueWriteBuffer', ['cl-api-enqueue-read_write-buffer']) diff --git a/tests/cl/api/CMakeLists.cl.txt b/tests/cl/api/CMakeLists.cl.txt index 2386eb2..460c8ac 100644 --- a/tests/cl/api/CMakeLists.cl.txt +++ b/tests/cl/api/CMakeLists.cl.txt @@ -16,6 +16,7 @@ piglit_cl_add_api_test (retain_release-command-queue retain_release-command-queu # Memory objects piglit_cl_add_api_test (create-buffer create-buffer.c) piglit_cl_add_api_test (create-image create-image.c) +piglit_cl_add_api_test (create-sampler create-sampler.c) piglit_cl_add_api_test (enqueue-copy-buffer enqueue-copy-buffer.c) piglit_cl_add_api_test (enqueue-map-buffer enqueue-map-buffer.c) piglit_cl_add_api_test (enqueue-copy-buffer-rect enqueue-copy-buffer-rect.c) diff --git a/tests/cl/api/create-sampler.c b/tests/cl/api/create-sampler.c new file mode 100644 index 0000000..cce5f87 --- /dev/null +++ b/tests/cl/api/create-sampler.c @@ -0,0 +1,86 @@ +/* + * Copyright 2014 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: Tom Stellard <[email protected]> + * + */ + +#include "piglit-framework-cl-api.h" + +PIGLIT_CL_API_TEST_CONFIG_BEGIN + + config.name = "clCreateSampler"; + config.version_min = 10; + + config.run_per_platform = true; + config.create_context = true; + +PIGLIT_CL_API_TEST_CONFIG_END + +static bool context_has_image_support(const piglit_cl_context ctx) +{ + unsigned i; + for(i = 0; i < ctx->num_devices; i++) { + int *image_support = + piglit_cl_get_device_info(ctx->device_ids[i], + CL_DEVICE_IMAGE_SUPPORT); + if (*image_support) { + return true; + } + } + return false; +} + +static enum piglit_result +no_image_tests(const struct piglit_cl_api_test_env* env) +{ + enum piglit_result result = PIGLIT_PASS; + cl_context cl_ctx = env->context->cl_ctx; + cl_bool normalized_coords = false; + cl_addressing_mode addressing_mode = CL_ADDRESS_NONE; + cl_filter_mode filter_mode = CL_FILTER_NEAREST; + cl_int errcode_ret; + + clCreateSampler(cl_ctx, normalized_coords, addressing_mode, filter_mode, + &errcode_ret); + + if (!piglit_cl_check_error(errcode_ret, CL_INVALID_OPERATION)) { + fprintf(stderr, "clCreateSampler: CL_INVALID_OPERATION " + "expected when no devices support images.\n"); + piglit_merge_result(&result, PIGLIT_FAIL); + } + + return result; +} + +enum piglit_result +piglit_cl_test(const int argc, + const char **argv, + const struct piglit_cl_api_test_config* config, + const struct piglit_cl_api_test_env* env) +{ + if (!context_has_image_support(env->context)) { + return no_image_tests(env); + } else { + return PIGLIT_PASS; + } +} -- 1.8.1.5 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
