{"action":"created","comment":{"url":"https://api.github.com/repos/baldurk/renderdoc/pulls/comments/94080798","pull_request_review_id":14611497,"id":94080798,"diff_hunk":"@@ -148,48 +278,54 @@ vector<CounterResult> GLReplay::FetchCounters(const vector<uint32_t> &counters)\n \n   MakeCurrentReplayContext(&m_ReplayCtx);\n \n-  uint32_t counterID = counters[0];\n-  RDCASSERT(counters.size() == 1);\n-  RDCASSERT(counterID == eCounter_EventGPUDuration);\n-\n-  SCOPED_TIMER(\"Fetch Counters for %u\", counterID);\n-\n   CounterContext ctx;\n \n   for(int loop = 0; loop < 1; loop++)\n   {\n     ctx.eventStart = 0;\n     ctx.reuseIdx = loop == 0 ? -1 : 0;\n-    FillTimers(ctx, m_pDriver->GetRootDraw());\n+    m_pDriver->SetFetchCounters(true);\n+    FillTimers(ctx, m_pDriver->GetRootDraw(), counters);\n+    m_pDriver->SetFetchCounters(false);\n \n     double nanosToSecs = 1.0 / 1000000000.0;\n \n     GLuint prevbind = 0;\n     m_pDriver->glGetIntegerv(eGL_QUERY_BUFFER_BINDING, (GLint *)&prevbind);\n     m_pDriver->glBindBuffer(eGL_QUERY_BUFFER, 0);\n \n-    for(size_t i = 0; i < ctx.timers.size(); i++)\n+    for(size_t i = 0; i < ctx.queries.size(); i++)\n     {\n-      if(ctx.timers[i].obj)\n-      {\n-        GLuint elapsed = 0;\n-        m_pDriver->glGetQueryObjectuiv(ctx.timers[i].obj, eGL_QUERY_RESULT, &elapsed);\n-\n-        double duration = double(elapsed) * nanosToSecs;\n-\n-        ret.push_back(CounterResult(ctx.timers[i].eventID, counterID, duration));\n-      }\n-      else\n+      for(uint32_t c = 0; c < counters.size(); c++)\n       {\n-        ret.push_back(CounterResult(ctx.timers[i].eventID, counterID, 0.0));\n+        if(ctx.queries[i].obj[counters[c]])\n+        {\n+          GLuint64 data = 0;\n+          m_pDriver->glGetQueryObjectui64v(ctx.queries[i].obj[counters[c]], eGL_QUERY_RESULT, &data);\n+\n+          if(m_pDriver->glGetError())\n+            data = 3440434404;","path":"renderdoc/driver/gl/gl_counters.cpp","position":308,"original_position":308,"commit_id":"3e3d9e2d2252566683e886d848714b326ab79791","original_commit_id":"3e3d9e2d2252566683e886d848714b326ab79791","user":{"login":"baldurk","id":661798,"avatar_url":"https://avatars.githubusercontent.com/u/661798?v=3","gravatar_id":"","url":"https://api.github.com/users/baldurk","html_url":"https://github.com/baldurk","followers_url":"https://api.github.com/users/baldurk/followers","following_url":"https://api.github.com/users/baldurk/following{/other_user}","gists_url":"https://api.github.com/users/baldurk/gists{/gist_id}","starred_url":"https://api.github.com/users/baldurk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baldurk/subscriptions","organizations_url":"https://api.github.com/users/baldurk/orgs","repos_url":"https://api.github.com/users/baldurk/repos","events_url":"https://api.github.com/users/baldurk/events{/privacy}","received_events_url":"https://api.github.com/users/baldurk/received_events","type":"User","site_admin":false},"body":"Oh right, I didn't see that at all!\r\n\r\nCurrently these counters aren't actually being printed in the UI anywhere anyway right? I think having -1 as an error value works because then it's easy to check for in code as an invalid value and return it. Although note it would need to be converted to -1.0f for floating point data types.","created_at":"2016-12-28T21:44:29Z","updated_at":"2016-12-28T21:44:29Z","html_url":"https://github.com/baldurk/renderdoc/pull/469#discussion_r94080798","pull_request_url":"https://api.github.com/repos/baldurk/renderdoc/pulls/469","_links":{"self":{"href":"https://api.github.com/repos/baldurk/renderdoc/pulls/comments/94080798"},"html":{"href":"https://github.com/baldurk/renderdoc/pull/469#discussion_r94080798"},"pull_request":{"href":"https://api.github.com/repos/baldurk/renderdoc/pulls/469"}}},"pull_request":{"url":"https://api.github.com/repos/baldurk/renderdoc/pulls/469","id":99533462,"html_url":"https://github.com/baldurk/renderdoc/pull/469","diff_url":"https://github.com/baldurk/renderdoc/pull/469.diff","patch_url":"https://github.com/baldurk/renderdoc/pull/469.patch","issue_url":"https://api.github.com/repos/baldurk/renderdoc/issues/469","number":469,"state":"open","locked":false,"title":"Implemented OpenGL counters using pipeline stats and occlusion queries","user":{"login":"victor-moya","id":24520979,"avatar_url":"https://avatars.githubusercontent.com/u/24520979?v=3","gravatar_id":"","url":"https://api.github.com/users/victor-moya","html_url":"https://github.com/victor-moya","followers_url":"https://api.github.com/users/victor-moya/followers","following_url":"https://api.github.com/users/victor-moya/following{/other_user}","gists_url":"https://api.github.com/users/victor-moya/gists{/gist_id}","starred_url":"https://api.github.com/users/victor-moya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/victor-moya/subscriptions","organizations_url":"https://api.github.com/users/victor-moya/orgs","repos_url":"https://api.github.com/users/victor-moya/repos","events_url":"https://api.github.com/users/victor-moya/events{/privacy}","received_events_url":"https://api.github.com/users/victor-moya/received_events","type":"User","site_admin":false},"body":"Implemented OpenGL counters based on ARB_pipeline_statistics extension\r\nand occlusion queries.\r\n\r\nBecause OpenGL doesn't seem to allow concurrent queries of the same\r\ntype occlusion queries in the log are ignored when executing\r\nFetchCounters.","created_at":"2016-12-28T10:33:00Z","updated_at":"2016-12-28T21:44:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a47c88a3f57ae4d4e9aad84e22f0a15c4beaf5e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/baldurk/renderdoc/pulls/469/commits","review_comments_url":"https://api.github.com/repos/baldurk/renderdoc/pulls/469/comments","review_comment_url":"https://api.github.com/repos/baldurk/renderdoc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/baldurk/renderdoc/issues/469/comments","statuses_url":"https://api.github.com/repos/baldurk/renderdoc/statuses/3e3d9e2d2252566683e886d848714b326ab79791","head":{"label":"victor-moya:opengl_query_counters","ref":"opengl_query_counters","sha":"3e3d9e2d2252566683e886d848714b326ab79791","user":{"login":"victor-moya","id":24520979,"avatar_url":"https://avatars.githubusercontent.com/u/24520979?v=3","gravatar_id":"","url":"https://api.github.com/users/victor-moya","html_url":"https://github.com/victor-moya","followers_url":"https://api.github.com/users/victor-moya/followers","following_url":"https://api.github.com/users/victor-moya/following{/other_user}","gists_url":"https://api.github.com/users/victor-moya/gists{/gist_id}","starred_url":"https://api.github.com/users/victor-moya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/victor-moya/subscriptions","organizations_url":"https://api.github.com/users/victor-moya/orgs","repos_url":"https://api.github.com/users/victor-moya/repos","events_url":"https://api.github.com/users/victor-moya/events{/privacy}","received_events_url":"https://api.github.com/users/victor-moya/received_events","type":"User","site_admin":false},"repo":{"id":76242566,"name":"renderdoc","full_name":"victor-moya/renderdoc","owner":{"login":"victor-moya","id":24520979,"avatar_url":"https://avatars.githubusercontent.com/u/24520979?v=3","gravatar_id":"","url":"https://api.github.com/users/victor-moya","html_url":"https://github.com/victor-moya","followers_url":"https://api.github.com/users/victor-moya/followers","following_url":"https://api.github.com/users/victor-moya/following{/other_user}","gists_url":"https://api.github.com/users/victor-moya/gists{/gist_id}","starred_url":"https://api.github.com/users/victor-moya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/victor-moya/subscriptions","organizations_url":"https://api.github.com/users/victor-moya/orgs","repos_url":"https://api.github.com/users/victor-moya/repos","events_url":"https://api.github.com/users/victor-moya/events{/privacy}","received_events_url":"https://api.github.com/users/victor-moya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/victor-moya/renderdoc","description":"RenderDoc is a stand-alone graphics debugging tool.","fork":true,"url":"https://api.github.com/repos/victor-moya/renderdoc","forks_url":"https://api.github.com/repos/victor-moya/renderdoc/forks","keys_url":"https://api.github.com/repos/victor-moya/renderdoc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/victor-moya/renderdoc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/victor-moya/renderdoc/teams","hooks_url":"https://api.github.com/repos/victor-moya/renderdoc/hooks","issue_events_url":"https://api.github.com/repos/victor-moya/renderdoc/issues/events{/number}","events_url":"https://api.github.com/repos/victor-moya/renderdoc/events","assignees_url":"https://api.github.com/repos/victor-moya/renderdoc/assignees{/user}","branches_url":"https://api.github.com/repos/victor-moya/renderdoc/branches{/branch}","tags_url":"https://api.github.com/repos/victor-moya/renderdoc/tags","blobs_url":"https://api.github.com/repos/victor-moya/renderdoc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/victor-moya/renderdoc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/victor-moya/renderdoc/git/refs{/sha}","trees_url":"https://api.github.com/repos/victor-moya/renderdoc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/victor-moya/renderdoc/statuses/{sha}","languages_url":"https://api.github.com/repos/victor-moya/renderdoc/languages","stargazers_url":"https://api.github.com/repos/victor-moya/renderdoc/stargazers","contributors_url":"https://api.github.com/repos/victor-moya/renderdoc/contributors","subscribers_url":"https://api.github.com/repos/victor-moya/renderdoc/subscribers","subscription_url":"https://api.github.com/repos/victor-moya/renderdoc/subscription","commits_url":"https://api.github.com/repos/victor-moya/renderdoc/commits{/sha}","git_commits_url":"https://api.github.com/repos/victor-moya/renderdoc/git/commits{/sha}","comments_url":"https://api.github.com/repos/victor-moya/renderdoc/comments{/number}","issue_comment_url":"https://api.github.com/repos/victor-moya/renderdoc/issues/comments{/number}","contents_url":"https://api.github.com/repos/victor-moya/renderdoc/contents/{+path}","compare_url":"https://api.github.com/repos/victor-moya/renderdoc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/victor-moya/renderdoc/merges","archive_url":"https://api.github.com/repos/victor-moya/renderdoc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/victor-moya/renderdoc/downloads","issues_url":"https://api.github.com/repos/victor-moya/renderdoc/issues{/number}","pulls_url":"https://api.github.com/repos/victor-moya/renderdoc/pulls{/number}","milestones_url":"https://api.github.com/repos/victor-moya/renderdoc/milestones{/number}","notifications_url":"https://api.github.com/repos/victor-moya/renderdoc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/victor-moya/renderdoc/labels{/name}","releases_url":"https://api.github.com/repos/victor-moya/renderdoc/releases{/id}","deployments_url":"https://api.github.com/repos/victor-moya/renderdoc/deployments","created_at":"2016-12-12T09:39:09Z","updated_at":"2016-12-12T09:39:13Z","pushed_at":"2016-12-28T21:08:07Z","git_url":"git://github.com/victor-moya/renderdoc.git","ssh_url":"git@github.com:victor-moya/renderdoc.git","clone_url":"https://github.com/victor-moya/renderdoc.git","svn_url":"https://github.com/victor-moya/renderdoc","homepage":"https://renderdoc.org/builds","size":32758,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"baldurk:master","ref":"master","sha":"d249faacd32471f25d9c14bc57c4415d1492c030","user":{"login":"baldurk","id":661798,"avatar_url":"https://avatars.githubusercontent.com/u/661798?v=3","gravatar_id":"","url":"https://api.github.com/users/baldurk","html_url":"https://github.com/baldurk","followers_url":"https://api.github.com/users/baldurk/followers","following_url":"https://api.github.com/users/baldurk/following{/other_user}","gists_url":"https://api.github.com/users/baldurk/gists{/gist_id}","starred_url":"https://api.github.com/users/baldurk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baldurk/subscriptions","organizations_url":"https://api.github.com/users/baldurk/orgs","repos_url":"https://api.github.com/users/baldurk/repos","events_url":"https://api.github.com/users/baldurk/events{/privacy}","received_events_url":"https://api.github.com/users/baldurk/received_events","type":"User","site_admin":false},"repo":{"id":17253131,"name":"renderdoc","full_name":"baldurk/renderdoc","owner":{"login":"baldurk","id":661798,"avatar_url":"https://avatars.githubusercontent.com/u/661798?v=3","gravatar_id":"","url":"https://api.github.com/users/baldurk","html_url":"https://github.com/baldurk","followers_url":"https://api.github.com/users/baldurk/followers","following_url":"https://api.github.com/users/baldurk/following{/other_user}","gists_url":"https://api.github.com/users/baldurk/gists{/gist_id}","starred_url":"https://api.github.com/users/baldurk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baldurk/subscriptions","organizations_url":"https://api.github.com/users/baldurk/orgs","repos_url":"https://api.github.com/users/baldurk/repos","events_url":"https://api.github.com/users/baldurk/events{/privacy}","received_events_url":"https://api.github.com/users/baldurk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/baldurk/renderdoc","description":"RenderDoc is a stand-alone graphics debugging tool.","fork":false,"url":"https://api.github.com/repos/baldurk/renderdoc","forks_url":"https://api.github.com/repos/baldurk/renderdoc/forks","keys_url":"https://api.github.com/repos/baldurk/renderdoc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/baldurk/renderdoc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/baldurk/renderdoc/teams","hooks_url":"https://api.github.com/repos/baldurk/renderdoc/hooks","issue_events_url":"https://api.github.com/repos/baldurk/renderdoc/issues/events{/number}","events_url":"https://api.github.com/repos/baldurk/renderdoc/events","assignees_url":"https://api.github.com/repos/baldurk/renderdoc/assignees{/user}","branches_url":"https://api.github.com/repos/baldurk/renderdoc/branches{/branch}","tags_url":"https://api.github.com/repos/baldurk/renderdoc/tags","blobs_url":"https://api.github.com/repos/baldurk/renderdoc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/baldurk/renderdoc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/baldurk/renderdoc/git/refs{/sha}","trees_url":"https://api.github.com/repos/baldurk/renderdoc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/baldurk/renderdoc/statuses/{sha}","languages_url":"https://api.github.com/repos/baldurk/renderdoc/languages","stargazers_url":"https://api.github.com/repos/baldurk/renderdoc/stargazers","contributors_url":"https://api.github.com/repos/baldurk/renderdoc/contributors","subscribers_url":"https://api.github.com/repos/baldurk/renderdoc/subscribers","subscription_url":"https://api.github.com/repos/baldurk/renderdoc/subscription","commits_url":"https://api.github.com/repos/baldurk/renderdoc/commits{/sha}","git_commits_url":"https://api.github.com/repos/baldurk/renderdoc/git/commits{/sha}","comments_url":"https://api.github.com/repos/baldurk/renderdoc/comments{/number}","issue_comment_url":"https://api.github.com/repos/baldurk/renderdoc/issues/comments{/number}","contents_url":"https://api.github.com/repos/baldurk/renderdoc/contents/{+path}","compare_url":"https://api.github.com/repos/baldurk/renderdoc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/baldurk/renderdoc/merges","archive_url":"https://api.github.com/repos/baldurk/renderdoc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/baldurk/renderdoc/downloads","issues_url":"https://api.github.com/repos/baldurk/renderdoc/issues{/number}","pulls_url":"https://api.github.com/repos/baldurk/renderdoc/pulls{/number}","milestones_url":"https://api.github.com/repos/baldurk/renderdoc/milestones{/number}","notifications_url":"https://api.github.com/repos/baldurk/renderdoc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/baldurk/renderdoc/labels{/name}","releases_url":"https://api.github.com/repos/baldurk/renderdoc/releases{/id}","deployments_url":"https://api.github.com/repos/baldurk/renderdoc/deployments","created_at":"2014-02-27T15:16:30Z","updated_at":"2016-12-27T16:38:33Z","pushed_at":"2016-12-28T21:08:08Z","git_url":"git://github.com/baldurk/renderdoc.git","ssh_url":"git@github.com:baldurk/renderdoc.git","clone_url":"https://github.com/baldurk/renderdoc.git","svn_url":"https://github.com/baldurk/renderdoc","homepage":"https://renderdoc.org/builds","size":32784,"stargazers_count":1465,"watchers_count":1465,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":215,"mirror_url":null,"open_issues_count":50,"forks":215,"open_issues":50,"watchers":1465,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/baldurk/renderdoc/pulls/469"},"html":{"href":"https://github.com/baldurk/renderdoc/pull/469"},"issue":{"href":"https://api.github.com/repos/baldurk/renderdoc/issues/469"},"comments":{"href":"https://api.github.com/repos/baldurk/renderdoc/issues/469/comments"},"review_comments":{"href":"https://api.github.com/repos/baldurk/renderdoc/pulls/469/comments"},"review_comment":{"href":"https://api.github.com/repos/baldurk/renderdoc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/baldurk/renderdoc/pulls/469/commits"},"statuses":{"href":"https://api.github.com/repos/baldurk/renderdoc/statuses/3e3d9e2d2252566683e886d848714b326ab79791"}}}}
{"actor":{"display_login":"baldurk"}}