glsl

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package glsl contains routines for manipulation of OpenGL ES Shading Language programs.

It exposes functions for parsing, serializing and evaluating GLES Shading Language programs. While this package contains a number of sub-packages, the only sub-package which is expected to be imported directly is the ast package, which contains the definitions of the AST of the parsed program. The main functionality of the other packages is exposed through the functions of this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Analyze

func Analyze(program interface{}) (err []error)

Analyze performs semantic analysis on the parsed program AST. It computes the types of all program expression, array sizes and values of constant variables. Any encountered errors are returned as a result.

func Format

func Format(tree interface{}, version Version, extensions []pp.Extension) string

Format returns the source for the given shader AST tree and version.

func Formatter

func Formatter(node interface{}) fmt.Formatter

Formatter is a helper function which turns any AST node into something that can be printed with %v. The returned object's default format will print the tree under the ast node in a reindented form. The alternate format flag (%#v) will print the node while preserving original whitespace, if this is present in the ***Cst nodes of the tree.

Types

type Version

type Version struct {
	Major, Minor, Point int
}

Version describes a GLSL shader version.

func Parse

func Parse(src string, lang ast.Language) (program interface{}, version Version, extensions []pp.Extension, err []error)

Parse preprocesses and parses an OpenGL ES Shading language program present in the first argument. The second argument specifies the language, whose syntax to employ during parsing. The parsed AST is returned in the first result. If any parsing errors are encountered, they are returned in the second result.

func ParseVersion

func ParseVersion(s string) Version

ParseVersion parses and returns the Version from the string s.

func (Version) GreaterThan

func (v Version) GreaterThan(major, minor int) bool

GreaterThan returns true if this Version is greater than Version{major, minor}.

func (Version) String

func (v Version) String() string

String returns the string form of the GLSL version.

Directories

Path Synopsis
Package ast defines the abstract syntax tree of OpenGL ES Shading Language programs.
Package ast defines the abstract syntax tree of OpenGL ES Shading Language programs.
Package builtins contains the definitions of all OpenGL ES Shading Language builtin functions.
Package builtins contains the definitions of all OpenGL ES Shading Language builtin functions.
Package evaluator is responsible for evaluating expressions in OpenGL ES Shading Language programs.
Package evaluator is responsible for evaluating expressions in OpenGL ES Shading Language programs.
Package parser implements parsing and serializing an OpenGL ES Shading Language programs.
Package parser implements parsing and serializing an OpenGL ES Shading Language programs.
Package preprocessor defines the preprocessor for the OpenGL ES Shading Language.
Package preprocessor defines the preprocessor for the OpenGL ES Shading Language.
Package sema performs semantic checking of OpenGL ES Shading Language programs.
Package sema performs semantic checking of OpenGL ES Shading Language programs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL