1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef FRAMEWORKS_OPENGL_WRAPPER_HOOK_H
16 #define FRAMEWORKS_OPENGL_WRAPPER_HOOK_H
17 
18 #include <EGL/egl.h>
19 #include <EGL/eglext.h>
20 #include <GLES3/gl3.h>
21 #include <GLES3/gl31.h>
22 #include <GLES3/gl32.h>
23 #include <GLES2/gl2.h>
24 #include <GLES2/gl2ext.h>
25 #include <GLES/gl.h>
26 #include <GLES/glext.h>
27 
28 namespace OHOS {
29 #undef CALL_HOOK_API
30 #define CALL_HOOK_API(...)
31 #undef CALL_HOOK_API_RET
32 #define CALL_HOOK_API_RET CALL_HOOK_API
33 #undef HOOK_API_ENTRY
34 #define HOOK_API_ENTRY(r, api, ...) r (*(api))(__VA_ARGS__);
35 
36 constexpr int32_t EGL_API_NUM = 100;
37 constexpr int32_t GL_API_NUM = 1000;
38 
39 // for compatibility, if xxx_entries.in file modified, the value of g_entriesFilesVersion must be increased by 1.
40 constexpr uint64_t ENTRIES_FILES_VERSION = 1;
41 
42 struct WrapperHookTable {
43     #include "wrapper_hook_entries.in"
44 };
45 
46 struct EglHookTable {
47     #include "egl_hook_entries.in"
48 };
49 
50 struct GlHookTable1 {
51     #include "gl1_hook_entries.in"
52 };
53 
54 struct GlHookTable2 {
55     #include "gl2_hook_entries.in"
56 };
57 
58 struct GlHookTable3 {
59     #include "gl3_hook_entries.in"
60 };
61 
62 struct GlHookTable {
63     GlHookTable1 table1;
64     GlHookTable2 table2;
65     GlHookTable3 table3;
66 };
67 } // namespace OHOS
68 #endif // FRAMEWORKS_OPENGL_WRAPPER_HOOK_H
69