[Piglit] [PATCH 1/2] cl: add image support checking functions
Serge Martin
edb+piglit at sigluy.net
Fri May 6 11:11:51 UTC 2016
---
tests/util/piglit-util-cl.c | 28 ++++++++++++++++++++++++++++
tests/util/piglit-util-cl.h | 18 ++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
index efa289c..51d6808 100644
--- a/tests/util/piglit-util-cl.c
+++ b/tests/util/piglit-util-cl.c
@@ -1004,6 +1004,34 @@ piglit_cl_read_whole_buffer(cl_command_queue command_queue, cl_mem buffer,
return success;
}
+bool
+piglit_cl_get_context_image_support(const piglit_cl_context context)
+{
+ bool ret = false;
+
+ unsigned i;
+ for(i = 0; i < context->num_devices; i++)
+ ret |= piglit_cl_get_device_image_support(context->device_ids[i]);
+
+ return ret;
+}
+
+bool
+piglit_cl_get_device_image_support(cl_device_id device)
+{
+ bool ret = false;
+
+ cl_bool *image_support =
+ piglit_cl_get_device_info(device, CL_DEVICE_IMAGE_SUPPORT);
+
+ if (image_support)
+ ret = *image_support;
+
+ free(image_support);
+
+ return ret;
+}
+
cl_mem
piglit_cl_create_image(piglit_cl_context context, cl_mem_flags flags,
const cl_image_format *format,
diff --git a/tests/util/piglit-util-cl.h b/tests/util/piglit-util-cl.h
index 0330740..e4730cc 100644
--- a/tests/util/piglit-util-cl.h
+++ b/tests/util/piglit-util-cl.h
@@ -545,6 +545,24 @@ typedef struct {
} piglit_image_desc;
#endif
+/**
+ * \brief Get context image support.
+ *
+ * @param context Context on which to create image.
+ * @return True if there is one device with image support.
+ */
+bool
+piglit_cl_get_context_image_support(const piglit_cl_context context);
+
+/**
+ * \brief Get device image support.
+ *
+ * @param device Context on which to create image.
+ * @return True if there the device has image support.
+ */
+bool
+piglit_cl_get_device_image_support(cl_device_id device);
+
/**
* \brief Create an image.
--
2.5.5
More information about the Piglit
mailing list