[Beignet] [PATCH 2/5] Runtime: disable some unecessary image formats.

Zhigang Gong zhigang.gong at linux.intel.com
Thu Sep 5 22:43:04 PDT 2013


Per OpenCL, the minimum list of supported format is as below:
CL_RGBA:
  CL_UNORM_INT8
  CL_UNORM_INT16
  CL_SIGNED_INT8
  CL_SIGNED_INT16
  CL_SIGNED_INT32
  CL_UNSIGNED_INT8
  CL_UNSIGNED_INT16
  CL_UNSIGNED_INT32
  CL_HALF_FLOAT
  CL_FLOAT

CL_BGRA:
  CL_UNORM_INT8

Let's only support this type and CL_R currently.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/cl_image.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/cl_image.c b/src/cl_image.c
index 1fe8d08..e7194f4 100644
--- a/src/cl_image.c
+++ b/src/cl_image.c
@@ -101,6 +101,8 @@ cl_image_get_intel_format(const cl_image_format *fmt)
   const uint32_t order = fmt->image_channel_order;
   switch (order) {
     case CL_R:
+#if 0
+    case CL_Rx:
     case CL_A:
     case CL_INTENSITY:
     case CL_LUMINANCE:
@@ -109,12 +111,13 @@ cl_image_get_intel_format(const cl_image_format *fmt)
               && type != CL_SNORM_INT8 && type != CL_SNORM_INT16
               && type != CL_HALF_FLOAT && type != CL_FLOAT))
         return INTEL_UNSUPPORTED_FORMAT;
+#endif
 
       switch (type) {
         case CL_HALF_FLOAT:     return I965_SURFACEFORMAT_R16_FLOAT;
         case CL_FLOAT:          return I965_SURFACEFORMAT_R32_FLOAT;
-        case CL_SNORM_INT16:    return I965_SURFACEFORMAT_R16_SNORM;
-        case CL_SNORM_INT8:     return I965_SURFACEFORMAT_R8_SNORM;
+//        case CL_SNORM_INT16:    return I965_SURFACEFORMAT_R16_SNORM;
+//        case CL_SNORM_INT8:     return I965_SURFACEFORMAT_R8_SNORM;
         case CL_UNORM_INT8:     return I965_SURFACEFORMAT_R8_UNORM;
         case CL_UNORM_INT16:    return I965_SURFACEFORMAT_R16_UNORM;
         case CL_SIGNED_INT8:    return I965_SURFACEFORMAT_R8_SINT;
@@ -125,14 +128,14 @@ cl_image_get_intel_format(const cl_image_format *fmt)
         case CL_UNSIGNED_INT32: return I965_SURFACEFORMAT_R32_UINT;
         default: return INTEL_UNSUPPORTED_FORMAT;
       };
+#if 0
     case CL_RG:
     case CL_RA:
-    case CL_Rx:
       switch (type) {
         case CL_HALF_FLOAT:     return I965_SURFACEFORMAT_R16G16_FLOAT;
         case CL_FLOAT:          return I965_SURFACEFORMAT_R32G32_FLOAT;
-        case CL_SNORM_INT16:    return I965_SURFACEFORMAT_R16G16_SNORM;
-        case CL_SNORM_INT8:     return I965_SURFACEFORMAT_R8G8_SNORM;
+//        case CL_SNORM_INT16:    return I965_SURFACEFORMAT_R16G16_SNORM;
+//        case CL_SNORM_INT8:     return I965_SURFACEFORMAT_R8G8_SNORM;
         case CL_UNORM_INT8:     return I965_SURFACEFORMAT_R8G8_UNORM;
         case CL_UNORM_INT16:    return I965_SURFACEFORMAT_R16G16_UNORM;
         case CL_SIGNED_INT8:    return I965_SURFACEFORMAT_R8G8_SINT;
@@ -151,12 +154,13 @@ cl_image_get_intel_format(const cl_image_format *fmt)
         case CL_UNORM_SHORT_555:
         default: return INTEL_UNSUPPORTED_FORMAT;
       };
+#endif
     case CL_RGBA:
       switch (type) {
         case CL_HALF_FLOAT:     return I965_SURFACEFORMAT_R16G16B16A16_FLOAT;
         case CL_FLOAT:          return I965_SURFACEFORMAT_R32G32B32A32_FLOAT;
-        case CL_SNORM_INT16:    return I965_SURFACEFORMAT_R16G16B16A16_SNORM;
-        case CL_SNORM_INT8:     return I965_SURFACEFORMAT_R8G8B8A8_SNORM;
+//        case CL_SNORM_INT16:    return I965_SURFACEFORMAT_R16G16B16A16_SNORM;
+//        case CL_SNORM_INT8:     return I965_SURFACEFORMAT_R8G8B8A8_SNORM;
         case CL_UNORM_INT8:     return I965_SURFACEFORMAT_R8G8B8A8_UNORM;
         case CL_UNORM_INT16:    return I965_SURFACEFORMAT_R16G16B16A16_UNORM;
         case CL_SIGNED_INT8:    return I965_SURFACEFORMAT_R8G8B8A8_SINT;
-- 
1.7.9.5



More information about the Beignet mailing list