• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (C) 2011-2015 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16 #include "render_api.h"
17 
18 #include "ErrorLog.h"
19 #include "RenderLibImpl.h"
20 
21 #include "OpenGLESDispatch/OpenGLDispatchLoader.h"
22 #include "OpenGLESDispatch/DispatchTables.h"
23 
24 #include <memory>
25 
initLibrary()26 RENDER_APICALL emugl::RenderLibPtr RENDER_APIENTRY initLibrary() {
27     //
28     // Load EGL Plugin
29     //
30     if (!emugl::LazyLoadedEGLDispatch::get()) {
31         // Failed to load EGL
32         printf("Failed to init_egl_dispatch\n");
33         return nullptr;
34     }
35 
36     //
37     // Load GLES Plugin
38     //
39     if (!emugl::LazyLoadedGLESv1Dispatch::get()) {
40         // Failed to load GLES
41         ERR("Failed to gles1_dispatch_init\n");
42         return nullptr;
43     }
44 
45     /* failure to init the GLES2 dispatch table is not fatal */
46     if (!emugl::LazyLoadedGLESv2Dispatch::get()) {
47         ERR("Failed to gles2_dispatch_init\n");
48         return nullptr;
49     }
50 
51     return emugl::RenderLibPtr(new emugl::RenderLibImpl());
52 }
53