Commit Graph

67 Commits

Author SHA1 Message Date
Konstantin Käfer
7f705da564 Sprite store API 2015-07-08 19:45:59 +02:00
Thiago Marcos P. Santos
e32b0b7e20 Introduce GLObjectStore
Make a class for keeping GL objects ids and attach it
to the ThreadContext instead of hanging it on the Environment.
2015-06-25 16:26:21 +03:00
John Firebaugh
3ef8d8728e Don't abandon a null texture 2015-06-18 13:39:18 +03:00
Ansis Brammanis
ff6a5ce5bc Merge remote-tracking branch 'origin/master' into new-labelling
Conflicts:
	src/mbgl/map/source.cpp
	src/mbgl/map/source.hpp
	src/mbgl/map/tile_data.cpp
	src/mbgl/map/tile_parser.cpp
	src/mbgl/map/vector_tile_data.cpp
	src/mbgl/renderer/painter.cpp
	src/mbgl/renderer/symbol_bucket.cpp
	src/mbgl/text/glyph.hpp
	src/mbgl/text/glyph_store.cpp
	src/mbgl/text/placement.cpp
	test/suite
2015-05-28 20:01:15 -04:00
Konstantin Käfer
f4707f72e0 Replace mbgl::util::make_unique<> with std::make_unique<> 2015-05-26 17:57:38 +02:00
Thiago Marcos P. Santos
eaf1c24cdc Do not call abandon texture if there is no texture
Check if the texture was created before abandoning on SpriteAtlas
destructor. Linux driver was fine with that, but was crashing on Mac.
2015-05-22 15:21:39 +03:00
Konstantin Käfer
3cf76ce907 split up glyph_store.cpp into multiple files 2015-05-22 12:30:18 +02:00
Ansis Brammanis
03d5e2da80 port sprite atlas pollution fix
fixes #1398

js: 212760981493460b438f1cc117001825773fad91
https://github.com/mapbox/mapbox-gl-js/pull/1195

The sprite atlas already had two empty pixels between each each icon.
But the icon's real boundary isn't used for drawing. Drawing uses an
icon's box rounded up to the nearest multiple of four. Sometimes this
rounded boundary was directly on the edge of another icon. When the icon
was sampled with linear interpolation it's edge would get polluted with
values from the other icon.

This commit shifts all icons and glyphs by 1px so that there is padding
on all sides of the box being drawn. The quads used for drawing are
shifted in the opposite direction by 1px to compensate for this.
2015-05-19 10:04:46 -07:00
Ansis Brammanis
7abd7950c9 Merge branch 'master' into new-labelling
Conflicts:
	src/mbgl/map/tile_parser.cpp
	src/mbgl/map/tile_parser.hpp
	src/mbgl/renderer/painter.hpp
	src/mbgl/renderer/painter_symbol.cpp
	src/mbgl/renderer/symbol_bucket.cpp
	src/mbgl/renderer/symbol_bucket.hpp
	src/mbgl/text/collision.cpp
	src/mbgl/text/collision.hpp
	src/mbgl/text/placement.cpp
2015-05-19 11:09:33 -04:00
John Firebaugh
63ea3d4bef Don't crash if VAO extensions are not available
Fixes #1585
2015-05-18 16:47:20 -07:00
John Firebaugh
a2344c36c3 Extensible GL extension support 2015-05-13 19:01:58 -07:00
Konstantin Käfer
40b604448f add BinPack test 2015-05-12 20:46:56 -07:00
Konstantin Käfer
b7b532ce28 manage atlas textures with unique_ptrs 2015-05-11 11:28:11 +02:00
Dane Springmeyer
04c73e5ae1 fix integer overflow in line_atlas 2015-05-08 14:52:33 -07:00
Konstantin Käfer
7390062c45 check for errors 2015-05-04 17:33:05 +02:00
Konstantin Käfer
78073d6fdd don't reallocate the Glyph atlas too often
- previously, we reallocated the glyph atlas on every upload. Instead, we're now using glTexSubImage2D to reuse the existing buffer
- we're no longer forcing a texture upload when we remove glyphs; they won't be rendered anyway
- we're now only doing a texture upload once per frame; previously, worker threads that added glyphs mid-render could trigger a texture upload while rendering is in progress
2015-05-04 17:33:05 +02:00
Konstantin Käfer
c43016ce6c make sure we always to a full upload after sprite atlas resizes
We always need to do a full upload to adjust the image buffer size when we adjust the size of our sprite atlas. This can happen when we change the pixelRatio of the map we're rendering.
2015-05-04 17:33:05 +02:00
Konstantin Käfer
97a22b6f5f upload all GL objects before rendering a frame
This moves all texture updates and buffer uploads to the beginning of every frame, before we issue any drawing commands. This means the GPU typically has much more time to upload the data in the background until we actually need it, and doesn't have to pause to store/load the framebuffer.
2015-05-04 17:33:05 +02:00
Konstantin Käfer
c891df0b5f add upload API to gl objects 2015-05-04 17:33:04 +02:00
Jason Wray
4d631623c7 Merge master @ 353e5661de 2015-04-27 17:49:24 -04:00
Ansis Brammanis
f1edce8e21 remove linejoin shader
The previous commit switched to using triangles for drawing round joins.
2015-04-27 11:44:49 +02:00
Ansis Brammanis
148294d3ac Merge branch 'master' into new-labelling
Conflicts:
	src/mbgl/renderer/symbol_bucket.cpp
	src/mbgl/renderer/symbol_bucket.hpp
	src/mbgl/text/collision.cpp
	src/mbgl/text/glyph_store.cpp
	src/mbgl/text/placement.cpp
	src/mbgl/text/rotation_range.cpp
2015-04-03 12:04:31 -07:00
Ansis Brammanis
c49e1ac733 port getAnchors from -js 2015-04-01 20:31:25 -07:00
Ansis Brammanis
1d50485e5b port bboxifyLabel from -js 2015-04-01 19:03:01 -07:00
Ansis Brammanis
fd526ae68e port the remained of CollisionTile 2015-04-01 16:11:48 -07:00
Ansis Brammanis
dda1b770da port collision box debug rendering 2015-04-01 16:11:48 -07:00
Konstantin Käfer
220ebf61dd replace iterator variable types with auto 2015-04-01 16:42:42 +02:00
Konstantin Käfer
268129b9c1 use cumulative hash instead of string for linedash lookup 2015-04-01 15:30:57 +02:00
Ansis Brammanis
19ddaae6cc remove in-shader label flipping 2015-03-30 17:48:52 -07:00
Ansis Brammanis
14e8b4bb09 support wrapped bilinear scaling
to get rid of seams in repeating patterns.

https://github.com/mapbox/mapbox-gl-styles/issues/50#issuecomment-86159351
2015-03-26 10:45:23 +01:00
Ansis Brammanis
9080f25d31 fix sprite padding, fixes
https://github.com/mapbox/mapbox-gl-styles/issues/50#issuecomment-86159351
2015-03-26 10:45:23 +01:00
Ansis Brammanis
24922795c5 height not width, fixes #1038 2015-03-25 13:23:15 -07:00
Konstantin Käfer
61fa436193 coalesce buffer deletions and run them in bulk during rendering
On iOS, the main thread does framebuffer operations just before it requests a rerender of the view contents. This means that GL operations on the Map thread will interfere with that and cause a crash. While most GL operations happen throughout rendering (which is synchronized with the main thread), deletion of shared_ptrs release in turn their OpenGL objects. This may happen at any time and isn't synced with rendering.

This patch changes this so instead of deleting all objects immediately, we are collecting all abandoned IDs and delete them in bulk once the main thread has given us permission to use OpenGL calls (i.e. during render()).
2015-03-20 19:47:54 +01:00
Thiago Marcos P. Santos
ceb7049389 Delete the data buffer of LineAtlas
Data buffer is allocated but never deleted.
2015-03-20 14:38:08 +02:00
Konstantin Käfer
48c55af5c1 fix sprites for pixel ratios that are not 1 and 2
- OpenGL ES 2 doesn't allow NPOT textures with wrap-around
- The Sprite object reported the map's pixelRatio, even though it loaded @2x assets
- Copying icons from the sprite into the atlas now uses bilinear scaling to scale up to the actual size
2015-03-17 12:30:40 +01:00
John Firebaugh
6325f1e25a Index glyph use by tile pointer value, not tile ID
There can be multiple tiles with the same ID, but from different
sources.

Fixes #957
2015-03-13 10:55:49 -07:00
John Firebaugh
762e4bdfbe Clean up GlyphAtlas 2015-03-13 10:55:49 -07:00
Thiago Marcos P. Santos
124b49562d Get rid of printf and cout by using Log::*
Use our logging system that will route the message accordingly on
the target platform.

Fixes #613
2015-03-12 14:19:32 +02:00
John Firebaugh
5fa628bc00 Inline PBFGeometry 2015-03-10 10:31:24 -07:00
John Firebaugh
b7f04ee7c2 Use single geometry format 2015-03-09 18:32:09 -07:00
Justin R. Miller
a6b6a8d67e move to abstract interfaces to more be in line with original API 2015-03-09 11:57:34 -07:00
Justin R. Miller
41c3b82d3e refs #928: bookmarking working build of refactor 2015-03-09 11:57:31 -07:00
Ansis Brammanis
c621441def Fix line label interpolation offset. 2015-02-11 14:12:32 -08:00
Ansis Brammanis
8e459c2a73 improve line label density
Place the first label as close to the beginning of the line as possible.

js: 316ed0bd9bff8cd430ad81d0b6397f396fbce124
2015-02-10 15:21:18 -08:00
Ansis Brammanis
002a709b67 fix copy_bitmap for wrapped bitmaps 2015-02-04 09:54:41 -08:00
Konstantin Käfer
5503aef690 make vaos immovable 2015-02-04 10:49:05 +01:00
Ansis Brammanis
3de43f5f58 fix uninitialized variable warning 2015-02-03 14:44:50 -08:00
Ansis Brammanis
23dd403a25 add wrapped padding to sprite for repeating images
fixes #798
js: e732e784e41bef35bd40de27fdbfa3e8f9588038
2015-02-03 13:17:26 -08:00
Ansis Brammanis
793985580d fix sprite atlas padding and icon centering
Pad each icon with one pixel on the bottom and right sides.

On top of this, extra padding is added to round the widths and heights
to multiples of four.

This then fixes the positions of the bottom and right vertices to
correctly center the icon's box around the center of the icon, not the
center of the padded icon.

js: 32ca4007699d1d21ab25bb38588b151510194030

fixes https://github.com/mapbox/mapbox-gl-js/issues/947
2015-01-27 19:15:22 -08:00
Leith Bade
42d1972732 Merge branch 'master' of github.com:mapbox/mapbox-gl-native into android-mason
Conflicts:
	src/mbgl/renderer/painter_prerender.cpp
	src/mbgl/renderer/prerendered_texture.cpp
	src/mbgl/renderer/prerendered_texture.hpp
2015-01-23 11:11:04 +11:00