Skip to content

Commit ceae71e

Browse files
committed
Expose GLSL version
1 parent 30dfd5c commit ceae71e

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

lib/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ inherits(GLSL, Emitter)
5454
GLSL.prototype.optimize = true
5555
GLSL.prototype.preprocess = prepr
5656
GLSL.prototype.debug = false
57+
GLSL.prototype.version = '100 es'
5758

5859

5960
/**

lib/parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function parse(arg) {
1414

1515
//convert string to tokens
1616
if (typeof arg === 'string') {
17-
arg = tokenize(arg, { version: '300 es' });
17+
arg = tokenize(arg, { version: this.version || '100 es' });
1818
}
1919

2020
//convert tokens to ast

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Property | Default | Description
8888
`uniform` | `false` | A function replacing each uniform declaration. Eg: `function (name, node) { return 'uniforms["' + name + '"]' }` will render each uniform declaration as `var <name> = uniforms["<name>"]`.
8989
`attribute` | `false` | Same as `uniform`, but for attribute declarations.
9090
`varying` | `false` | Same as `uniform`, but for varying declarations.
91+
`version` | `'100 es'` | GLSL shader version, one of `'300 es'` or `'100 es'`.
9192
`comments` | `false` | TODO: preserve comments in source code.
9293
`sourceMap` | `false` | TODO: include source map for the transpiled code.
9394
`includes` | `true` | Append stdlib includes for the result. Can be bool or an object with defined stdlib functions to include, eg. `{normalize: false, min: false}`.

0 commit comments

Comments
 (0)