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!

Changes
  • 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 Responses to “Shader Minifier 1.0”

  1. Reg says:

    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 says:

    Hi,

    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.

    Thanks.

  3. KK says:

    Hello!

    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’.

    Thanks,
    KK

  4. LLB says:

    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 says:

    Hi,
    i get an error with GLSL when using blocks {}

    it says “Expecting: qualifier” on the open brackets

    in block
    { <— here
    vec3 pos;
    etc…
    }

  6. LLB says:

    Maybe we could use github to track bugs? https://github.com/laurentlb/Shader_Minifier/issues

    (not actively working on it, but I might fix the bugs at some point)

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>