• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
7 // validationCL.h: Validation functions for generic CL entry point parameters
8 
9 #ifndef LIBANGLE_VALIDATIONCL_H_
10 #define LIBANGLE_VALIDATIONCL_H_
11 
12 #include "libANGLE/CLBuffer.h"
13 #include "libANGLE/CLCommandQueue.h"
14 #include "libANGLE/CLContext.h"
15 #include "libANGLE/CLDevice.h"
16 #include "libANGLE/CLEvent.h"
17 #include "libANGLE/CLImage.h"
18 #include "libANGLE/CLKernel.h"
19 #include "libANGLE/CLMemory.h"
20 #include "libANGLE/CLPlatform.h"
21 #include "libANGLE/CLProgram.h"
22 #include "libANGLE/CLSampler.h"
23 
24 #define ANGLE_CL_VALIDATE_VOID(EP, ...)              \
25     do                                               \
26     {                                                \
27         if (Validate##EP(__VA_ARGS__) != CL_SUCCESS) \
28         {                                            \
29             return;                                  \
30         }                                            \
31     } while (0)
32 
33 #define ANGLE_CL_VALIDATE_ERROR(EP, ...)              \
34     do                                                \
35     {                                                 \
36         cl_int errorCode = Validate##EP(__VA_ARGS__); \
37         if (errorCode != CL_SUCCESS)                  \
38         {                                             \
39             return errorCode;                         \
40         }                                             \
41     } while (0)
42 
43 #define ANGLE_CL_VALIDATE_ERRCODE_RET(EP, ...)        \
44     do                                                \
45     {                                                 \
46         cl_int errorCode = Validate##EP(__VA_ARGS__); \
47         if (errorCode != CL_SUCCESS)                  \
48         {                                             \
49             if (errcode_ret != nullptr)               \
50             {                                         \
51                 *errcode_ret = errorCode;             \
52             }                                         \
53             return nullptr;                           \
54         }                                             \
55     } while (0)
56 
57 #define ANGLE_CL_VALIDATE_POINTER(EP, ...)            \
58     do                                                \
59     {                                                 \
60         cl_int errorCode = Validate##EP(__VA_ARGS__); \
61         if (errorCode != CL_SUCCESS)                  \
62         {                                             \
63             return nullptr;                           \
64         }                                             \
65     } while (0)
66 
67 #endif  // LIBANGLE_VALIDATIONCL_H_
68