-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
4d72bf3
to
0af0bff
Compare
8241202
to
b9f97d9
Compare
CI failures are caused due to recent unrelated GL JS changes - will solve those once mapbox/mapbox-gl-js#7178 is merged. |
Mapbox GL JS benchmark results for reference: mapbox/mapbox-gl-js#7178 (comment) |
9b43af8
to
a8441b3
Compare
65bc3b4
to
1072d4c
Compare
Same as last week (#12725 (comment)), recent GL JS changes are causing CI to fail. |
@brunoabinader sorry about that! hoping to merge #12284 asap and that should resolve failures. |
Thank you @mollymerp 🙇♂️ @nagineni is going to push this forward while I'm on vacations. |
I started to implement the same feedback given to the JS version to this PR. See https://github.com/mapbox/mapbox-gl-native/tree/anderco-face-culling |
1072d4c
to
556ff4e
Compare
Add a parameter to Program::draw to control whether face culling should be enabled. This will be used in a follow up commit to enable face culling for fill extrusion layers.
Use face culling for fill extrusion layers. Winding order is changed to ensure correct rendering.
Custom layers are not implemented in node platform so ignore tests that require it.
556ff4e
to
bdf7320
Compare
I updated this PR to match what was done in mapbox/mapbox-gl-js#7178, so face culling is only enabled for fill extrusion layers by adding a face culling mode parameter to Program::draw(). /cc @ansis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks!
This is a common OpenGL optimization technique that skips rendering e.g. back-facing triangles. For that, we need to apply a common winding order (either clockwise or counter-clockwise) when ordering the triangle vertices we use when drawing.
When enabling face culling, GL culls back-facing triangles and assumes front-facing triangles being ones ordered counter-clockwise by default. This required some changes in our winding order when populating our buckets.
We enable face culling by default. We apply counter-clockwise winding order for culling back-facing triangles when rendering in the main buffer, and clockwise winding order for culling front-facing triangles when rendering offscreen (heatmaps, hillshade and fill extrusions). We disable face culling when rendering custom layers.
Depends on mapbox/mapbox-gl-js#7178.