igl | opengl | Fix glDrawBuffers() will fail if the set color_attachment_N indices are not consecutive.#286
Closed
vinsentli wants to merge 2 commits into
Closed
igl | opengl | Fix glDrawBuffers() will fail if the set color_attachment_N indices are not consecutive.#286vinsentli wants to merge 2 commits into
vinsentli wants to merge 2 commits into
Conversation
…ent_N indices are not consecutive.
Contributor
|
@corporateshark has imported this pull request. If you are a Meta employee, you can view this in D80443133. |
corporateshark
approved these changes
Aug 18, 2025
corporateshark
requested changes
Aug 18, 2025
| std::sort(drawBuffers.begin(), drawBuffers.end()); | ||
|
|
||
| if (drawBuffers.size() > 1) { | ||
| getContext().drawBuffers(static_cast<GLsizei>(drawBuffers.size()), drawBuffers.data()); |
Contributor
There was a problem hiding this comment.
The condition if (drawBuffers.size() > 1) on line 595 may not behave as intended after this change. Since the code now always pushes either a color attachment or GL_NONE for each slot, the drawBuffers vector will always have exactly IGL_COLOR_ATTACHMENTS_MAX elements. This means glDrawBuffers() will always be called, even when there are no actual color attachments or only one color attachment. Consider checking if there are multiple actual color attachments (non-GL_NONE values) instead of just checking the vector size.
Contributor
|
@corporateshark merged this pull request in adb891c. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glDrawBuffers.xhtml
GL_INVALID_OPERATION is generated if the GL is bound to a framebuffer object and the ith buffer listed in bufs is anything other than GL_NONE or GL_COLOR_ATTACHMENTSi.