1 /*
2  * Copyright (C) 2018-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #pragma once
9 #include "shared/source/gmm_helper/gmm_lib.h"
10 #include "shared/source/helpers/surface_format_info.h"
11 #include "shared/source/utilities/arrayref.h"
12 
13 #include "CL/cl.h"
14 
15 namespace NEO {
16 
17 struct ClSurfaceFormatInfo {
18     cl_image_format OCLImageFormat;
19     SurfaceFormatInfo surfaceFormat;
20 };
21 
22 class SurfaceFormats {
23   private:
24     static const ClSurfaceFormatInfo readOnlySurfaceFormats12[];
25     static const ClSurfaceFormatInfo readOnlySurfaceFormats20[];
26     static const ClSurfaceFormatInfo writeOnlySurfaceFormats[];
27     static const ClSurfaceFormatInfo readWriteSurfaceFormats[];
28     static const ClSurfaceFormatInfo readOnlyDepthSurfaceFormats[];
29     static const ClSurfaceFormatInfo readWriteDepthSurfaceFormats[];
30 
31     static const ClSurfaceFormatInfo packedYuvSurfaceFormats[];
32     static const ClSurfaceFormatInfo planarYuvSurfaceFormats[];
33     static const ClSurfaceFormatInfo packedSurfaceFormats[];
34 
35   public:
36     static ArrayRef<const ClSurfaceFormatInfo> readOnly12() noexcept;
37     static ArrayRef<const ClSurfaceFormatInfo> readOnly20() noexcept;
38     static ArrayRef<const ClSurfaceFormatInfo> writeOnly() noexcept;
39     static ArrayRef<const ClSurfaceFormatInfo> readWrite() noexcept;
40     static ArrayRef<const ClSurfaceFormatInfo> packedYuv() noexcept;
41     static ArrayRef<const ClSurfaceFormatInfo> planarYuv() noexcept;
42     static ArrayRef<const ClSurfaceFormatInfo> packed() noexcept;
43     static ArrayRef<const ClSurfaceFormatInfo> readOnlyDepth() noexcept;
44     static ArrayRef<const ClSurfaceFormatInfo> readWriteDepth() noexcept;
45 
46     static ArrayRef<const ClSurfaceFormatInfo> surfaceFormats(cl_mem_flags flags, bool supportsOcl20Features) noexcept;
47     static ArrayRef<const ClSurfaceFormatInfo> surfaceFormats(cl_mem_flags flags, const cl_image_format *imageFormat, bool supportsOcl20Features) noexcept;
48 };
49 
50 } // namespace NEO
51