| {{/* |
| * Copyright 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. |
| */}} |
| |
| |
| {{/* |
| ------------------------------------------------------------------------------- |
| Entry point. |
| ------------------------------------------------------------------------------- |
| */}} |
| {{define "Api"}} |
| {{template "AOSPCopyright"}} |
| ¶ |
| {{template "C++.GeneratedHeader"}} |
| ¶ |
| #ifndef ANDROID_CAZE_GFXAPI_FUNCTIONS_H |
| #define ANDROID_CAZE_GFXAPI_FUNCTIONS_H |
| ¶ |
| #include "Target.h" |
| ¶ |
| #include <stdint.h> |
| ¶ |
| namespace android { |
| namespace caze { |
| ¶ |
| class Interpreter; |
| ¶ |
| namespace gfxapi { |
| ¶ |
| // Register the API functions with the interpreter |
| extern void Register(Interpreter* interpreter); |
| ¶ |
| // Look-up the API function addresses for the currently bound context. |
| extern void Initialize(); |
| ¶ |
| namespace Ids { |
| // List of the function ids for the API functions. This list have to be consistent with the |
| // function ids on the server side because they are part of the communication protocol |
| {{range $i, $c := $.Functions}} |
| static const uint16_t {{Macro "C++.Public" $c.Name}} = {{$i}}; |
| {{end}} |
| } // end of namespace FunctionIds |
| ¶ |
| {{range $_, $e := $.Enums}} |
| namespace {{$e.Name}} { |
| {{range $_, $en := $e.Entries}} |
| static const uint32_t {{$en.Name}} = {{$en.Value}}; |
| {{end}} |
| }; // end of namespace {{$e.Name}}¶ |
| {{end}} |
| |
| {{range $p := $.Pseudonyms}} |
| typedef {{Macro "C++.Type" $p.To}} {{$p.Name}}; |
| {{end}} |
| ¶ |
| {{range $c := $.Functions}} |
| {{if not (GetAnnotation $c "synthetic")}} |
| {{Macro "TypedefFunctionPtr" $c}} |
| {{end}} |
| {{end}} |
| ¶ |
| {{range $c := $.Functions}} |
| {{if not (GetAnnotation $c "synthetic")}} |
| {{Macro "FunctionPtrExtern" $c}} |
| {{end}} |
| {{end}} |
| ¶ |
| } // end of namespace gfxapi |
| } // end of namespace caze |
| } // end of namespace android |
| ¶ |
| #endif // ANDROID_CAZE_GFXAPI_FUNCTIONS_H |
| ¶ |
| {{end}} |
| |
| |
| {{/* |
| ------------------------------------------------------------------------------- |
| Emits the C++ function-pointer typedef for a given command. |
| ------------------------------------------------------------------------------- |
| */}} |
| {{define "TypedefFunctionPtr"}} |
| {{AssertType $ "Function"}} |
| |
| typedef {{Macro "C++.ReturnType" $}} (STDCALL *{{Macro "FunctionPtrType" $}})({{Macro "C++.CallParameters" $}}); |
| {{end}} |
| |
| |
| {{/* |
| ------------------------------------------------------------------------------- |
| Emits the C++ function-pointer variable extern for a given command. |
| ------------------------------------------------------------------------------- |
| */}} |
| {{define "FunctionPtrExtern"}} |
| {{AssertType $ "Function"}} |
| |
| extern {{Macro "FunctionPtrType" $}} {{$.Name}}; |
| {{end}} |
| |
| {{Include "GfxApiCommon.tmpl" "../../../gfxapi/cpp_common.tmpl"}} |
| {{$ | Macro "Api" | Format (Global "clang-format") | Write "GfxApi.h"}} |