top of page
Search

[114] Scheduling

  • Writer: Conlan Walker
    Conlan Walker
  • Jan 19, 2024
  • 1 min read

Like last week, I was doing more OpenGL, and while I haven't gotten around to integrating that cool plasma effect, I have set up a simple but effective framework for embedding shaders into the resulting executable.


Specifically, the ability to minify the shader code for the release build, while having the debug build remain in its original, unobfuscated state.

While I did eventually get it to work, the CLI minifier program I'm using is a bit finicky, and thus took an annoying amount of time to get the setup and build script just right.



This Python script concatenates some flags, and the paths of all files from a list of directories.

The resulting string is then fed into the minifier program:


Here's an example of how the script is used for the debug build:

py minifyShaders.py -debug shaders/shaders_debug.h shaders/src

The first argument (-debug) is the build 'mode', which determines the flags used and whatnot.

The second (shaders/shaders_debug.h) is the output file's path.

The third (shaders/src) and onward are the input directories, which the files will be pulled from, in a recursive manner.



Here's a side-by-side comparison of the debug and release builds' output respectively:



The best part is that they can be automatically picked from via conditional compilation:

(The VAR_<name> stuff is put there so it can be consistent with the release build's formatting)

 
 
 

Comments


bottom of page