| {{/* |
| * Copyright (C) 2015 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */}} |
| |
| {{Include "opengl32_exports.tmpl"}} |
| {{Include "cpp_common.tmpl"}} |
| {{$ | Macro "opengl32_resolve.cpp" | Reflow 4 | Write "opengl32_resolve.cpp"}} |
| |
| {{/* |
| ------------------------------------------------------------------------------- |
| Entry point. |
| ------------------------------------------------------------------------------- |
| */}} |
| {{define "opengl32_resolve.cpp"}} |
| {{/* This is the list of functions that OpenGL32.dll needs to export. */}} |
| {{$opengl32_exports := Strings (Macro "OpenGL32Exports") | SplitOn "\n"}} |
| |
| {{/* This is the list of functions that the spy exports. */}} |
| {{$api_exports := (ForEach (AllCommands $) "CmdName") | Strings "wglGetProcAddress"}} |
| |
| {{/* This is list of functions we need to resolve. */}} |
| {{$resolve := $opengl32_exports | FilterOut $api_exports}} |
| |
| {{Macro "C++.AOSP.Copyright"}} |
| ¶ |
| #include <gapic/get_gfx_proc_address.h> |
| ¶ |
| extern "C" {« |
| ¶ |
| {{range $f := $resolve}} |
| void* real__{{$f}} = nullptr; |
| {{end}} |
| ¶ |
| int resolved = 0; |
| void __stdcall resolve() { |
| {{range $f := $resolve}} |
| real__{{$f}} = gapic::GetGfxProcAddress("{{$f}}", true); |
| {{end}} |
| resolved = 1; |
| } |
| ¶ |
| »} // extern "C" |
| ¶ |
| {{end}} |