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

igl | opengl | The glUniformBlockBinding() function only needs to be called once for each program #190

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vinsentli
Copy link
Contributor

The glUniformBlockBinding() function only needs to be called once for each program and does not need to be called every frame.

…ach program and does not need to be called every frame.
Copy link
Contributor

@AmesingFlank AmesingFlank left a comment

Choose a reason for hiding this comment

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

There is an non-const

std::unordered_map<int, size_t>& uniformBlockBindingMap();

method exposed in RenderPipelineState, which makes this change not super-safe. However, it doesn't look like that method is used anywhere, so if you also remove that method in this PR, this is more ore less OK.

But also, just wanted to understand your motivation for making this change -- do you see any bugs/perf-issues caused by setting uniform block binding points multiple times?

src/igl/opengl/RenderPipelineState.h Outdated Show resolved Hide resolved
@vinsentli
Copy link
Contributor Author

Calling multiple times does not cause any functional issues, but according to the relevant documentation, calling it once is sufficient.
https://learnopengl.com/code_viewer.php?code=advanced/advanced_glsl_uniform_buffer_objects

@facebook-github-bot
Copy link
Contributor

@corporateshark has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

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

Successfully merging this pull request may close these issues.

3 participants