
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
glsl-minifier
Advanced tools
CLI tool for optimizing and minifying GLSL using aras-p/glsl-optimizer and stackgl/glsl-min-stream. Optimizations include function inlining, dead code removal, copy propagation, constant folding, constant propagation, arithmetic optimizations and so on. Minifications includes variable rewriting and whitespace trimming.
$ npm install -g --save glsl-minifier
$ node ./bin/glsl-minifier.js -i ./example/example.frag -o ./example/example.min.frag
Turns this:
#define SPREAD 8.00
#define MAX_DIR_LIGHTS 0
#define MAX_POINT_LIGHTS 0
#define MAX_SPOT_LIGHTS 0
#define MAX_HEMI_LIGHTS 0
#define MAX_SHADOWS 0
#define GAMMA_FACTOR 2
uniform mat4 viewMatrix;
uniform vec3 cameraPosition;
uniform vec2 resolution;
uniform float time;
uniform sampler2D texture;
void main() {
vec2 uv = gl_FragCoord.xy / resolution.xy;
float v = texture2D( texture, uv ).x;
if (v == 1000.) discard;
v = sqrt(v);
gl_FragColor = vec4( vec3( 1. - v / SPREAD ), 1.0 );
}
Into this:
uniform highp vec2 resolution;uniform sampler2D texture;void main(){highp vec2 a;a=(gl_FragCoord.xy/resolution);lowp vec4 b;b=texture2D(texture,a);if((b.x==1000.0)){discard;}lowp vec4 c;c.w=1.0;c.xyz=vec3((1.0-(sqrt(b.x)/8.0)));gl_FragColor=c;}
-v, --version [print version number]
-h, --help [print help]
-i, --input [example: ./example/example.vert] [required]
-o, --output [example: ./example/example.min.vert] [required]
-sT, --shaderType [vertex / fragment, default: fragment] (vertex shader / fragment shader) [not required]
-sV, --shaderVersion [2 / 3, default: 2] (OpenGL ES 2.0 (WebGL1) / OpenGL ES 3.0 (WebGL2)) [not required]
My work is released under the MIT license.
This repository distributes the compiled ASM.js file from Joshua Koo's Emscripten port zz85/glsl-optimizer of the original aras-p/glsl-optimizer source. This in itself is based on the GLSL optimizer of Mesa.
FAQs
CLI tool for optimizing and minifying GLSL.
We found that glsl-minifier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.