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

Implement nested layers - #140

Merged
kkaefer merged 15 commits into
masterfrom
composite-layers
May 22, 2014
Merged

kkaefer merged 15 commits into
masterfrom
composite-layers

Conversation

@kkaefer

@kkaefer kkaefer commented May 20, 2014

Copy link
Copy Markdown
Member

No description provided.

@kkaefer kkaefer added the parity label Apr 15, 2014
@incanus

incanus commented Apr 29, 2014

Copy link
Copy Markdown
Contributor

@kkaefer

kkaefer commented Apr 30, 2014

Copy link
Copy Markdown
Member Author

Yes

@kkaefer

kkaefer commented May 13, 2014

Copy link
Copy Markdown
Member Author

Made progress on this yesterday as part of #122. The only part that's missing now is drawing a a framebuffer and compositing this to the previous framebuffer on the stack.

This is a prerequisite for #191

This was referenced May 13, 2014
@kkaefer

kkaefer commented May 19, 2014

Copy link
Copy Markdown
Member Author

Notes:

  • We need to draw the clipping mask to a custom stencil buffer so that we can attach it to the current framebuffer. To make this more efficient, we should draw the clipping mask in one go.
  • Whenever we enter a drawing group, put a new framebuffer on the stack, render everything to it, and after all groups have been drawn, composite it onto the previous framebuffer. This is sort of expensive to do, so we should make sure that we only do this when we don't have other options.
  • Investigate if it's faster to create a separate stencil mask for every FBO to avoid switching. Might be more space-efficient to just have one shared stencil buffer object.
  • The same is true for depth buffers
  • We should request a minimal system-provided set of buffers (i.e. only RGB(A?)), since we're allocating the rest ourselves anyway.

@kkaefer

kkaefer commented May 20, 2014

Copy link
Copy Markdown
Member Author

Basic compositing works. Here are the remaining tasks I'm seeing:

  • Make sure alpha blending works during compositing. Currently it looks like it doesn't
  • Use stencil/depth buffer for composited layers
    • Draw clipping masks into framebuffer's stencil buffer
    • Draw them in one go
  • Make sure this works and performs on iOS

kkaefer added 6 commits May 21, 2014 10:53
background: we are doing separate opaque/translucent passes per composite layer
and then we're compositing them in the translucent phase
still missing:
- stencil+depth mask
- alpha compositing

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@kkaefer Just FYI, this is going to conflict with the the new style format parsing changes that I'm working on for #172 in the issue172-newstyle branch. I don't see that as a problem, but it is something we'll probably have to deal with eventually. Shouldn't be too hard to fix.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure, we'll deal with this when merging. This is just a reorganization of the code, no functionality change.

@ghost ghost mentioned this pull request May 21, 2014
@ghost ghost mentioned this pull request May 22, 2014
53 of 81 tasks
@ghost

ghost commented May 22, 2014

Copy link
Copy Markdown

@kkaefer

kkaefer commented May 22, 2014

Copy link
Copy Markdown
Member Author

A few performance notes on iOS:

  • iOS seems to have a "default" framebuffer value of 1.
  • We should avoid binding/reverting framebuffers all the time. Instead, we should first draw all the individual layers, then bind the default framebuffer and render everything.
  • Blending of a full screen texture seems very slow.

@kkaefer

kkaefer commented May 22, 2014

Copy link
Copy Markdown
Member Author

Device rotation fails, ticketed in cutting-room-floor/mapbox-gl-cocoa#18

Conflicts:
	src/shader/shaders_gl.cpp
	src/shader/shaders_gles2.cpp
@kkaefer
kkaefer merged commit 04e70b2 into master May 22, 2014
@kkaefer

kkaefer commented May 22, 2014

Copy link
Copy Markdown
Member Author

So nested layers aren't very fast. If we can avoid them, we should.

What sort of use cases do you have for composited layers?

ghost pushed a commit that referenced this pull request May 22, 2014
@yhahn
yhahn deleted the composite-layers branch May 30, 2014 00:34
mikemorris added a commit that referenced this pull request Aug 21, 2015
Remove mbgl::Environment from logging
acalcutt pushed a commit to acalcutt/mapbox-gl-native that referenced this pull request Apr 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

GL JS parity For feature parity with Mapbox GL JS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants