summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Martin <edb+piglit@sigluy.net>2016-05-06 13:11:52 +0200
committerSerge Martin <edb+piglit@sigluy.net>2016-05-09 11:05:28 +0200
commitdb62e27e148e3db6e4f401caadc9c5bbdc17796a (patch)
tree2136f25d0c16d80ba7fba004376aec497b0af5f4
parent652db1d1511ac304371e60cb6abe3cfeb6b41bf6 (diff)
cl: check for image support using util/ functions
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
-rw-r--r--tests/cl/api/create-image.c19
-rw-r--r--tests/cl/api/create-sampler.c18
-rw-r--r--tests/cl/api/enqueue-fill-image.c10
-rw-r--r--tests/cl/api/get-image-info.c19
-rw-r--r--tests/cl/api/set-kernel-arg.c18
5 files changed, 5 insertions, 79 deletions
diff --git a/tests/cl/api/create-image.c b/tests/cl/api/create-image.c
index 1ee5f71f9..29e552c60 100644
--- a/tests/cl/api/create-image.c
+++ b/tests/cl/api/create-image.c
@@ -38,23 +38,6 @@ PIGLIT_CL_API_TEST_CONFIG_BEGIN
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) {
- free(image_support);
- return true;
- }
-
- free(image_support);
- }
- return false;
-}
-
static void
no_image_check_invalid(
cl_int errcode_ret,
@@ -107,7 +90,7 @@ piglit_cl_test(const int argc,
const struct piglit_cl_api_test_config* config,
const struct piglit_cl_api_test_env* env)
{
- if (!context_has_image_support(env->context)) {
+ if (!piglit_cl_get_context_image_support(env->context)) {
return no_image_tests(env);
} else {
return PIGLIT_PASS;
diff --git a/tests/cl/api/create-sampler.c b/tests/cl/api/create-sampler.c
index dcdef05ed..d51fe478f 100644
--- a/tests/cl/api/create-sampler.c
+++ b/tests/cl/api/create-sampler.c
@@ -36,22 +36,6 @@ PIGLIT_CL_API_TEST_CONFIG_BEGIN
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) {
- free(image_support);
- return true;
- }
- free(image_support);
- }
- return false;
-}
-
static enum piglit_result
no_image_tests(const struct piglit_cl_api_test_env* env)
{
@@ -80,7 +64,7 @@ piglit_cl_test(const int argc,
const struct piglit_cl_api_test_config* config,
const struct piglit_cl_api_test_env* env)
{
- if (!context_has_image_support(env->context)) {
+ if (!piglit_cl_get_context_image_support(env->context)) {
return no_image_tests(env);
} else {
return PIGLIT_PASS;
diff --git a/tests/cl/api/enqueue-fill-image.c b/tests/cl/api/enqueue-fill-image.c
index 2839b6711..4de5dcaf3 100644
--- a/tests/cl/api/enqueue-fill-image.c
+++ b/tests/cl/api/enqueue-fill-image.c
@@ -104,19 +104,11 @@ piglit_cl_test(const int argc,
cl_command_queue queue = env->context->command_queues[0];
int i;
- cl_bool *image_support =
- piglit_cl_get_device_info(env->context->device_ids[0],
- CL_DEVICE_IMAGE_SUPPORT);
-
- if (!*image_support) {
+ if (!piglit_cl_get_device_image_support(env->context->device_ids[0])) {
fprintf(stderr, "No image support\n");
- free(image_support);
return PIGLIT_SKIP;
}
- free(image_support);
- image_support = NULL;
-
img_format.image_channel_order = CL_RGBA;
img_format.image_channel_data_type = CL_UNSIGNED_INT8;
img_desc.image_type = CL_MEM_OBJECT_IMAGE2D;
diff --git a/tests/cl/api/get-image-info.c b/tests/cl/api/get-image-info.c
index a8b5becff..d4dc842be 100644
--- a/tests/cl/api/get-image-info.c
+++ b/tests/cl/api/get-image-info.c
@@ -46,23 +46,6 @@ PIGLIT_CL_API_TEST_CONFIG_BEGIN
PIGLIT_CL_API_TEST_CONFIG_END
-static bool context_has_image_support(const piglit_cl_context ctx)
-{
- int ret = 0;
- 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)
- ret |= *image_support;
-
- free(image_support);
- }
- return ret;
-}
-
-
enum piglit_result
piglit_cl_test(const int argc,
const char** argv,
@@ -79,7 +62,7 @@ piglit_cl_test(const int argc,
.image_channel_data_type = CL_FLOAT,
};
- if (!context_has_image_support(env->context)) {
+ if (!piglit_cl_get_context_image_support(env->context)) {
fprintf(stderr, "No device with image support found!\n");
return PIGLIT_SKIP;
}
diff --git a/tests/cl/api/set-kernel-arg.c b/tests/cl/api/set-kernel-arg.c
index 0d476e363..9b5a567b8 100644
--- a/tests/cl/api/set-kernel-arg.c
+++ b/tests/cl/api/set-kernel-arg.c
@@ -59,22 +59,6 @@ PIGLIT_CL_API_TEST_CONFIG_BEGIN
PIGLIT_CL_API_TEST_CONFIG_END
-static bool
-get_device_image_support(cl_device_id device)
-{
- cl_bool *has_image =
- piglit_cl_get_device_info(device, CL_DEVICE_IMAGE_SUPPORT);
-
- if (!*has_image) {
- fprintf(stdout, "No image support. Sampler arg won't be tested\n");
- free(has_image);
- return false;
- }
-
- free(has_image);
- return true;
-}
-
static void
test (cl_kernel kernel,
cl_uint arg_index,
@@ -126,7 +110,7 @@ piglit_cl_test(const int argc,
cl_mem invalid_buffer;
cl_bool image_support =
- get_device_image_support(env->context->device_ids[0]);
+ piglit_cl_get_device_image_support(env->context->device_ids[0]);
/*** Normal usage ***/
kernel = clCreateKernel(env->program, "kernel_fun", &errNo);