From: Zhigang Gong Date: Wed, 4 Sep 2013 07:04:03 +0000 (+0800) Subject: Runtime: Only return the format allowed in the spec. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a2fd56bc0982499449f2ea84d7e0d5a3d49ad82;p=contrib%2Fbeignet.git Runtime: Only return the format allowed in the spec. For the CL_INTENSITY and CL_LUMINANCE, it only supports CL_UNORM_INT8,CL_UNORM_INT16, CL_SNORM_INT8, CL_SNORM_INT16, CL_HALF_FLOAT or CL_FLOAT. Signed-off-by: Zhigang Gong Reviewed-by: "Song, Ruiling" --- diff --git a/src/cl_image.c b/src/cl_image.c index 6ea104b..1fe8d08 100644 --- a/src/cl_image.c +++ b/src/cl_image.c @@ -104,6 +104,12 @@ cl_image_get_intel_format(const cl_image_format *fmt) case CL_A: case CL_INTENSITY: case CL_LUMINANCE: + if ((order == CL_INTENSITY || order == CL_LUMINANCE) + && (type != CL_UNORM_INT8 && type != CL_UNORM_INT16 + && type != CL_SNORM_INT8 && type != CL_SNORM_INT16 + && type != CL_HALF_FLOAT && type != CL_FLOAT)) + return INTEL_UNSUPPORTED_FORMAT; + switch (type) { case CL_HALF_FLOAT: return I965_SURFACEFORMAT_R16_FLOAT; case CL_FLOAT: return I965_SURFACEFORMAT_R32_FLOAT;