-
-
Save chrisdickinson/f11661ec7abd7d474fb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cssauron_config = { | |
tag: 'type' | |
, parent: 'parent' | |
, children: 'children' | |
} | |
var fs = require('fs') | |
, Path = require('path') | |
var tokenizer = require('glsl-tokenizer')() | |
, lang = require('cssauron')(cssauron_config) | |
, parser = require('../index') | |
, deparser = require('../deparser') | |
, path = Path.join(__dirname, 'test.glsl') | |
, parse_stream = parser(select) | |
, is_global_variable = lang(':root > stmt > decl decllist ident') | |
, is_global_function = lang(':root > stmt > decl function > ident') | |
, lang | |
function select(x) { | |
return is_global_variable(x) || is_global_function(x) | |
} | |
fs.createReadStream(path) | |
.pipe(tokenizer) | |
.pipe(parse_stream) | |
.on('data', function(x) { | |
x.data = 'mangled_x264_'+x.data | |
}) | |
.on('end', function() { | |
console.log(deparser(parse_stream.program)) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision highp int; | |
precision highp float; | |
precision highp vec2; | |
precision highp vec3; | |
precision highp vec4; | |
#line 0 | |
#define X(a) Y \ | |
asdf \ | |
barry | |
struct xxx { | |
int y; | |
float b; | |
} | |
varying vec2 vTexcoord; | |
varying vec3 vPosition; | |
uniform mat4 proj, view; | |
attribute vec3 position; | |
attribute vec2 texcoord; | |
int x(void) { | |
} | |
int y() { | |
} | |
int z(int a, int b) { | |
} | |
int w(int a) { | |
do x; while(1); | |
} | |
int first, second, third, fourth, fifth, sixth, seventh, eigth; | |
void main(){ | |
vTexcoord = texcoord; | |
vPosition = position; | |
vec3 thing = vec2(1., 2.); | |
int v_thing, garybusey; | |
for(xxx i = 0; i < 10; ++i) { | |
discard; | |
} | |
while(1) { | |
v_thing = 23; | |
} | |
gl_Position = proj * view * // nope | |
vec4(position, 1.0); | |
if(first < /*hello*/ y) { z; } | |
if(second < y) z; | |
if(third == y) z; else if(z == w) y; | |
if(fourth == y) z; else if(z == w) { y; }; | |
if(fifth == y) z; else if(z == w) { y; } else a; | |
if(sixth == y) z; else z; | |
if(seventh == y) z; else {z; } | |
if(eigth == y) { z; } else { z; } | |
for(;;) garybusey; | |
return x; | |
return; | |
break; | |
continue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision highp int; | |
precision highp float; | |
precision highp vec2; | |
precision highp vec3; | |
precision highp vec4; | |
#line 0 | |
#define X(a) Y \ | |
asdf \ | |
barry | |
struct xxx { | |
int y; | |
float b;} | |
varying vec2 mangled_x264_vTexcoord; | |
varying vec3 mangled_x264_vPosition; | |
uniform mat4 mangled_x264_proj, mangled_x264_view; | |
attribute vec3 mangled_x264_position; | |
attribute vec2 mangled_x264_texcoord; | |
int mangled_x264_x(void){ | |
} | |
int mangled_x264_y(){ | |
} | |
int mangled_x264_z(int a , int b){ | |
} | |
int mangled_x264_w(int a ){ | |
do mangled_x264_x; while(1); | |
} | |
int mangled_x264_first, mangled_x264_second, mangled_x264_third, mangled_x264_fourth, mangled_x264_fifth, mangled_x264_sixth, mangled_x264_seventh, mangled_x264_eigth; | |
void mangled_x264_main(){ | |
mangled_x264_vTexcoord = mangled_x264_texcoord; | |
mangled_x264_vPosition = mangled_x264_position; | |
vec3 thing=vec2(1., 2.); | |
int v_thing, garybusey; | |
for(xxx i= 0; i < 10; ++i){ | |
discard; | |
} | |
while(1){ | |
v_thing = 23; | |
} | |
gl_Position = mangled_x264_proj * mangled_x264_view *vec4(mangled_x264_position, 1.0); | |
if(mangled_x264_first < /*hello* mangled_x264_y){ mangled_x264_z; } | |
if(mangled_x264_second < mangled_x264_y) mangled_x264_z; | |
if(mangled_x264_third == mangled_x264_y) mangled_x264_z;else if(mangled_x264_z == mangled_x264_w) mangled_x264_y; | |
if(mangled_x264_fourth == mangled_x264_y) mangled_x264_z;else if(mangled_x264_z == mangled_x264_w){ mangled_x264_y; } | |
if(mangled_x264_fifth == mangled_x264_y) mangled_x264_z;else if(mangled_x264_z == mangled_x264_w){ mangled_x264_y; }else a; | |
if(mangled_x264_sixth == mangled_x264_y) mangled_x264_z;else mangled_x264_z; | |
if(mangled_x264_seventh == mangled_x264_y) mangled_x264_z;else { mangled_x264_z;} | |
if(mangled_x264_eigth == mangled_x264_y){ mangled_x264_z; }else { mangled_x264_z;} | |
for(;;) garybusey; | |
return mangled_x264_x; | |
return; | |
break; | |
continue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment