Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Restore FBO and Viewport on GL reset - #5938

Closed
kkaefer wants to merge 2 commits into
masterfrom
5938-reset-fbo-viewport
Closed

kkaefer wants to merge 2 commits into
masterfrom
5938-reset-fbo-viewport

Conversation

@kkaefer

@kkaefer kkaefer commented Aug 11, 2016

Copy link
Copy Markdown
Member

When resetting the GL configuration object, we are currently not resetting the Framebuffer binding and the viewport.

@mention-bot

Copy link
Copy Markdown

@kkaefer, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @ansis and @tmpsantos to be potential reviewers.

@kkaefer
kkaefer force-pushed the 5938-reset-fbo-viewport branch from e5bf999 to 1f9da9d Compare August 15, 2016 14:35
@jfirebaugh

Copy link
Copy Markdown
Contributor

The state management makes sense, but is there a reason why we need to add CustomLayerRenderParameters::framebuffer?

@kkaefer

kkaefer commented Aug 22, 2016

Copy link
Copy Markdown
Member Author

The idea of adding framebuffer is to allow custom layers to bind a different framebuffer, then restore the original (main) framebuffer.

@jfirebaugh

Copy link
Copy Markdown
Contributor

In general we don't require that custom layers restore the original GL state. Instead, we call config.setDirty(), which ensures that our own code resets the state when necessary. Can we follow the same pattern for the framebuffer?

@kkaefer

kkaefer commented Aug 22, 2016

Copy link
Copy Markdown
Member Author

@jfirebaugh we don't expect that they reset the state, but exposing the original framebuffer ID allows custom layers to switch to a different (offscreen) FBO, render to that FBO, then switch back to the original FBO and composite the offscreen buffer.

@jfirebaugh

Copy link
Copy Markdown
Contributor

Ah, I understand now. Is glGetIntegerv(GL_FRAMEBUFFER_BINDING, &id) too inefficient to use for that use case?

@jfirebaugh

jfirebaugh commented Aug 22, 2016 •

Copy link
Copy Markdown
Contributor

Also, this addition would need to be plumbed through MGLCustomStyleLayerDrawingHandler in the iOS SDK, which I believe would be a breaking API change. Android on the other hand uses the core CustomLayerRenderParameters struct directly, and because the addition is at the end of the struct I think the change is even ABI compatible there.

@kkaefer

kkaefer commented Aug 23, 2016

Copy link
Copy Markdown
Member Author

Calling glGet* typically stalls the rendering pipeline and introduces considerable delay.

@kkaefer

kkaefer commented Sep 30, 2016

Copy link
Copy Markdown
Member Author

This was mostly merged already.

@kkaefer kkaefer closed this Sep 30, 2016
@kkaefer
kkaefer deleted the 5938-reset-fbo-viewport branch September 30, 2016 10:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants