blob: 88f39f042586121b5a501051963c5c8177d11f47 [file] [log] [blame]
{{/*
* 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.
*/}}
{{/* ---- Includes ---- */}}
{{Include "cpp_common.tmpl" }}
{{$ | Macro "gfx_api.h" | Format (Global "clang-format") | Write "gfx_api.h"}}
{{/*
-------------------------------------------------------------------------------
Entry point.
-------------------------------------------------------------------------------
*/}}
{{define "gfx_api.h"}}
{{template "C++.GeneratedHeader"}}
#ifndef GAPIR_GFX_API_H
#define GAPIR_GFX_API_H
#include <gapic/target.h>
#include <stdint.h>
namespace gapir {
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 := AllCommands $}}
static const uint16_t {{Macro "C++.Public" (Macro "CmdName" $c)}} = {{$i}};
{{end}}
} // namespace FunctionIds
{{range $e := $.Enums}}
enum class {{Macro "C++.EnumName" $e}} : uint32_t {
{{range $entry := $e.Entries}}
{{Macro "C++.EnumEntryName" $entry}} = {{$entry.Value}},
{{end}}
};¶
{{end}}
{{range $p := $.Pseudonyms}}
typedef {{Macro "C++.Type" $p.To}} {{Macro "C++.Type" $p}};
{{end}}
{{range $c := $.Classes}}
{{if not (GetAnnotation $c "internal")}}
typedef {{if GetAnnotation $c "union"}}union{{else}}struct{{end}} {
{{range $f := $c.Fields}}
{{Macro "C++.Type" $f}} {{$f.Name}}{{Macro "C++.ArrayPostfix" $f}};
{{end}}
} {{Macro "C++.Type" $c}};¶
{{end}}
{{end}}
{{range $c := AllCommands $}}
{{if not (GetAnnotation $c "synthetic")}}
{{Macro "C++.TypedefFunctionPtr" $c}}
{{end}}
{{end}}
{{range $c := AllCommands $}}
{{if not (GetAnnotation $c "synthetic")}}
extern {{Macro "C++.FunctionPtrDecl" $c}};
{{end}}
{{end}}
} // namespace gfxapi
} // namespace gapir
#endif // GAPIR_GFX_API_H
{{end}}