{"action":"created","comment":{"url":"https://api.github.com/repos/highfidelity/hifi/pulls/comments/217124179","pull_request_review_id":154763790,"id":217124179,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNzEyNDE3OQ==","diff_hunk":"@@ -299,46 +443,42 @@ class GLBackend : public Backend, public std::enable_shared_from_this<GLBackend>\n     virtual void updateInput() = 0;\n \n     struct InputStageState {\n-        bool _invalidFormat { true };\n-        bool _lastUpdateStereoState{ false }; \n+        bool _invalidFormat{ true };\n+        bool _lastUpdateStereoState{ false };\n         bool _hadColorAttribute{ true };\n-        Stream::FormatPointer _format;\n+        FormatReference _format{ GPU_REFERENCE_INIT_VALUE };\n         std::string _formatKey;\n \n         typedef std::bitset<MAX_NUM_ATTRIBUTES> ActivationCache;\n-        ActivationCache _attributeActivation { 0 };\n+        ActivationCache _attributeActivation{ 0 };\n \n         typedef std::bitset<MAX_NUM_INPUT_BUFFERS> BuffersState;\n \n         BuffersState _invalidBuffers{ 0 };\n         BuffersState _attribBindingBuffers{ 0 };\n \n-        Buffers _buffers;\n-        Offsets _bufferOffsets;\n-        Offsets _bufferStrides;\n-        std::vector<GLuint> _bufferVBOs;\n+        std::vector<BufferReference> _buffers{ MAX_NUM_INPUT_BUFFERS, GPU_REFERENCE_INIT_VALUE };","path":"libraries/gpu-gl-common/src/gpu/gl/GLBackend.h","position":278,"original_position":278,"commit_id":"5d80347dce22241e2c28695a5ae5938c77fb07e4","original_commit_id":"5d80347dce22241e2c28695a5ae5938c77fb07e4","user":{"login":"samcake","id":2230265,"node_id":"MDQ6VXNlcjIyMzAyNjU=","avatar_url":"https://avatars2.githubusercontent.com/u/2230265?v=4","gravatar_id":"","url":"https://api.github.com/users/samcake","html_url":"https://github.com/samcake","followers_url":"https://api.github.com/users/samcake/followers","following_url":"https://api.github.com/users/samcake/following{/other_user}","gists_url":"https://api.github.com/users/samcake/gists{/gist_id}","starred_url":"https://api.github.com/users/samcake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samcake/subscriptions","organizations_url":"https://api.github.com/users/samcake/orgs","repos_url":"https://api.github.com/users/samcake/repos","events_url":"https://api.github.com/users/samcake/events{/privacy}","received_events_url":"https://api.github.com/users/samcake/received_events","type":"User","site_admin":false},"body":"isn't there a version of std::array that let s you initialize with that default value instead of using vector ?","created_at":"2018-09-12T17:36:39Z","updated_at":"2018-09-12T17:51:02Z","html_url":"https://github.com/highfidelity/hifi/pull/13954#discussion_r217124179","pull_request_url":"https://api.github.com/repos/highfidelity/hifi/pulls/13954","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/comments/217124179"},"html":{"href":"https://github.com/highfidelity/hifi/pull/13954#discussion_r217124179"},"pull_request":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/13954"}}},"pull_request":{"url":"https://api.github.com/repos/highfidelity/hifi/pulls/13954","id":213764489,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzNzY0NDg5","html_url":"https://github.com/highfidelity/hifi/pull/13954","diff_url":"https://github.com/highfidelity/hifi/pull/13954.diff","patch_url":"https://github.com/highfidelity/hifi/pull/13954.patch","issue_url":"https://api.github.com/repos/highfidelity/hifi/issues/13954","number":13954,"state":"open","locked":false,"title":"Reduce needless smart pointer duplication","user":{"login":"jherico","id":1533642,"node_id":"MDQ6VXNlcjE1MzM2NDI=","avatar_url":"https://avatars1.githubusercontent.com/u/1533642?v=4","gravatar_id":"","url":"https://api.github.com/users/jherico","html_url":"https://github.com/jherico","followers_url":"https://api.github.com/users/jherico/followers","following_url":"https://api.github.com/users/jherico/following{/other_user}","gists_url":"https://api.github.com/users/jherico/gists{/gist_id}","starred_url":"https://api.github.com/users/jherico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jherico/subscriptions","organizations_url":"https://api.github.com/users/jherico/orgs","repos_url":"https://api.github.com/users/jherico/repos","events_url":"https://api.github.com/users/jherico/events{/privacy}","received_events_url":"https://api.github.com/users/jherico/received_events","type":"User","site_admin":false},"body":"Performance profiling has highlighted `std::shared_ptr` as one hotspot in our rendering code.  There are a number of places where we're duplicating smart pointers needlessly.  This PR address one of the places where this occurs, inside the GL backend.  Here, we are frequently fetching the data out of the cache with code like this:\r\n\r\n`BufferPointer indexBuffer = batch._buffers.get(batch._params[paramOffset + 1]._uint);`\r\n\r\nThen we usually check the temporary object against our internal state and store the value if it's different.\r\n\r\n`if (indexBuffer != _input._indexBuffer) { _input._indexBuffer = indexBuffer; ... }`\r\n\r\nHowever, the `batch._buffers.get` method returns a const reference to the cache entry, so the cost of constructing `BufferPointer indexBuffer` is wasted time.  Instead we can fetch the value like this\r\n\r\n`const auto& indexBuffer = batch._buffers.get(batch._params[paramOffset + 1]._uint);`\r\n\r\nNow we're avoiding an extra smart pointer copy per call.  \r\n\r\n## Testing\r\n\r\nSimple smoke test.  This code is low level enough that if it's broken, the result will be either a crash or complete non-rendering.  If it builds and will render a simple scene, then it's good.  \r\n\r\n\r\n","created_at":"2018-09-06T22:09:06Z","updated_at":"2018-09-12T17:51:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d2e7ba22384cc0ec7bc8bf7cadaebf537db6fb21","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":907795710,"node_id":"MDU6TGFiZWw5MDc3OTU3MTA=","url":"https://api.github.com/repos/highfidelity/hifi/labels/Android%20Smoke%20Required","name":"Android Smoke Required","color":"fbca04","default":false},{"id":675876856,"node_id":"MDU6TGFiZWw2NzU4NzY4NTY=","url":"https://api.github.com/repos/highfidelity/hifi/labels/Engine","name":"Engine","color":"A2277C","default":false},{"id":313595519,"node_id":"MDU6TGFiZWwzMTM1OTU1MTk=","url":"https://api.github.com/repos/highfidelity/hifi/labels/QA%20Ready","name":"QA Ready","color":"bfd4f2","default":false}],"milestone":{"url":"https://api.github.com/repos/highfidelity/hifi/milestones/34","html_url":"https://github.com/highfidelity/hifi/milestone/34","labels_url":"https://api.github.com/repos/highfidelity/hifi/milestones/34/labels","id":3290833,"node_id":"MDk6TWlsZXN0b25lMzI5MDgzMw==","number":34,"title":"v0.74.0","description":"","creator":{"login":"conklin94122","id":12115653,"node_id":"MDQ6VXNlcjEyMTE1NjUz","avatar_url":"https://avatars2.githubusercontent.com/u/12115653?v=4","gravatar_id":"","url":"https://api.github.com/users/conklin94122","html_url":"https://github.com/conklin94122","followers_url":"https://api.github.com/users/conklin94122/followers","following_url":"https://api.github.com/users/conklin94122/following{/other_user}","gists_url":"https://api.github.com/users/conklin94122/gists{/gist_id}","starred_url":"https://api.github.com/users/conklin94122/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conklin94122/subscriptions","organizations_url":"https://api.github.com/users/conklin94122/orgs","repos_url":"https://api.github.com/users/conklin94122/repos","events_url":"https://api.github.com/users/conklin94122/events{/privacy}","received_events_url":"https://api.github.com/users/conklin94122/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":0,"state":"open","created_at":"2018-04-23T19:27:15Z","updated_at":"2018-09-12T16:45:54Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/highfidelity/hifi/pulls/13954/commits","review_comments_url":"https://api.github.com/repos/highfidelity/hifi/pulls/13954/comments","review_comment_url":"https://api.github.com/repos/highfidelity/hifi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/highfidelity/hifi/issues/13954/comments","statuses_url":"https://api.github.com/repos/highfidelity/hifi/statuses/5d80347dce22241e2c28695a5ae5938c77fb07e4","head":{"label":"jherico:fix/reduce_pointer_duplication","ref":"fix/reduce_pointer_duplication","sha":"5d80347dce22241e2c28695a5ae5938c77fb07e4","user":{"login":"jherico","id":1533642,"node_id":"MDQ6VXNlcjE1MzM2NDI=","avatar_url":"https://avatars1.githubusercontent.com/u/1533642?v=4","gravatar_id":"","url":"https://api.github.com/users/jherico","html_url":"https://github.com/jherico","followers_url":"https://api.github.com/users/jherico/followers","following_url":"https://api.github.com/users/jherico/following{/other_user}","gists_url":"https://api.github.com/users/jherico/gists{/gist_id}","starred_url":"https://api.github.com/users/jherico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jherico/subscriptions","organizations_url":"https://api.github.com/users/jherico/orgs","repos_url":"https://api.github.com/users/jherico/repos","events_url":"https://api.github.com/users/jherico/events{/privacy}","received_events_url":"https://api.github.com/users/jherico/received_events","type":"User","site_admin":false},"repo":{"id":29566286,"node_id":"MDEwOlJlcG9zaXRvcnkyOTU2NjI4Ng==","name":"hifi","full_name":"jherico/hifi","owner":{"login":"jherico","id":1533642,"node_id":"MDQ6VXNlcjE1MzM2NDI=","avatar_url":"https://avatars1.githubusercontent.com/u/1533642?v=4","gravatar_id":"","url":"https://api.github.com/users/jherico","html_url":"https://github.com/jherico","followers_url":"https://api.github.com/users/jherico/followers","following_url":"https://api.github.com/users/jherico/following{/other_user}","gists_url":"https://api.github.com/users/jherico/gists{/gist_id}","starred_url":"https://api.github.com/users/jherico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jherico/subscriptions","organizations_url":"https://api.github.com/users/jherico/orgs","repos_url":"https://api.github.com/users/jherico/repos","events_url":"https://api.github.com/users/jherico/events{/privacy}","received_events_url":"https://api.github.com/users/jherico/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jherico/hifi","description":"Open, decentralized virtual worlds using sensors to control avatars and dynamically assigned devices as servers.  San Francisco based startup, we are hiring: http://highfidelity.io/jobs  Documentation at http://docs.highfidelity.io  Contribute by reporting bugs & doing jobs on http://worklist.net","fork":true,"url":"https://api.github.com/repos/jherico/hifi","forks_url":"https://api.github.com/repos/jherico/hifi/forks","keys_url":"https://api.github.com/repos/jherico/hifi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jherico/hifi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jherico/hifi/teams","hooks_url":"https://api.github.com/repos/jherico/hifi/hooks","issue_events_url":"https://api.github.com/repos/jherico/hifi/issues/events{/number}","events_url":"https://api.github.com/repos/jherico/hifi/events","assignees_url":"https://api.github.com/repos/jherico/hifi/assignees{/user}","branches_url":"https://api.github.com/repos/jherico/hifi/branches{/branch}","tags_url":"https://api.github.com/repos/jherico/hifi/tags","blobs_url":"https://api.github.com/repos/jherico/hifi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jherico/hifi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jherico/hifi/git/refs{/sha}","trees_url":"https://api.github.com/repos/jherico/hifi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jherico/hifi/statuses/{sha}","languages_url":"https://api.github.com/repos/jherico/hifi/languages","stargazers_url":"https://api.github.com/repos/jherico/hifi/stargazers","contributors_url":"https://api.github.com/repos/jherico/hifi/contributors","subscribers_url":"https://api.github.com/repos/jherico/hifi/subscribers","subscription_url":"https://api.github.com/repos/jherico/hifi/subscription","commits_url":"https://api.github.com/repos/jherico/hifi/commits{/sha}","git_commits_url":"https://api.github.com/repos/jherico/hifi/git/commits{/sha}","comments_url":"https://api.github.com/repos/jherico/hifi/comments{/number}","issue_comment_url":"https://api.github.com/repos/jherico/hifi/issues/comments{/number}","contents_url":"https://api.github.com/repos/jherico/hifi/contents/{+path}","compare_url":"https://api.github.com/repos/jherico/hifi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jherico/hifi/merges","archive_url":"https://api.github.com/repos/jherico/hifi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jherico/hifi/downloads","issues_url":"https://api.github.com/repos/jherico/hifi/issues{/number}","pulls_url":"https://api.github.com/repos/jherico/hifi/pulls{/number}","milestones_url":"https://api.github.com/repos/jherico/hifi/milestones{/number}","notifications_url":"https://api.github.com/repos/jherico/hifi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jherico/hifi/labels{/name}","releases_url":"https://api.github.com/repos/jherico/hifi/releases{/id}","deployments_url":"https://api.github.com/repos/jherico/hifi/deployments","created_at":"2015-01-21T02:11:03Z","updated_at":"2018-09-10T21:48:12Z","pushed_at":"2018-09-12T17:50:48Z","git_url":"git://github.com/jherico/hifi.git","ssh_url":"git@github.com:jherico/hifi.git","clone_url":"https://github.com/jherico/hifi.git","svn_url":"https://github.com/jherico/hifi","homepage":"","size":560373,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"highfidelity:master","ref":"master","sha":"f67deb9f6521a769c1895599452bb5b6266d1bf2","user":{"login":"highfidelity","id":1565370,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NjUzNzA=","avatar_url":"https://avatars0.githubusercontent.com/u/1565370?v=4","gravatar_id":"","url":"https://api.github.com/users/highfidelity","html_url":"https://github.com/highfidelity","followers_url":"https://api.github.com/users/highfidelity/followers","following_url":"https://api.github.com/users/highfidelity/following{/other_user}","gists_url":"https://api.github.com/users/highfidelity/gists{/gist_id}","starred_url":"https://api.github.com/users/highfidelity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/highfidelity/subscriptions","organizations_url":"https://api.github.com/users/highfidelity/orgs","repos_url":"https://api.github.com/users/highfidelity/repos","events_url":"https://api.github.com/users/highfidelity/events{/privacy}","received_events_url":"https://api.github.com/users/highfidelity/received_events","type":"Organization","site_admin":false},"repo":{"id":5372872,"node_id":"MDEwOlJlcG9zaXRvcnk1MzcyODcy","name":"hifi","full_name":"highfidelity/hifi","owner":{"login":"highfidelity","id":1565370,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NjUzNzA=","avatar_url":"https://avatars0.githubusercontent.com/u/1565370?v=4","gravatar_id":"","url":"https://api.github.com/users/highfidelity","html_url":"https://github.com/highfidelity","followers_url":"https://api.github.com/users/highfidelity/followers","following_url":"https://api.github.com/users/highfidelity/following{/other_user}","gists_url":"https://api.github.com/users/highfidelity/gists{/gist_id}","starred_url":"https://api.github.com/users/highfidelity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/highfidelity/subscriptions","organizations_url":"https://api.github.com/users/highfidelity/orgs","repos_url":"https://api.github.com/users/highfidelity/repos","events_url":"https://api.github.com/users/highfidelity/events{/privacy}","received_events_url":"https://api.github.com/users/highfidelity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/highfidelity/hifi","description":"Open source client/server software for creating shared VR environments.  Docs at http://docs.highfidelity.com  We are hiring: http://highfidelity.com/jobs  Also, PT work available at http://worklist.net","fork":false,"url":"https://api.github.com/repos/highfidelity/hifi","forks_url":"https://api.github.com/repos/highfidelity/hifi/forks","keys_url":"https://api.github.com/repos/highfidelity/hifi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/highfidelity/hifi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/highfidelity/hifi/teams","hooks_url":"https://api.github.com/repos/highfidelity/hifi/hooks","issue_events_url":"https://api.github.com/repos/highfidelity/hifi/issues/events{/number}","events_url":"https://api.github.com/repos/highfidelity/hifi/events","assignees_url":"https://api.github.com/repos/highfidelity/hifi/assignees{/user}","branches_url":"https://api.github.com/repos/highfidelity/hifi/branches{/branch}","tags_url":"https://api.github.com/repos/highfidelity/hifi/tags","blobs_url":"https://api.github.com/repos/highfidelity/hifi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/highfidelity/hifi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/highfidelity/hifi/git/refs{/sha}","trees_url":"https://api.github.com/repos/highfidelity/hifi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/highfidelity/hifi/statuses/{sha}","languages_url":"https://api.github.com/repos/highfidelity/hifi/languages","stargazers_url":"https://api.github.com/repos/highfidelity/hifi/stargazers","contributors_url":"https://api.github.com/repos/highfidelity/hifi/contributors","subscribers_url":"https://api.github.com/repos/highfidelity/hifi/subscribers","subscription_url":"https://api.github.com/repos/highfidelity/hifi/subscription","commits_url":"https://api.github.com/repos/highfidelity/hifi/commits{/sha}","git_commits_url":"https://api.github.com/repos/highfidelity/hifi/git/commits{/sha}","comments_url":"https://api.github.com/repos/highfidelity/hifi/comments{/number}","issue_comment_url":"https://api.github.com/repos/highfidelity/hifi/issues/comments{/number}","contents_url":"https://api.github.com/repos/highfidelity/hifi/contents/{+path}","compare_url":"https://api.github.com/repos/highfidelity/hifi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/highfidelity/hifi/merges","archive_url":"https://api.github.com/repos/highfidelity/hifi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/highfidelity/hifi/downloads","issues_url":"https://api.github.com/repos/highfidelity/hifi/issues{/number}","pulls_url":"https://api.github.com/repos/highfidelity/hifi/pulls{/number}","milestones_url":"https://api.github.com/repos/highfidelity/hifi/milestones{/number}","notifications_url":"https://api.github.com/repos/highfidelity/hifi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/highfidelity/hifi/labels{/name}","releases_url":"https://api.github.com/repos/highfidelity/hifi/releases{/id}","deployments_url":"https://api.github.com/repos/highfidelity/hifi/deployments","created_at":"2012-08-10T18:26:22Z","updated_at":"2018-09-12T15:40:29Z","pushed_at":"2018-09-12T17:50:50Z","git_url":"git://github.com/highfidelity/hifi.git","ssh_url":"git@github.com:highfidelity/hifi.git","clone_url":"https://github.com/highfidelity/hifi.git","svn_url":"https://github.com/highfidelity/hifi","homepage":"","size":558284,"stargazers_count":644,"watchers_count":644,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":413,"mirror_url":null,"archived":false,"open_issues_count":170,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":413,"open_issues":170,"watchers":644,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/13954"},"html":{"href":"https://github.com/highfidelity/hifi/pull/13954"},"issue":{"href":"https://api.github.com/repos/highfidelity/hifi/issues/13954"},"comments":{"href":"https://api.github.com/repos/highfidelity/hifi/issues/13954/comments"},"review_comments":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/13954/comments"},"review_comment":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/13954/commits"},"statuses":{"href":"https://api.github.com/repos/highfidelity/hifi/statuses/5d80347dce22241e2c28695a5ae5938c77fb07e4"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"samcake"}}