You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shader_Minifier by default reorders functions to be able to remove forward declarations.
While dealing with a single shader file containing all functions, or when combining shader sources before compilation, this technique is very useful to reduce shader source size in the executable.
In my use-case (32k intros) however, I compile shaders containing single functions, to avoid inlining and reduce compile time. The technique requires forward declarations to be present, but those will be optimized by Shader_Minifier.
I suggest
either adding a command line switch to disable forward declaration removal by reordering
or verifying that the forward declaration in question has a definition inside the minified sources before reordering and dropping it, keeping the forward declaration and not reordering if none is present.
to enable the use of Shader_Minifier when compiling functions separately.
I would be willing to submit a PR, should you decide you like the suggestion - just let me know if you like the idea (and which approach you prefer).
The text was updated successfully, but these errors were encountered:
If I remember correctly, the forward declaration is removed immediately (there's no AST node for it at all). So we need a change in the parser as well as the printer.
In your second proposal: we could drop the declaration if it isn't used at all. So "keep the forward declaration if it is referenced but not defined in the file".
Shader_Minifier by default reorders functions to be able to remove forward declarations.
While dealing with a single shader file containing all functions, or when combining shader sources before compilation, this technique is very useful to reduce shader source size in the executable.
In my use-case (32k intros) however, I compile shaders containing single functions, to avoid inlining and reduce compile time. The technique requires forward declarations to be present, but those will be optimized by Shader_Minifier.
I suggest
to enable the use of Shader_Minifier when compiling functions separately.
I would be willing to submit a PR, should you decide you like the suggestion - just let me know if you like the idea (and which approach you prefer).
The text was updated successfully, but these errors were encountered: