[Beignet] [PATCH] Runtime: Only return the format allowed in the spec.
Song, Ruiling
ruiling.song at intel.com
Wed Sep 4 00:23:26 PDT 2013
LGTM
-----Original Message-----
From: beignet-bounces+ruiling.song=intel.com at lists.freedesktop.org [mailto:beignet-bounces+ruiling.song=intel.com at lists.freedesktop.org] On Behalf Of Zhigang Gong
Sent: Wednesday, September 04, 2013 3:07 PM
To: beignet at lists.freedesktop.org
Cc: Zhigang Gong
Subject: [Beignet] [PATCH] 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 <zhigang.gong at linux.intel.com>
---
src/cl_image.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/cl_image.c b/src/cl_image.c index 6ea104b..6361c76 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;
--
1.7.9.5
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list