Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface Block identifiers not renamed #237

Open
therontarigo opened this issue Feb 24, 2023 · 3 comments
Open

Interface Block identifiers not renamed #237

therontarigo opened this issue Feb 24, 2023 · 3 comments

Comments

@therontarigo
Copy link
Contributor

Given Interface Block GLSL syntax:

buffer block_name{
  int member_name[];
};

block_name and member_name are not renamed.

@laurentlb
Copy link
Owner

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 (#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.

@therontarigo
Copy link
Contributor Author

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.

laurentlb added a commit that referenced this issue Apr 12, 2024
uniform MatrixBlock
{
  mat4 projection;
  mat4 modelview;
};

-> rename projection and modelview like global variables

#237
@therontarigo
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants