2 * Copyright (C) 2011 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "OpenGLESDispatch/RenderEGL_functions.h"
19 #include "OpenGLESDispatch/RenderEGL_extensions_functions.h"
21 // This header is used to define the EGLDispatch structure that contains
22 // pointers to the EGL shared library used by libOpenglRender. Normally,
23 // this will be our own libEGL_translator, but one could imagine a
24 // vendor-specific being used instead.
26 // There is a single global instance of this structure, named |s_egl|,
27 // which must be initialized by calling init_egl_dispatch() before use.
29 // Note that our code requires the implementation of misc EGL extensions
30 // including eglSetSwapRectangleANDROID(), see RenderEGL_extensions_functions.h
33 #define RENDER_EGL_DEFINE_TYPE(return_type, function_name, signature) \
34 typedef return_type (EGLAPIENTRY *function_name ## _t) signature;
36 #define RENDER_EGL_DECLARE_MEMBER(return_type, function_name, signature) \
37 function_name ## _t function_name;
39 // Define function typedefs.
40 LIST_RENDER_EGL_FUNCTIONS(RENDER_EGL_DEFINE_TYPE)
41 LIST_RENDER_EGL_EXTENSIONS_FUNCTIONS(RENDER_EGL_DEFINE_TYPE)
43 // Define EGLDispatch structure.
45 bool initialized = false;
46 LIST_RENDER_EGL_FUNCTIONS(RENDER_EGL_DECLARE_MEMBER)
47 LIST_RENDER_EGL_EXTENSIONS_FUNCTIONS(RENDER_EGL_DECLARE_MEMBER)
50 // Initialize EGLDispatch function. Return true on success, false on failure.
51 bool init_egl_dispatch(const char *path);
53 // Global EGLDispatch instance. Call init_egl_dispatch() before using it.
54 extern EGLDispatch s_egl;