LGTM

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf 
Of Zhigang Gong
Sent: Wednesday, September 04, 2013 3:07 PM
To: [email protected]
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 <[email protected]>
---
 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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to