项目作者: cginternals

项目描述 :
A Python generator for the Khronos APIs OpenGL, OpenGL ES, OpenGL SC, and EGL
高级语言: C++
项目地址: git://github.com/cginternals/khrbinding-generator.git
创建时间: 2018-03-27T09:27:16Z
项目社区:https://github.com/cginternals/khrbinding-generator

开源协议:MIT License

下载


KHR Binding C++ Generator

Process

  1. Load XML from Khronos repository
  2. Generate C++ API binding from XML

Preconfigured Profiles

Currently available profiles for loading and generating (in subdirectory profiles):

  • gl.json for the OpenGL API (results are deployed in glbinding)
  • gles.json for the OpenGL ES API (results are deployed in glesbinding)
  • glsc.json for the OpenGL SC API (results are deployed in glscbinding)
  • egl.json for the EGL API (results are deployed in eglbinding)

Examples

Load XML from Khronos repository

  1. python3 update.py -p "profiles/gl.json"
  2. python3 update.py -p "profiles/gles.json"
  3. python3 update.py -p "profiles/glsc.json"
  4. python3 update.py -p "profiles/egl.json"
  5. python3 update.py -p "profiles/vk.json"

Generate C++ API binding from XML

  1. python3 generate.py -p "profiles/gl.json" -d "../glbinding/source"
  2. python3 generate.py -p "profiles/gles.json" -d "../glesbinding/source"
  3. python3 generate.py -p "profiles/glsc.json" -d "../glscbinding/source"
  4. python3 generate.py -p "profiles/egl.json" -d "../eglbinding/source"
  5. python3 generate.py -p "profiles/vk.json" -d "../vkbinding/source"

Profile Documentation

A profile file is a JSON file with a flat layout, although semantic groups are intended.
The currently supported tags are:

  • API specification
    • sourceUrl: The url to download the API specification
    • sourceFile: The intermediate file name to store the API specification
    • apiIdentifier: For multi-API specification files, specifies the one API to select
  • Code Generation
    • bindingNamespace: The identifier for the subdirectories and C++ binding namespace
    • baseNamespace: The C++ namespace for the generated API
    • coreProfileSince: The version of core profile introduction (e.g., 3.2 for OpenGL)
    • multiContext: Set to true if the API supports multiple contexts
    • booleanWidth: The width of a boolean in this API (may be either 8 or 32)

More options are subject to future development. Ideas and requirements are welcomed.

Example profile gl.json

  1. {
  2. "": "API specification",
  3. "apiIdentifier": "gl",
  4. "sourceUrl": "https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/master/xml/gl.xml",
  5. "sourceFile": "gl.xml",
  6. "": "Code Generation",
  7. "bindingNamespace": "glbinding",
  8. "baseNamespace": "gl",
  9. "coreProfileSince": "3.2",
  10. "multiContext": true,
  11. "booleanWidth": 8
  12. }

Dependencies

  • Python 3
    • jinja2