xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/CLExtensions.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2021 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // CLExtensions.h: Defines the rx::CLExtensions struct.
7 
8 #ifndef LIBANGLE_RENDERER_CLEXTENSIONS_H_
9 #define LIBANGLE_RENDERER_CLEXTENSIONS_H_
10 
11 #include "libANGLE/renderer/cl_types.h"
12 
13 namespace rx
14 {
15 
16 struct CLExtensions
17 {
18     CLExtensions();
19     ~CLExtensions();
20 
21     CLExtensions(const CLExtensions &)            = delete;
22     CLExtensions &operator=(const CLExtensions &) = delete;
23 
24     CLExtensions(CLExtensions &&);
25     CLExtensions &operator=(CLExtensions &&);
26 
27     void initializeExtensions(std::string &&extensionStr);
28     void initializeVersionedExtensions(const NameVersionVector &versionedExtList);
29 
30     std::string versionStr;
31     cl_version version = 0u;
32 
33     std::string extensions;
34     NameVersionVector extensionsWithVersion;
35 
36     // These Khronos extension names must be returned by all devices that support OpenCL 1.1.
37     bool khrByteAddressableStore       = false;  // cl_khr_byte_addressable_store
38     bool khrGlobalInt32BaseAtomics     = false;  // cl_khr_global_int32_base_atomics
39     bool khrGlobalInt32ExtendedAtomics = false;  // cl_khr_global_int32_extended_atomics
40     bool khrLocalInt32BaseAtomics      = false;  // cl_khr_local_int32_base_atomics
41     bool khrLocalInt32ExtendedAtomics  = false;  // cl_khr_local_int32_extended_atomics
42 
43     // These Khronos extension names must be returned by all devices that support
44     // OpenCL 2.0, OpenCL 2.1, or OpenCL 2.2. For devices that support OpenCL 3.0, these
45     // extension names must be returned when and only when the optional feature is supported.
46     bool khr3D_ImageWrites     = false;  // cl_khr_3d_image_writes
47     bool khrDepthImages        = false;  // cl_khr_depth_images
48     bool khrImage2D_FromBuffer = false;  // cl_khr_image2d_from_buffer
49 
50     // Optional extensions
51     bool khrExtendedVersioning   = false;  // cl_khr_extended_versioning
52     bool khrFP64                 = false;  // cl_khr_fp64
53     bool khrICD                  = false;  // cl_khr_icd
54     bool khrInt64BaseAtomics     = false;  // cl_khr_int64_base_atomics
55     bool khrInt64ExtendedAtomics = false;  // cl_khr_int64_extended_atomics
56 };
57 
58 }  // namespace rx
59 
60 #endif  // LIBANGLE_RENDERER_CLEXTENSIONS_H_
61