{"action":"created","comment":{"url":"https://api.github.com/repos/google/shaderc/pulls/comments/50171885","id":50171885,"diff_hunk":"@@ -85,6 +96,60 @@ struct {\n \n std::mutex compile_mutex;  // Guards shaderc_compile_*.\n \n+// A wrapper functor class to be used as stage deducer for libshaderc_util\n+// Compile() interface. When the given shader kind is one of the default shader\n+// kinds, this functor will be called if #pragma is not found in the source\n+// code. And it returns the corresponding shader stage. When the shader kind is\n+// a forced shader kind, this functor won't be called and it simply returns\n+// EShLangCount to make the syntax correct. When the shader kind is set to\n+// shaderc_glsl_deduce_from_pragma, this functor also returns EShLangCount, but\n+// the compiler should emit error if #pragma annotation is not found in this\n+// case.\n+class StageDeducer {\n+ public:\n+  StageDeducer(shaderc_shader_kind kind) : kind_(kind){};\n+  EShLanguage operator()(std::ostream* error_stream,\n+                         const shaderc_util::string_piece& error_tag) const {\n+    EShLanguage stage = GetDefaultStage(kind_);\n+    if (stage == EShLangCount) {\n+      *error_stream << \"libshaderc error: '\" << error_tag","path":"libshaderc/src/shaderc.cc","position":61,"original_position":61,"commit_id":"980bbd06a49a401a04a002f8110d1b8c1d687c9b","original_commit_id":"980bbd06a49a401a04a002f8110d1b8c1d687c9b","user":{"login":"AWoloszyn","id":9043212,"avatar_url":"https://avatars.githubusercontent.com/u/9043212?v=3","gravatar_id":"","url":"https://api.github.com/users/AWoloszyn","html_url":"https://github.com/AWoloszyn","followers_url":"https://api.github.com/users/AWoloszyn/followers","following_url":"https://api.github.com/users/AWoloszyn/following{/other_user}","gists_url":"https://api.github.com/users/AWoloszyn/gists{/gist_id}","starred_url":"https://api.github.com/users/AWoloszyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AWoloszyn/subscriptions","organizations_url":"https://api.github.com/users/AWoloszyn/orgs","repos_url":"https://api.github.com/users/AWoloszyn/repos","events_url":"https://api.github.com/users/AWoloszyn/events{/privacy}","received_events_url":"https://api.github.com/users/AWoloszyn/received_events","type":"User","site_admin":false},"body":"I don't see any examples elsewhere, but we probably don't have to specify that it is a libshaderc error something like\r\n\r\n*error_stream << \"error: '\" << error_tag << \"' could not determine the shader stage\"","created_at":"2016-01-19T20:39:48Z","updated_at":"2016-01-19T20:39:48Z","html_url":"https://github.com/google/shaderc/pull/89#discussion_r50171885","pull_request_url":"https://api.github.com/repos/google/shaderc/pulls/89","_links":{"self":{"href":"https://api.github.com/repos/google/shaderc/pulls/comments/50171885"},"html":{"href":"https://github.com/google/shaderc/pull/89#discussion_r50171885"},"pull_request":{"href":"https://api.github.com/repos/google/shaderc/pulls/89"}}},"pull_request":{"url":"https://api.github.com/repos/google/shaderc/pulls/89","id":56391443,"html_url":"https://github.com/google/shaderc/pull/89","diff_url":"https://github.com/google/shaderc/pull/89.diff","patch_url":"https://github.com/google/shaderc/pull/89.patch","issue_url":"https://api.github.com/repos/google/shaderc/issues/89","number":89,"state":"open","locked":false,"title":"Set deducer","user":{"login":"Qining","id":2983685,"avatar_url":"https://avatars.githubusercontent.com/u/2983685?v=3","gravatar_id":"","url":"https://api.github.com/users/Qining","html_url":"https://github.com/Qining","followers_url":"https://api.github.com/users/Qining/followers","following_url":"https://api.github.com/users/Qining/following{/other_user}","gists_url":"https://api.github.com/users/Qining/gists{/gist_id}","starred_url":"https://api.github.com/users/Qining/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Qining/subscriptions","organizations_url":"https://api.github.com/users/Qining/orgs","repos_url":"https://api.github.com/users/Qining/repos","events_url":"https://api.github.com/users/Qining/events{/privacy}","received_events_url":"https://api.github.com/users/Qining/received_events","type":"User","site_admin":false},"body":"Have something I feel unsure.","created_at":"2016-01-18T21:07:42Z","updated_at":"2016-01-19T20:39:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"26112b7632c915fe97a0bf244335e8ef845ebbb3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/google/shaderc/pulls/89/commits","review_comments_url":"https://api.github.com/repos/google/shaderc/pulls/89/comments","review_comment_url":"https://api.github.com/repos/google/shaderc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/shaderc/issues/89/comments","statuses_url":"https://api.github.com/repos/google/shaderc/statuses/980bbd06a49a401a04a002f8110d1b8c1d687c9b","head":{"label":"Qining:set-deducer","ref":"set-deducer","sha":"980bbd06a49a401a04a002f8110d1b8c1d687c9b","user":{"login":"Qining","id":2983685,"avatar_url":"https://avatars.githubusercontent.com/u/2983685?v=3","gravatar_id":"","url":"https://api.github.com/users/Qining","html_url":"https://github.com/Qining","followers_url":"https://api.github.com/users/Qining/followers","following_url":"https://api.github.com/users/Qining/following{/other_user}","gists_url":"https://api.github.com/users/Qining/gists{/gist_id}","starred_url":"https://api.github.com/users/Qining/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Qining/subscriptions","organizations_url":"https://api.github.com/users/Qining/orgs","repos_url":"https://api.github.com/users/Qining/repos","events_url":"https://api.github.com/users/Qining/events{/privacy}","received_events_url":"https://api.github.com/users/Qining/received_events","type":"User","site_admin":false},"repo":{"id":48245210,"name":"shaderc","full_name":"Qining/shaderc","owner":{"login":"Qining","id":2983685,"avatar_url":"https://avatars.githubusercontent.com/u/2983685?v=3","gravatar_id":"","url":"https://api.github.com/users/Qining","html_url":"https://github.com/Qining","followers_url":"https://api.github.com/users/Qining/followers","following_url":"https://api.github.com/users/Qining/following{/other_user}","gists_url":"https://api.github.com/users/Qining/gists{/gist_id}","starred_url":"https://api.github.com/users/Qining/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Qining/subscriptions","organizations_url":"https://api.github.com/users/Qining/orgs","repos_url":"https://api.github.com/users/Qining/repos","events_url":"https://api.github.com/users/Qining/events{/privacy}","received_events_url":"https://api.github.com/users/Qining/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Qining/shaderc","description":"A collection of tools, libraries and tests for shader compilation.","fork":true,"url":"https://api.github.com/repos/Qining/shaderc","forks_url":"https://api.github.com/repos/Qining/shaderc/forks","keys_url":"https://api.github.com/repos/Qining/shaderc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Qining/shaderc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Qining/shaderc/teams","hooks_url":"https://api.github.com/repos/Qining/shaderc/hooks","issue_events_url":"https://api.github.com/repos/Qining/shaderc/issues/events{/number}","events_url":"https://api.github.com/repos/Qining/shaderc/events","assignees_url":"https://api.github.com/repos/Qining/shaderc/assignees{/user}","branches_url":"https://api.github.com/repos/Qining/shaderc/branches{/branch}","tags_url":"https://api.github.com/repos/Qining/shaderc/tags","blobs_url":"https://api.github.com/repos/Qining/shaderc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Qining/shaderc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Qining/shaderc/git/refs{/sha}","trees_url":"https://api.github.com/repos/Qining/shaderc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Qining/shaderc/statuses/{sha}","languages_url":"https://api.github.com/repos/Qining/shaderc/languages","stargazers_url":"https://api.github.com/repos/Qining/shaderc/stargazers","contributors_url":"https://api.github.com/repos/Qining/shaderc/contributors","subscribers_url":"https://api.github.com/repos/Qining/shaderc/subscribers","subscription_url":"https://api.github.com/repos/Qining/shaderc/subscription","commits_url":"https://api.github.com/repos/Qining/shaderc/commits{/sha}","git_commits_url":"https://api.github.com/repos/Qining/shaderc/git/commits{/sha}","comments_url":"https://api.github.com/repos/Qining/shaderc/comments{/number}","issue_comment_url":"https://api.github.com/repos/Qining/shaderc/issues/comments{/number}","contents_url":"https://api.github.com/repos/Qining/shaderc/contents/{+path}","compare_url":"https://api.github.com/repos/Qining/shaderc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Qining/shaderc/merges","archive_url":"https://api.github.com/repos/Qining/shaderc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Qining/shaderc/downloads","issues_url":"https://api.github.com/repos/Qining/shaderc/issues{/number}","pulls_url":"https://api.github.com/repos/Qining/shaderc/pulls{/number}","milestones_url":"https://api.github.com/repos/Qining/shaderc/milestones{/number}","notifications_url":"https://api.github.com/repos/Qining/shaderc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Qining/shaderc/labels{/name}","releases_url":"https://api.github.com/repos/Qining/shaderc/releases{/id}","created_at":"2015-12-18T16:31:32Z","updated_at":"2015-12-18T16:31:32Z","pushed_at":"2016-01-19T16:50:14Z","git_url":"git://github.com/Qining/shaderc.git","ssh_url":"git@github.com:Qining/shaderc.git","clone_url":"https://github.com/Qining/shaderc.git","svn_url":"https://github.com/Qining/shaderc","homepage":"","size":538,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"7de2d3bc834f3e4948e6340336f7742acb6c3b34","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":40277133,"name":"shaderc","full_name":"google/shaderc","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/shaderc","description":"A collection of tools, libraries and tests for shader compilation.","fork":false,"url":"https://api.github.com/repos/google/shaderc","forks_url":"https://api.github.com/repos/google/shaderc/forks","keys_url":"https://api.github.com/repos/google/shaderc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/shaderc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/shaderc/teams","hooks_url":"https://api.github.com/repos/google/shaderc/hooks","issue_events_url":"https://api.github.com/repos/google/shaderc/issues/events{/number}","events_url":"https://api.github.com/repos/google/shaderc/events","assignees_url":"https://api.github.com/repos/google/shaderc/assignees{/user}","branches_url":"https://api.github.com/repos/google/shaderc/branches{/branch}","tags_url":"https://api.github.com/repos/google/shaderc/tags","blobs_url":"https://api.github.com/repos/google/shaderc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/shaderc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/shaderc/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/shaderc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/shaderc/statuses/{sha}","languages_url":"https://api.github.com/repos/google/shaderc/languages","stargazers_url":"https://api.github.com/repos/google/shaderc/stargazers","contributors_url":"https://api.github.com/repos/google/shaderc/contributors","subscribers_url":"https://api.github.com/repos/google/shaderc/subscribers","subscription_url":"https://api.github.com/repos/google/shaderc/subscription","commits_url":"https://api.github.com/repos/google/shaderc/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/shaderc/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/shaderc/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/shaderc/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/shaderc/contents/{+path}","compare_url":"https://api.github.com/repos/google/shaderc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/shaderc/merges","archive_url":"https://api.github.com/repos/google/shaderc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/shaderc/downloads","issues_url":"https://api.github.com/repos/google/shaderc/issues{/number}","pulls_url":"https://api.github.com/repos/google/shaderc/pulls{/number}","milestones_url":"https://api.github.com/repos/google/shaderc/milestones{/number}","notifications_url":"https://api.github.com/repos/google/shaderc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/shaderc/labels{/name}","releases_url":"https://api.github.com/repos/google/shaderc/releases{/id}","created_at":"2015-08-06T01:17:42Z","updated_at":"2016-01-17T21:28:19Z","pushed_at":"2016-01-19T16:50:15Z","git_url":"git://github.com/google/shaderc.git","ssh_url":"git@github.com:google/shaderc.git","clone_url":"https://github.com/google/shaderc.git","svn_url":"https://github.com/google/shaderc","homepage":"","size":533,"stargazers_count":139,"watchers_count":139,"language":"C++","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":7,"forks":14,"open_issues":7,"watchers":139,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/shaderc/pulls/89"},"html":{"href":"https://github.com/google/shaderc/pull/89"},"issue":{"href":"https://api.github.com/repos/google/shaderc/issues/89"},"comments":{"href":"https://api.github.com/repos/google/shaderc/issues/89/comments"},"review_comments":{"href":"https://api.github.com/repos/google/shaderc/pulls/89/comments"},"review_comment":{"href":"https://api.github.com/repos/google/shaderc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/shaderc/pulls/89/commits"},"statuses":{"href":"https://api.github.com/repos/google/shaderc/statuses/980bbd06a49a401a04a002f8110d1b8c1d687c9b"}}}}