Shader Minifier 1.0

Since last release, the number of users of GLSL Minifier has increased, while number of bug reports decreased. I think it’s a good reason to move to version 1.0. This obfuscator has been used in a few great intros, such as Another Theory (winner at Main) and White one (winner at tUM). Hopefully we will see many intros using it at Revision.

The main feature of this release is the support for HLSL obfuscation, so we’ll now call this tool “Shader Minifier”. I got pretty good results with it, and I’ve been able to reduce the size of some famous 4k intros. Renaming strategy has been improved a bit; Detailed statistics will come later.

Try it now, download Shader Minifier!

  • HLSL Support. Please use –hlsl flag.
  • in/out now behave like uniform on global values (requested by several people), you can choose to preserve them.
  • Information on console output is removed unless you use -v (verbose).
  • Spaces in macros are now stripped (thanks to @lx!).
  • New flag –no-renaming to prevent from doing renaming.
  • Various fixes and improvements.

6 thoughts on “Shader Minifier 1.0

  1. Reg

    I think I’ve found a problem in HLSL support. My shader defines an uniform parameter as global variable like this:

    row_major float4x4 g_world_view_projection : register(c0);

    and the shader-minifier.exe run with -v –hlsl prints:

    Col: 20
    row_major float4x4 g_world_view_projection : register(c0);
    Expecting: ‘(‘

    Or maybe I just do something wrong or don’t know enought about this tool…

  2. LLB Post author


    You’re right. I didn’t do much testing on the HLSL parser, so there might be other errors. I have just updated the tool, it should work now.


  3. KK


    I’ve just tried using shader minifier on Quantum Core demo and it got it about 200B down, but found a problem at the same time. The tool should record what #defines are present in original code and not to use these identifiers and avoid them in renaming. In my case, I had macro R for rotation and Shader Minifier decided to rename most of the functions to R (compiler complained about wrong number of macro arguments).

    Other (small) thing is that the minifier gives up on float constants with extra ‘f’ (e.g. “0.5f”). This could be done by hand, but it would be cool if the minifier quietly erased the ‘f’.


  4. LLB Post author

    Thanks for the feedback!
    Both things look feasible, and they should be part of the next release (I don’t know when it will be). I need to make sure if it’s always safe to remove the extra f.

  5. victor martins

    i get an error with GLSL when using blocks {}

    it says “Expecting: qualifier” on the open brackets

    in block
    { <— here
    vec3 pos;

Leave a Reply

Your email address will not be published. Required fields are marked *