Skip to content

Instantly share code, notes, and snippets.

@fand
Created May 28, 2017 16:05
Show Gist options
  • Save fand/d64754980900490b81867340a13c9643 to your computer and use it in GitHub Desktop.
Save fand/d64754980900490b81867340a13c9643 to your computer and use it in GitHub Desktop.
glslify sourcemaps test
vec3 color(in vec2 p) {
return vec3(p.x, p.y, p.x + p.y);
}
#pragma glslify: export(color)
precision mediump float;
#pragma glslify: color = require('./color.glsl')
void main () {
vec2 p = (gl_FragCoord.xy * 2. - resolution) / min(resolution.x, resolution.y);
vec3 c = color(p);
gl_FragColor = vec4(c,1);
}
precision mediump float;
vec3 color_1540259130(in vec2 p) {
return vec3(p.x, p.y, p.x + p.y);
}
void main () {
vec2 p = (gl_FragCoord.xy * 2. - resolution) / min(resolution.x, resolution.y);
vec3 c = color_1540259130(p);
gl_FragColor = vec4(c,1);
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9hbWFnaXRha2F5b3NpL3NyYy9naXRodWIuY29tL2ZhbmQvZ2xzbGlmeS1idW5kbGUvaWdub3JlZC9pbmRleC5nbHNsIiwiL1VzZXJzL2FtYWdpdGFrYXlvc2kvc3JjL2dpdGh1Yi5jb20vZmFuZC9nbHNsaWZ5LWJ1bmRsZS9pZ25vcmVkL2NvbG9yLmdsc2wiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkNBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxLQUFJLENBQ3ZCO0FDREMsSUFBSSxDQUFDLGdCQUFJLENBQUUsRUFBRSxDQUFDLElBQUksQ0FBQyxDQUFBLENBQUUsQ0FBQyxDQUN2QjtFQUFHLE1BQU0sQ0FBQyxJQUFHLENBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQSxDQUFDLENBQ2xDO0FBQUMsQ0FDRDtBQUNBO0FEREE7O0FBQUMsSUFBSSxDQUFDLElBQUksQ0FBQSxDQUFDLENBQUUsQ0FBQyxDQUNkO0VBQUcsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUEsQ0FBRSxZQUFZLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLFVBQVMsQ0FBRSxDQUFDLENBQUMsQ0FBQyxHQUFFLENBQUUsVUFBVSxDQUFDLENBQUMsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxDQUFBLENBQUMsQ0FDaEY7RUFBRyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxnQkFBSSxDQUFFLENBQUEsQ0FBQyxDQUNuQjtFQUFHLFlBQVksQ0FBQyxDQUFDLENBQUMsSUFBRyxDQUFFLENBQUMsQ0FBQyxDQUFBLENBQUMsQ0FDMUI7QUFBQyxDQUNEIn0=
const convert = require('convert-source-map')
const fs = require('fs')
const src = fs.readFileSync('out.glsl', 'utf8')
console.log(convert.fromSource(src))
// Converter {
// sourcemap:
// { version: 3,
// sources:
// [ '/Users/amagitakayosi/src/github.com/fand/glslify-bundle/ignored/index.glsl',
// '/Users/amagitakayosi/src/github.com/fand/glslify-bundle/ignored/color.glsl' ],
// names: [],
// mappings: 'CAAC,SAAS,CAAC,OAAO,CAAC,KAAI,CACvB;ACDC,IAAI,CAAC,gBAAI,CAAE,EAAE,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC,CACvB;EAAG,MAAM,CAAC,IAAG,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAClC;AAAC,CACD;AACA;ADDA;;AAAC,IAAI,CAAC,IAAI,CAAA,CAAC,CAAE,CAAC,CACd;EAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA,CAAE,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAS,CAAE,CAAC,CAAC,CAAC,GAAE,CAAE,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA,CAAC,CAChF;EAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAI,CAAE,CAAA,CAAC,CACnB;EAAG,YAAY,CAAC,CAAC,CAAC,IAAG,CAAE,CAAC,CAAC,CAAA,CAAC,CAC1B;AAAC,CACD' } }
// >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment