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

[glsl-in] Support anonymous global uniforms #211

Merged
merged 2 commits into from
Sep 22, 2020

Conversation

pjoe
Copy link
Collaborator

@pjoe pjoe commented Sep 21, 2020

Partly handles issue in #210

Example shader:

#version 450

layout(set = 0, binding = 0) uniform Matrices {
    mat4 modelViewProjection;
};

layout(location = 0) in vec2 position;

void main() {
    gl_Position = modelViewProjection * vec4(position, 0.0, 1.0);
}

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you post an example code of what you are trying to support in this PR?

@@ -92,6 +127,8 @@ impl Program {
Ok(Some(local_var))
} else if let Some(global_var) = self.context.lookup_global_var_exps.get(name) {
Ok(Some(*global_var))
} else if let Some(global_member) = self.lookup_global_struct_member(name) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible, instead of calling lookup_global_struct_member here, make sure these fields are present in the lookup_global_var_exps table. I.e. once we encounter an anonymous global struct, just make sure we add the members to that map, and avoid any wacky lookups later on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will take a look 👀
First step was to make it work :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Simpler code - though a bit sad to see all my fancy FP code gone 😁

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Simpler code - a bit sad to see all my fancy FP fun gone though 😁

@kvark kvark merged commit e5d17e8 into gfx-rs:master Sep 22, 2020
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

Successfully merging this pull request may close these issues.

2 participants