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 #ifdef OPENGL_WRAPPER_ENABLE_GL4 28 #include <GL/gl.h> 29 #include <GL/glcorearb.h> 30 #include <GL/glext.h> 31 #endif 32 33 namespace OHOS { 34 #undef CALL_HOOK_API 35 #define CALL_HOOK_API(...) 36 #undef CALL_HOOK_API_RET 37 #define CALL_HOOK_API_RET CALL_HOOK_API 38 #undef HOOK_API_ENTRY 39 #define HOOK_API_ENTRY(r, api, ...) r (*(api))(__VA_ARGS__); 40 41 constexpr int32_t EGL_API_NUM = 100; 42 constexpr int32_t GLES_API_NUM = 1000; 43 #ifdef OPENGL_WRAPPER_ENABLE_GL4 44 constexpr int32_t OPENGL_API_NUM = 3000; 45 #endif 46 47 // for compatibility, if xxx_entries.in file modified, the value of g_entriesFilesVersion must be increased by 1. 48 constexpr uint64_t ENTRIES_FILES_VERSION = 1; 49 50 struct WrapperHookTable { 51 #include "wrapper_hook_entries.in" 52 }; 53 54 struct EglHookTable { 55 #include "egl_hook_entries.in" 56 }; 57 58 struct GlHookTable1 { 59 #include "gl1_hook_entries.in" 60 }; 61 62 struct GlHookTable2 { 63 #include "gl2_hook_entries.in" 64 }; 65 66 struct GlHookTable3 { 67 #include "gl3_hook_entries.in" 68 }; 69 70 #ifdef OPENGL_WRAPPER_ENABLE_GL4 71 struct GlHookTable4 { 72 #include "gl4_hook_entries.in" 73 }; 74 #endif 75 76 77 struct GlHookTable { 78 GlHookTable1 table1; 79 GlHookTable2 table2; 80 GlHookTable3 table3; 81 #ifdef OPENGL_WRAPPER_ENABLE_GL4 82 GlHookTable4 table4; 83 #endif 84 }; 85 } // namespace OHOS 86 #endif // FRAMEWORKS_OPENGL_WRAPPER_HOOK_H 87