{"action":"created","comment":{"url":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments/61257437","id":61257437,"diff_hunk":"@@ -144,6 +185,10 @@ void TileWorker::setScene(std::shared_ptr<Scene>& _scene) {\n     }\n }\n \n+void TileWorker::notifyAll() {\n+    m_condition.notify_all();\n+}\n+","path":"core/src/tile/tileWorker.cpp","position":79,"original_position":79,"commit_id":"c9c89fd32961a936ad1878aa91fdbbd1a8d0923d","original_commit_id":"c9c89fd32961a936ad1878aa91fdbbd1a8d0923d","user":{"login":"tallytalwar","id":360641,"avatar_url":"https://avatars.githubusercontent.com/u/360641?v=3","gravatar_id":"","url":"https://api.github.com/users/tallytalwar","html_url":"https://github.com/tallytalwar","followers_url":"https://api.github.com/users/tallytalwar/followers","following_url":"https://api.github.com/users/tallytalwar/following{/other_user}","gists_url":"https://api.github.com/users/tallytalwar/gists{/gist_id}","starred_url":"https://api.github.com/users/tallytalwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tallytalwar/subscriptions","organizations_url":"https://api.github.com/users/tallytalwar/orgs","repos_url":"https://api.github.com/users/tallytalwar/repos","events_url":"https://api.github.com/users/tallytalwar/events{/privacy}","received_events_url":"https://api.github.com/users/tallytalwar/received_events","type":"User","site_admin":false},"body":"Since tasks are requeued within the worker if a dependent task is not ready, we need to inform/notify the worker to run again on the \"conditions\" if one of the dependent tasks finishes.\r\n\r\nso notifyAll is called from rasterCallback!\r\n\r\nAlso, its possible workers are done and waiting for a notification, when a task was cancelled, so all workers are notified on a task cancel from the main thread. (This might have some redundant notifications when a task was cancelled from the main thread and workers are not waiting on anything but are in middle of building a tile)","created_at":"2016-04-27T13:36:20Z","updated_at":"2016-04-27T13:36:20Z","html_url":"https://github.com/tangrams/tangram-es/pull/700#discussion_r61257437","pull_request_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/700","_links":{"self":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments/61257437"},"html":{"href":"https://github.com/tangrams/tangram-es/pull/700#discussion_r61257437"},"pull_request":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/700"}}},"pull_request":{"url":"https://api.github.com/repos/tangrams/tangram-es/pulls/700","id":67617347,"html_url":"https://github.com/tangrams/tangram-es/pull/700","diff_url":"https://github.com/tangrams/tangram-es/pull/700.diff","patch_url":"https://github.com/tangrams/tangram-es/pull/700.patch","issue_url":"https://api.github.com/repos/tangrams/tangram-es/issues/700","number":700,"state":"open","locked":false,"title":"Raster source","user":{"login":"tallytalwar","id":360641,"avatar_url":"https://avatars.githubusercontent.com/u/360641?v=3","gravatar_id":"","url":"https://api.github.com/users/tallytalwar","html_url":"https://github.com/tallytalwar","followers_url":"https://api.github.com/users/tallytalwar/followers","following_url":"https://api.github.com/users/tallytalwar/following{/other_user}","gists_url":"https://api.github.com/users/tallytalwar/gists{/gist_id}","starred_url":"https://api.github.com/users/tallytalwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tallytalwar/subscriptions","organizations_url":"https://api.github.com/users/tallytalwar/orgs","repos_url":"https://api.github.com/users/tallytalwar/repos","events_url":"https://api.github.com/users/tallytalwar/events{/privacy}","received_events_url":"https://api.github.com/users/tallytalwar/received_events","type":"User","site_admin":false},"body":"Refer Tangram PR for conceptual details: https://github.com/tangrams/tangram/pull/282\r\n\r\nSome of the technical details in this PR specific to implementation on tangram-es\r\n\r\n- Each `TileTask` can have a set of extra dependent tasks (`m_rasterTasks`) responsible to \"Download\" the raster textures from appropriate DataSources. The `tileWorker`s continue to build the tile geometry and once done will try to assign rasters from the dependent raster tasks, if these are done. Else the built tile is stored in the parent tileTask and requeued for the tileWorkers to pick it again for completing the tile with its set of rasters (when done). A dependent raster task has a valid raster even even the download resulted in bad/no data. Once done the downloaded Textures are stored with their corresponding \"overzoomed\" tileIDs (just x/y/z) in the built `Tile`.\r\nNote: All these download tasks are restricted within the bounds of the `MAX_DOWNLOADS`!\r\n\r\n  - Dependent raster tasks is loaded with a specific callback (`TileManager::m_rasterCallback`) which will notify the tile workers when a raster task has a valid raster (`TileTask::hasRaster`), which then makes the worker blocking on this raster tasks's rasters to finish, continue setting the tile with appropriate raster textures.\r\n\r\n- `RasterSource` is the central storage for all the raster textures belonging to itself. `Tile`s will share references to these `textures` stored in the `RasterSource`. `Texture` in the datasource will only be deleted when:\r\n  - all the `tile`s referring the `texture` are popped from the `TileCache`, that is when there is only one reference to the `Texture` which is the one stored in the `RasterSource` itself.\r\n  - Textures are keyed on TileID's x/y/z and ignores TileID.s and TileID.w (similar to how RawDataCache is cached).\r\n  - Note: Maybe Texture deletion logic could be more aggressive and take DataSource RawDataCache into account. Currently this is not being done.\r\n\r\n- `Rasters` structure\r\n  - This stores a `shared` reference of the raster texture and the corresponding **overzoomed** `TileID`. This `TileID` is used to determine the texture `offset` and `position` when the raster tile is overzoomed.\r\n  - Tile stores a vector of these `Rasters`, which is then used to bind and upload the raster textures at draw time.\r\n\r\n- Raster sampler shader injection\r\n  - Any style which defines a `rasters` (values: `color`/`normal`/`custom`), will have shader injections to define texture/raster samplers. The number of samplers injected will be dependent on the number of rasters textures a tile has.\r\n\r\nNote: We now have a `default` **1x1 black texture**. If for any reason (no valid texture data from a raster datasource, or bad texture image, etc) texture creation fails, a default 1x1 black pixel texture is created to avoid having random texture unit state set at draw time. This now mimics the behavior we have on JS side.\r\n\r\nGeneric Note: The commit history here has a couple of implementation for TileManagement. I will try my best to squash some of these commits, but appologies if the history looks dirty. It will be better not to look at the commit history while reviewing the PR and to instead look at the actual diff with master.","created_at":"2016-04-23T20:17:19Z","updated_at":"2016-04-27T13:36:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ef9592862dfc090cc838c5592d83f33dc020d1c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/700/commits","review_comments_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/700/comments","review_comment_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tangrams/tangram-es/issues/700/comments","statuses_url":"https://api.github.com/repos/tangrams/tangram-es/statuses/c9c89fd32961a936ad1878aa91fdbbd1a8d0923d","head":{"label":"tangrams:raster-source-rasterCallbacks","ref":"raster-source-rasterCallbacks","sha":"c9c89fd32961a936ad1878aa91fdbbd1a8d0923d","user":{"login":"tangrams","id":8495302,"avatar_url":"https://avatars.githubusercontent.com/u/8495302?v=3","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"repo":{"id":23391501,"name":"tangram-es","full_name":"tangrams/tangram-es","owner":{"login":"tangrams","id":8495302,"avatar_url":"https://avatars.githubusercontent.com/u/8495302?v=3","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tangrams/tangram-es","description":"2D and 3D map renderer using OpenGL ES","fork":false,"url":"https://api.github.com/repos/tangrams/tangram-es","forks_url":"https://api.github.com/repos/tangrams/tangram-es/forks","keys_url":"https://api.github.com/repos/tangrams/tangram-es/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tangrams/tangram-es/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tangrams/tangram-es/teams","hooks_url":"https://api.github.com/repos/tangrams/tangram-es/hooks","issue_events_url":"https://api.github.com/repos/tangrams/tangram-es/issues/events{/number}","events_url":"https://api.github.com/repos/tangrams/tangram-es/events","assignees_url":"https://api.github.com/repos/tangrams/tangram-es/assignees{/user}","branches_url":"https://api.github.com/repos/tangrams/tangram-es/branches{/branch}","tags_url":"https://api.github.com/repos/tangrams/tangram-es/tags","blobs_url":"https://api.github.com/repos/tangrams/tangram-es/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tangrams/tangram-es/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tangrams/tangram-es/git/refs{/sha}","trees_url":"https://api.github.com/repos/tangrams/tangram-es/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tangrams/tangram-es/statuses/{sha}","languages_url":"https://api.github.com/repos/tangrams/tangram-es/languages","stargazers_url":"https://api.github.com/repos/tangrams/tangram-es/stargazers","contributors_url":"https://api.github.com/repos/tangrams/tangram-es/contributors","subscribers_url":"https://api.github.com/repos/tangrams/tangram-es/subscribers","subscription_url":"https://api.github.com/repos/tangrams/tangram-es/subscription","commits_url":"https://api.github.com/repos/tangrams/tangram-es/commits{/sha}","git_commits_url":"https://api.github.com/repos/tangrams/tangram-es/git/commits{/sha}","comments_url":"https://api.github.com/repos/tangrams/tangram-es/comments{/number}","issue_comment_url":"https://api.github.com/repos/tangrams/tangram-es/issues/comments{/number}","contents_url":"https://api.github.com/repos/tangrams/tangram-es/contents/{+path}","compare_url":"https://api.github.com/repos/tangrams/tangram-es/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tangrams/tangram-es/merges","archive_url":"https://api.github.com/repos/tangrams/tangram-es/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tangrams/tangram-es/downloads","issues_url":"https://api.github.com/repos/tangrams/tangram-es/issues{/number}","pulls_url":"https://api.github.com/repos/tangrams/tangram-es/pulls{/number}","milestones_url":"https://api.github.com/repos/tangrams/tangram-es/milestones{/number}","notifications_url":"https://api.github.com/repos/tangrams/tangram-es/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tangrams/tangram-es/labels{/name}","releases_url":"https://api.github.com/repos/tangrams/tangram-es/releases{/id}","deployments_url":"https://api.github.com/repos/tangrams/tangram-es/deployments","created_at":"2014-08-27T13:56:56Z","updated_at":"2016-04-25T21:47:00Z","pushed_at":"2016-04-27T11:30:59Z","git_url":"git://github.com/tangrams/tangram-es.git","ssh_url":"git@github.com:tangrams/tangram-es.git","clone_url":"https://github.com/tangrams/tangram-es.git","svn_url":"https://github.com/tangrams/tangram-es","homepage":"","size":36531,"stargazers_count":114,"watchers_count":114,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":53,"forks":34,"open_issues":53,"watchers":114,"default_branch":"master"}},"base":{"label":"tangrams:master","ref":"master","sha":"9ac4ed403f4fe7b042ac9f32f75639dfba8bf64c","user":{"login":"tangrams","id":8495302,"avatar_url":"https://avatars.githubusercontent.com/u/8495302?v=3","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"repo":{"id":23391501,"name":"tangram-es","full_name":"tangrams/tangram-es","owner":{"login":"tangrams","id":8495302,"avatar_url":"https://avatars.githubusercontent.com/u/8495302?v=3","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tangrams/tangram-es","description":"2D and 3D map renderer using OpenGL ES","fork":false,"url":"https://api.github.com/repos/tangrams/tangram-es","forks_url":"https://api.github.com/repos/tangrams/tangram-es/forks","keys_url":"https://api.github.com/repos/tangrams/tangram-es/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tangrams/tangram-es/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tangrams/tangram-es/teams","hooks_url":"https://api.github.com/repos/tangrams/tangram-es/hooks","issue_events_url":"https://api.github.com/repos/tangrams/tangram-es/issues/events{/number}","events_url":"https://api.github.com/repos/tangrams/tangram-es/events","assignees_url":"https://api.github.com/repos/tangrams/tangram-es/assignees{/user}","branches_url":"https://api.github.com/repos/tangrams/tangram-es/branches{/branch}","tags_url":"https://api.github.com/repos/tangrams/tangram-es/tags","blobs_url":"https://api.github.com/repos/tangrams/tangram-es/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tangrams/tangram-es/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tangrams/tangram-es/git/refs{/sha}","trees_url":"https://api.github.com/repos/tangrams/tangram-es/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tangrams/tangram-es/statuses/{sha}","languages_url":"https://api.github.com/repos/tangrams/tangram-es/languages","stargazers_url":"https://api.github.com/repos/tangrams/tangram-es/stargazers","contributors_url":"https://api.github.com/repos/tangrams/tangram-es/contributors","subscribers_url":"https://api.github.com/repos/tangrams/tangram-es/subscribers","subscription_url":"https://api.github.com/repos/tangrams/tangram-es/subscription","commits_url":"https://api.github.com/repos/tangrams/tangram-es/commits{/sha}","git_commits_url":"https://api.github.com/repos/tangrams/tangram-es/git/commits{/sha}","comments_url":"https://api.github.com/repos/tangrams/tangram-es/comments{/number}","issue_comment_url":"https://api.github.com/repos/tangrams/tangram-es/issues/comments{/number}","contents_url":"https://api.github.com/repos/tangrams/tangram-es/contents/{+path}","compare_url":"https://api.github.com/repos/tangrams/tangram-es/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tangrams/tangram-es/merges","archive_url":"https://api.github.com/repos/tangrams/tangram-es/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tangrams/tangram-es/downloads","issues_url":"https://api.github.com/repos/tangrams/tangram-es/issues{/number}","pulls_url":"https://api.github.com/repos/tangrams/tangram-es/pulls{/number}","milestones_url":"https://api.github.com/repos/tangrams/tangram-es/milestones{/number}","notifications_url":"https://api.github.com/repos/tangrams/tangram-es/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tangrams/tangram-es/labels{/name}","releases_url":"https://api.github.com/repos/tangrams/tangram-es/releases{/id}","deployments_url":"https://api.github.com/repos/tangrams/tangram-es/deployments","created_at":"2014-08-27T13:56:56Z","updated_at":"2016-04-25T21:47:00Z","pushed_at":"2016-04-27T11:30:59Z","git_url":"git://github.com/tangrams/tangram-es.git","ssh_url":"git@github.com:tangrams/tangram-es.git","clone_url":"https://github.com/tangrams/tangram-es.git","svn_url":"https://github.com/tangrams/tangram-es","homepage":"","size":36531,"stargazers_count":114,"watchers_count":114,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":53,"forks":34,"open_issues":53,"watchers":114,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/700"},"html":{"href":"https://github.com/tangrams/tangram-es/pull/700"},"issue":{"href":"https://api.github.com/repos/tangrams/tangram-es/issues/700"},"comments":{"href":"https://api.github.com/repos/tangrams/tangram-es/issues/700/comments"},"review_comments":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/700/comments"},"review_comment":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/700/commits"},"statuses":{"href":"https://api.github.com/repos/tangrams/tangram-es/statuses/c9c89fd32961a936ad1878aa91fdbbd1a8d0923d"}}}}