Skip to content

dsheets/gloc

Repository files navigation

gloc: (WebGL|ESSL) gl(sl) o(bject) c(ompiler)

gloc provides modularity and dynamic linking to WebGL and OpenGL ES 2.0 GLSL shader systems. gloc 1.0 features:

  • an ESSL preprocessor to expand SL source for analysis
  • preprocessor conditional expression partial evaluation
  • a semantic JSON shader object format glo with well-ordered symbolic dependencies
  • a client-side linker to assemble glo for rendering
  • compile-time macro definition
  • link-time macro definition
  • source-to-source translation with accurate source locations and comment annotations
  • a JavaScript implementation of the linking algorithm glol
  • runs as a native binary and in-the-browser via js_of_ocaml

gloc is distributed as source code via this repository as well as a compiled JavaScript tool. glol, the glo linking algorithm, is also available for your development convenience.

gloc is licensed under a BSD-3-Clause license and distributed by Ashima Arts as a member of the greater WebGL community.

Interfaces

gloc version 1.0.0 (Ashima Arts)
  -c produce glo and halt; do not link
  --xml produce glo XML document
  -E preprocess and halt; do not parse SL
  -e parse preprocessor and halt; do not preprocess
  --source strip the glo format and return the contained source
  -u required symbol (default ['main'])
  --define define a macro unit
  -D define a global macro
  -o output file
  --accuracy {best|preprocess}output accuracy
  --line disregard incoming line directives
  -x {webgl}source language
  -t {webgl}target language
  --dissolve dissolve declarations
  -v verbose
  --meta prototypical glo file to use for metadata
  -help  Display this list of options
  --help  Display this list of options
type 'a glo = {
  glo:version;
  target:(string * version);
  ?meta:meta option;
  ~units: 'a u list <ocaml repr="array">;
  ~linkmap: (string * string) list <json repr="object">
}

type meta = {
  copyright:(year * href);
  ~author:href list;
  ?license:href option;
  ?library:href option;
  ?version:(version * url) option;
  ?build:href option;
}

type 'a u = {
  ~pdir: string list;
  ~edir: (string * string) list;
  ?vdir: int option;
  ~inu:string list;
  ~outu:string list;
  ~ina:string list;
  ~outa:string list;
  ~vary:string list;
  ~insym:string list;
  ~outsym:string list;
  ~inmac:string list;
  ~opmac:string list;
  ~outmac:string list;
  ~bmac:string list;
  source:'a;
}

type url = string
type href = (string * url)
type year = int
type version = (int * int * int)
type glom <ocaml_json module="Yojson.Safe" t="json"> = abstract

A JavaScript implementation of glol is also available. The source code is conversationally commented. If you have questions or concerns, just ask! :-)

Requirements

WebGL Application Developers

WebGL application developers need only to use the JavaScript glol link algorithm and the glocode development environment. No local software installation is required.

Shader Developers

Shader library developers and those developers with native build systems will need the following local software packages to build gloc:

You will also need recent versions of Martin Jambon's atdgen and friends in approximately this order:

These software packages may be available in your operating system's package repository. See the gloc GitHub wiki page for more detailed installation information.

gloc Developers

Developers of the gloc tool itself will need all of the packages required by shader developers for a local gloc build as well as the latest development version of js_of_ocaml to build the JavaScript port of the compiler and linker.

Users

Commercial users of gloc include:

glo shader libraries include:

Contributors

Special thanks to the WebGL working group for making this possible by allowing UTF8 in shader comments.

Fine Print

Suggestions? Bugs? Feature wishes? Comments? Language translations? Please use the GitHub project management features in the top bar to help out the project!

Do you use gloc in production? Have you published open source shader libraries that use gloc? Let us know and we'll add you to this file.

Gloc Links Our Creativity! Carpe Ignem!