laurentlb/shader-minifier

Interface block identifiers renamed inconsistently across multiple files

martiancatboy opened this issue · 0 comments

I'm having an issue where identifiers in interface blocks receive different names across multiple files. This trips up my video driver's GLSL compiler, which apparently expects interface blocks to be identical across all stages of a shader program.

The simplest way I've found to reproduce the bug is by creating a file with a single block in it:

echo "uniform U { vec4 v; };" > bug.glsl

and then passing it multiple times to shader_minifier:

mono shader_minifier.exe bug.glsl bug.glsl bug.glsl

The output on my machine is

// Generated with Shader Minifier 1.4.0 (https://github.com/laurentlb/Shader_Minifier/)
#ifndef SHADER_CODE_H_
# define SHADER_CODE_H_

const char *bug_glsl =
 "uniform U{vec4 U;};";

const char *bug_glsl =
 "uniform U{vec4 K;};";

const char *bug_glsl =
 "uniform U{vec4 J;};";

#endif // SHADER_CODE_H_

The expected behavior is that U, K, and J would receive the same name everywhere. (Please ignore the fact that the output contains the identifier bug_glsl three times, which obviously wouldn't compile.)