diff options
author | Pan Xiuli <xiuli.pan@intel.com> | 2016-03-03 04:22:44 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-11-08 20:38:22 +0800 |
commit | 2989c03d7d80ae52df2bd428067bd249cb0963b7 (patch) | |
tree | 4bcfb11539bc0448db05eb0e749738aa517bda2d | |
parent | 6f98ade8260824404e2e05c506fc36922bfe66b6 (diff) |
Runtime: Refine clGetSupportedImageFormats to support CL_MEM_FLAGS
sRGB writes are not supported now, and we should not return them
if any write was set as CL_MEM_FLAGS.
Signed-off-by: Pan Xiuli <xiuli.pan@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
-rw-r--r-- | src/cl_api.c | 1 | ||||
-rw-r--r-- | src/cl_image.c | 5 | ||||
-rw-r--r-- | src/cl_image.h | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/src/cl_api.c b/src/cl_api.c index b79c671b..6a72e62d 100644 --- a/src/cl_api.c +++ b/src/cl_api.c @@ -1022,6 +1022,7 @@ clGetSupportedImageFormats(cl_context ctx, goto error; } err = cl_image_get_supported_fmt(ctx, + flags, image_type, num_entries, image_formats, diff --git a/src/cl_image.c b/src/cl_image.c index 47298b6a..d0593044 100644 --- a/src/cl_image.c +++ b/src/cl_image.c @@ -228,6 +228,7 @@ static const size_t cl_image_type_n = SIZEOF32(cl_image_type); cl_int cl_image_get_supported_fmt(cl_context ctx, + cl_mem_flags flags, cl_mem_object_type image_type, cl_uint num_entries, cl_image_format *image_formats, @@ -241,6 +242,10 @@ cl_image_get_supported_fmt(cl_context ctx, .image_channel_data_type = cl_image_type[j] }; const uint32_t intel_fmt = cl_image_get_intel_format(&fmt); + if (cl_image_order[i] >= CL_sRGBA && + ((flags & CL_MEM_WRITE_ONLY) || (flags & CL_MEM_READ_WRITE) || + (flags & CL_MEM_KERNEL_READ_AND_WRITE))) + continue; if (intel_fmt == INTEL_UNSUPPORTED_FORMAT) continue; if (n < num_entries && image_formats) image_formats[n] = fmt; diff --git a/src/cl_image.h b/src/cl_image.h index ae745099..4f0d0f1c 100644 --- a/src/cl_image.h +++ b/src/cl_image.h @@ -35,6 +35,7 @@ extern uint32_t cl_image_get_intel_format(const cl_image_format *fmt); /* Return the list of formats supported by the API */ extern cl_int cl_image_get_supported_fmt(cl_context context, + cl_mem_flags flags, cl_mem_object_type image_type, cl_uint num_entries, cl_image_format *image_formats, |