Skip to content

Commit

Permalink
Version 1.3
Browse files Browse the repository at this point in the history
Also update the README
  • Loading branch information
laurentlb committed Oct 23, 2022
1 parent dd49b88 commit 087d8ec
Show file tree
Hide file tree
Showing 29 changed files with 49 additions and 52 deletions.
34 changes: 16 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ shader is minified by hand by experienced demosceners, Shader Minifier is often
able to optimize it further. See this
[2010 report](https://www.ctrl-alt-test.fr/2010/glsl-minifier-smaller-and-smaller/).

If your application uses multiple shaders, use the `--preserve-externals`
option. Values such as the uniforms won't be renamed, which makes it easier to
use in your application (at the expense of a slightly bigger shader).
To be notified of new releases, use the watch feature of GitHub.

Try the online version here: https://ctrl-alt-test.fr/minifier/

## Features

Expand All @@ -42,14 +42,14 @@ be the most compression-friendly.
## Example output

```c
/* File generated with Shader Minifier 1.1.6
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef HEART_FRAG_EXPECTED_
# define HEART_FRAG_EXPECTED_
# define VAR_MOUSE "f"
# define VAR_RESOLUTION "y"
# define VAR_TIME "v"
# define VAR_mouse "f"
# define VAR_resolution "y"
# define VAR_time "v"

const char *heart_frag =
"uniform float v;"
Expand All @@ -61,8 +61,8 @@ const char *heart_frag =
"float r=mod(v,2.)/2.,a=pow(r,.2)*.5+.5;"
"a-=a*.2*sin(r*6.2831*5.)*exp(-r*6.);"
"f*=vec2(.5,1.5)+a*vec2(.5,-.5);"
"float m=atan(f.x,f.y)/3.14159,x=length(f),e=abs(m),o=(13.*e-22.*e*e+10.*e*e*e)/(6.-5.*e),l=step(x,o)*pow(1.-x/o,.25);"
"gl_FragColor=vec4(l,0.,0.,1.);"
"float m=atan(f.x,f.y)/3.141593,x=length(f),e=abs(m),o=(13.*e-22.*e*e+10.*e*e*e)/(6.-5.*e),n=step(x,o)*pow(1.-x/o,.25);"
"gl_FragColor=vec4(n,0.,0.,1.);"
"}";

#endif // HEART_FRAG_EXPECTED_
Expand Down Expand Up @@ -156,7 +156,7 @@ If you desperately need to save a few bytes, try another value of
The recommandation is to use:

```
shader_minifier.exe --format c-array --preserve-externals *.frag -o shaders.h
shader_minifier.exe --format c-array *.frag -o shaders.h
```

Then, in your C or C++ code, include the file:
Expand All @@ -167,8 +167,9 @@ const char* shaderSources[] = {
};
```

Since the uniforms are not renamed, prefer shorter names when
possible. Hopefully a future version of Shader Minifier will improve this.
Note that uniforms will be renamed consistently across all the files. The
`#define` lines will tell you how they were renamed. To disable this renaming,
use `--preserve-externals`.

### Javascript

Expand Down Expand Up @@ -337,10 +338,7 @@ Contributions are welcome.
---------
Slightly outdated user manual:
http://www.ctrl-alt-test.fr/?page_id=7
Created by Laurent Le Brun (LLB / Ctrl-Alt-Test).
Created by Laurent Le Brun (LLB / Ctrl-Alt-Test) and
[other contributors](https://github.com/laurentlb/Shader_Minifier/graphs/contributors).
http://laurent.le-brun.eu
http://ctrl-alt-test.fr
http://laurent.le-brun.eu -- http://ctrl-alt-test.fr
2 changes: 1 addition & 1 deletion src/options.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open System.IO
open Argu

let version = "1.2" // Shader Minifier version
let version = "1.3" // Shader Minifier version
let debugMode = false

type OutputFormat =
Expand Down
1 change: 1 addition & 0 deletions tests/commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
-o tests/unit/macros.expected --no-inlining tests/unit/macros.frag
--format indented -o tests/unit/switch.expected tests/unit/switch.frag
--format indented -o tests/unit/forbidden.expected tests/unit/forbidden.frag
--format c-variables -o tests/real/heart.frag.expected tests/real/heart.frag

# Optimization tests

Expand Down
2 changes: 1 addition & 1 deletion tests/real/chocolux.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef CHOCOLUX_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/real/disco.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/real/elevated.hlsl.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef ELEVATED_HLSL_EXPECTED_
Expand Down
12 changes: 6 additions & 6 deletions tests/real/heart.frag.expected
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* File generated with Shader Minifier 1.1.6
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef HEART_FRAG_EXPECTED_
# define HEART_FRAG_EXPECTED_
# define VAR_MOUSE "f"
# define VAR_RESOLUTION "y"
# define VAR_TIME "v"
# define VAR_mouse "f"
# define VAR_resolution "y"
# define VAR_time "v"

const char *heart_frag =
"uniform float v;"
Expand All @@ -17,8 +17,8 @@ const char *heart_frag =
"float r=mod(v,2.)/2.,a=pow(r,.2)*.5+.5;"
"a-=a*.2*sin(r*6.2831*5.)*exp(-r*6.);"
"f*=vec2(.5,1.5)+a*vec2(.5,-.5);"
"float m=atan(f.x,f.y)/3.14159,x=length(f),e=abs(m),o=(13.*e-22.*e*e+10.*e*e*e)/(6.-5.*e),l=step(x,o)*pow(1.-x/o,.25);"
"gl_FragColor=vec4(l,0.,0.,1.);"
"float m=atan(f.x,f.y)/3.141593,x=length(f),e=abs(m),o=(13.*e-22.*e*e+10.*e*e*e)/(6.-5.*e),n=step(x,o)*pow(1.-x/o,.25);"
"gl_FragColor=vec4(n,0.,0.,1.);"
"}";

#endif // HEART_FRAG_EXPECTED_
3 changes: 1 addition & 2 deletions tests/real/kinder_painter.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/

Expand Down Expand Up @@ -183,4 +183,3 @@
"col=mix(col,col2,.5-.5*ref.w);"
"gl_FragColor=col;"
"}",

3 changes: 1 addition & 2 deletions tests/real/leizex.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; File generated with Shader Minifier 1.2
; File generated with Shader Minifier 1.3
; http://www.ctrl-alt-test.fr

_leizex_frag:
Expand Down Expand Up @@ -105,4 +105,3 @@ _leizex_frag:
db 'col*=.5+.5*(1.-p.x)*(1.+p.x);'
db 'gl_FragColor=vec4(col,1.);'
db '}', 0

2 changes: 1 addition & 1 deletion tests/real/lunaquatic.frag.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef LUNAQUATIC_FRAG_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/real/mandelbulb.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef MANDELBULB_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/real/oscars_chair.frag.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef OSCARS_CHAIR_FRAG_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/real/sult.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef SULT_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/real/the_real_party_is_in_your_pocket.frag.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef THE_REAL_PARTY_IS_IN_YOUR_POCKET_FRAG_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/real/to_the_road_of_ribbon.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef TO_THE_ROAD_OF_RIBBON_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/real/yx_long_way_from_home.frag.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef YX_LONG_WAY_FROM_HOME_FRAG_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/blocks.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef BLOCKS_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/externals.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef EXTERNALS_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/externals.preserved.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef EXTERNALS_PRESERVED_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/float.frag.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/function_comma.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef FUNCTION_COMMA_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/function_overload.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef FUNCTION_OVERLOAD_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/geometry.hlsl.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef GEOMETRY_HLSL_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/inout.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
# define VAR_ambientLight "m"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/macros.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef MACROS_EXPECTED_
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/many_variables.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/minus-zero.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/operators.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/qualifiers.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* File generated with Shader Minifier 1.2
/* File generated with Shader Minifier 1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef QUALIFIERS_EXPECTED_
Expand Down

0 comments on commit 087d8ec

Please sign in to comment.