Shader_Minifier
Shader_Minifier copied to clipboard
Interface Block identifiers not renamed
Given Interface Block GLSL syntax:
buffer block_name{
int member_name[];
};
block_name and member_name are not renamed.
Some examples from https://www.khronos.org/opengl/wiki/Interface_Block_(GLSL):
uniform MatrixBlock
{
mat4 projection;
mat4 modelview;
} matrices;
The instance name (matrices) should also be treated as a global variable.
To access projection, we have to use matrices.projection. So this should be the same renaming approach as for structs (https://github.com/laurentlb/Shader_Minifier/issues/290).
uniform MatrixBlock
{
mat4 projection;
mat4 modelview;
};
Here, when there's no instance name, projection should be treated as a global variable.
If we rename the block name (MatrixBlock), it should be exported to a macro as the name can be used from the OpenGL side.
In this situation //[ //] allows a good workaround:
//[
uniform u{//]
mat4 projection; // minifier now sees these as global vars
mat4 modelview;
//[
};//]
combined with adding u to --no-renaming-list.
#335 solves this for me, I just tested it for buffer block. Much appreciated!
Manually naming the block itself to a short name and adding it to no-renaming-list is still needed; probably that should be handled in the same way as for simple uniforms.