{"action":"created","comment":{"url":"https://api.github.com/repos/szeged/webrender/pulls/comments/212362600","pull_request_review_id":148975480,"id":212362600,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjM2MjYwMA==","diff_hunk":"@@ -964,14 +881,84 @@ impl<B: hal::Backend> UniformBuffer<B> {\n     }\n }\n \n+pub struct VertexBufferHandler<B: hal::Backend> {\n+    buffer: Buffer<B>,\n+    memory_types: Vec<hal::MemoryType>,\n+    usage: hal::buffer::Usage,\n+    data_stride: usize,\n+    pitch_alignment: usize,\n+    pub buffer_len: usize,\n+}\n+\n+impl<B: hal::Backend> VertexBufferHandler<B> {\n+    pub fn new<T: Copy>(\n+        device: &B::Device,\n+        memory_types: &Vec<hal::MemoryType>,\n+        usage: hal::buffer::Usage,\n+        data: &[T],\n+        data_stride: usize,\n+        pitch_alignment: usize,\n+    ) -> Self {\n+        let buffer = Buffer::new(\n+            device,\n+            memory_types,\n+            usage,\n+            pitch_alignment,\n+            data.len(),\n+            data_stride,\n+        );\n+        buffer.update_all(device, data);\n+        VertexBufferHandler {\n+            buffer_len: buffer.buffer_len,\n+            buffer,\n+            memory_types: memory_types.clone(),\n+            usage,\n+            data_stride,\n+            pitch_alignment,\n+        }\n+    }\n+\n+    pub fn update<T: Copy>(&mut self, device: &B::Device, data: &[T]) {\n+        let buffer_len = data.len() * self.data_stride;\n+        if self.buffer.buffer_len < buffer_len {\n+            let old_buffer = mem::replace(\n+                &mut self.buffer,\n+                Buffer::new(\n+                    device,\n+                    &self.memory_types,\n+                    self.usage,\n+                    self.pitch_alignment,\n+                    data.len(),\n+                    self.data_stride,\n+                )\n+            );\n+            old_buffer.deinit(device);\n+","path":"webrender/src/device/gfx.rs","position":719,"original_position":719,"commit_id":"3a828c154732276c863362d26ee430078e64fa4f","original_commit_id":"3a828c154732276c863362d26ee430078e64fa4f","user":{"login":"kvark","id":107301,"node_id":"MDQ6VXNlcjEwNzMwMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/107301?v=4","gravatar_id":"","url":"https://api.github.com/users/kvark","html_url":"https://github.com/kvark","followers_url":"https://api.github.com/users/kvark/followers","following_url":"https://api.github.com/users/kvark/following{/other_user}","gists_url":"https://api.github.com/users/kvark/gists{/gist_id}","starred_url":"https://api.github.com/users/kvark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvark/subscriptions","organizations_url":"https://api.github.com/users/kvark/orgs","repos_url":"https://api.github.com/users/kvark/repos","events_url":"https://api.github.com/users/kvark/events{/privacy}","received_events_url":"https://api.github.com/users/kvark/received_events","type":"User","site_admin":false},"body":"nit: newline","created_at":"2018-08-23T15:51:24Z","updated_at":"2018-08-23T15:53:01Z","html_url":"https://github.com/szeged/webrender/pull/206#discussion_r212362600","pull_request_url":"https://api.github.com/repos/szeged/webrender/pulls/206","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/szeged/webrender/pulls/comments/212362600"},"html":{"href":"https://github.com/szeged/webrender/pull/206#discussion_r212362600"},"pull_request":{"href":"https://api.github.com/repos/szeged/webrender/pulls/206"}}},"pull_request":{"url":"https://api.github.com/repos/szeged/webrender/pulls/206","id":208824242,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4ODI0MjQy","html_url":"https://github.com/szeged/webrender/pull/206","diff_url":"https://github.com/szeged/webrender/pull/206.diff","patch_url":"https://github.com/szeged/webrender/pull/206.patch","issue_url":"https://api.github.com/repos/szeged/webrender/issues/206","number":206,"state":"open","locked":false,"title":"Rework buffers","user":{"login":"dati91","id":2149430,"node_id":"MDQ6VXNlcjIxNDk0MzA=","avatar_url":"https://avatars2.githubusercontent.com/u/2149430?v=4","gravatar_id":"","url":"https://api.github.com/users/dati91","html_url":"https://github.com/dati91","followers_url":"https://api.github.com/users/dati91/followers","following_url":"https://api.github.com/users/dati91/following{/other_user}","gists_url":"https://api.github.com/users/dati91/gists{/gist_id}","starred_url":"https://api.github.com/users/dati91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dati91/subscriptions","organizations_url":"https://api.github.com/users/dati91/orgs","repos_url":"https://api.github.com/users/dati91/repos","events_url":"https://api.github.com/users/dati91/events{/privacy}","received_events_url":"https://api.github.com/users/dati91/received_events","type":"User","site_admin":false},"body":"Removed our previous Buffer structs, and created a new one which can handle them with proper buffer alignment.\r\n\r\nThis fixes #186, because our texture updates now work properly.\r\n\r\n~This will decrease our performance, because we do a LOT of buffer creation-deletion. But makes the code much more cleaner.~\r\n\r\n~WIP: There is room for optimization~\r\n\r\n~Might be worth reusing buffers where we know they don't change much e.g. Uniform buffer (it always the same size), Instance Buffer (only create a new buffer, when we can't fit in the previous one)~\r\n\r\nAlso fixes memory related validation errors.","created_at":"2018-08-16T11:13:27Z","updated_at":"2018-08-23T15:53:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4180b916061f0ac70db9d8c12caa8338d9aa646f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":562172170,"node_id":"MDU6TGFiZWw1NjIxNzIxNzA=","url":"https://api.github.com/repos/szeged/webrender/labels/in%20progress","name":"in progress","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/szeged/webrender/pulls/206/commits","review_comments_url":"https://api.github.com/repos/szeged/webrender/pulls/206/comments","review_comment_url":"https://api.github.com/repos/szeged/webrender/pulls/comments{/number}","comments_url":"https://api.github.com/repos/szeged/webrender/issues/206/comments","statuses_url":"https://api.github.com/repos/szeged/webrender/statuses/3a828c154732276c863362d26ee430078e64fa4f","head":{"label":"dati91:rework_buffers","ref":"rework_buffers","sha":"3a828c154732276c863362d26ee430078e64fa4f","user":{"login":"dati91","id":2149430,"node_id":"MDQ6VXNlcjIxNDk0MzA=","avatar_url":"https://avatars2.githubusercontent.com/u/2149430?v=4","gravatar_id":"","url":"https://api.github.com/users/dati91","html_url":"https://github.com/dati91","followers_url":"https://api.github.com/users/dati91/followers","following_url":"https://api.github.com/users/dati91/following{/other_user}","gists_url":"https://api.github.com/users/dati91/gists{/gist_id}","starred_url":"https://api.github.com/users/dati91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dati91/subscriptions","organizations_url":"https://api.github.com/users/dati91/orgs","repos_url":"https://api.github.com/users/dati91/repos","events_url":"https://api.github.com/users/dati91/events{/privacy}","received_events_url":"https://api.github.com/users/dati91/received_events","type":"User","site_admin":false},"repo":{"id":82043365,"node_id":"MDEwOlJlcG9zaXRvcnk4MjA0MzM2NQ==","name":"webrender","full_name":"dati91/webrender","owner":{"login":"dati91","id":2149430,"node_id":"MDQ6VXNlcjIxNDk0MzA=","avatar_url":"https://avatars2.githubusercontent.com/u/2149430?v=4","gravatar_id":"","url":"https://api.github.com/users/dati91","html_url":"https://github.com/dati91","followers_url":"https://api.github.com/users/dati91/followers","following_url":"https://api.github.com/users/dati91/following{/other_user}","gists_url":"https://api.github.com/users/dati91/gists{/gist_id}","starred_url":"https://api.github.com/users/dati91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dati91/subscriptions","organizations_url":"https://api.github.com/users/dati91/orgs","repos_url":"https://api.github.com/users/dati91/repos","events_url":"https://api.github.com/users/dati91/events{/privacy}","received_events_url":"https://api.github.com/users/dati91/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dati91/webrender","description":"A GPU-based renderer for the web","fork":true,"url":"https://api.github.com/repos/dati91/webrender","forks_url":"https://api.github.com/repos/dati91/webrender/forks","keys_url":"https://api.github.com/repos/dati91/webrender/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dati91/webrender/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dati91/webrender/teams","hooks_url":"https://api.github.com/repos/dati91/webrender/hooks","issue_events_url":"https://api.github.com/repos/dati91/webrender/issues/events{/number}","events_url":"https://api.github.com/repos/dati91/webrender/events","assignees_url":"https://api.github.com/repos/dati91/webrender/assignees{/user}","branches_url":"https://api.github.com/repos/dati91/webrender/branches{/branch}","tags_url":"https://api.github.com/repos/dati91/webrender/tags","blobs_url":"https://api.github.com/repos/dati91/webrender/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dati91/webrender/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dati91/webrender/git/refs{/sha}","trees_url":"https://api.github.com/repos/dati91/webrender/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dati91/webrender/statuses/{sha}","languages_url":"https://api.github.com/repos/dati91/webrender/languages","stargazers_url":"https://api.github.com/repos/dati91/webrender/stargazers","contributors_url":"https://api.github.com/repos/dati91/webrender/contributors","subscribers_url":"https://api.github.com/repos/dati91/webrender/subscribers","subscription_url":"https://api.github.com/repos/dati91/webrender/subscription","commits_url":"https://api.github.com/repos/dati91/webrender/commits{/sha}","git_commits_url":"https://api.github.com/repos/dati91/webrender/git/commits{/sha}","comments_url":"https://api.github.com/repos/dati91/webrender/comments{/number}","issue_comment_url":"https://api.github.com/repos/dati91/webrender/issues/comments{/number}","contents_url":"https://api.github.com/repos/dati91/webrender/contents/{+path}","compare_url":"https://api.github.com/repos/dati91/webrender/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dati91/webrender/merges","archive_url":"https://api.github.com/repos/dati91/webrender/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dati91/webrender/downloads","issues_url":"https://api.github.com/repos/dati91/webrender/issues{/number}","pulls_url":"https://api.github.com/repos/dati91/webrender/pulls{/number}","milestones_url":"https://api.github.com/repos/dati91/webrender/milestones{/number}","notifications_url":"https://api.github.com/repos/dati91/webrender/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dati91/webrender/labels{/name}","releases_url":"https://api.github.com/repos/dati91/webrender/releases{/id}","deployments_url":"https://api.github.com/repos/dati91/webrender/deployments","created_at":"2017-02-15T09:29:48Z","updated_at":"2018-06-26T12:23:52Z","pushed_at":"2018-08-23T12:18:58Z","git_url":"git://github.com/dati91/webrender.git","ssh_url":"git@github.com:dati91/webrender.git","clone_url":"https://github.com/dati91/webrender.git","svn_url":"https://github.com/dati91/webrender","homepage":"https://doc.servo.org/webrender/","size":43863,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"szeged:master","ref":"master","sha":"ec2d8482fe18143f10d662e7b1fb6065af0d3254","user":{"login":"szeged","id":1826696,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4MjY2OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/1826696?v=4","gravatar_id":"","url":"https://api.github.com/users/szeged","html_url":"https://github.com/szeged","followers_url":"https://api.github.com/users/szeged/followers","following_url":"https://api.github.com/users/szeged/following{/other_user}","gists_url":"https://api.github.com/users/szeged/gists{/gist_id}","starred_url":"https://api.github.com/users/szeged/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szeged/subscriptions","organizations_url":"https://api.github.com/users/szeged/orgs","repos_url":"https://api.github.com/users/szeged/repos","events_url":"https://api.github.com/users/szeged/events{/privacy}","received_events_url":"https://api.github.com/users/szeged/received_events","type":"Organization","site_admin":false},"repo":{"id":82043160,"node_id":"MDEwOlJlcG9zaXRvcnk4MjA0MzE2MA==","name":"webrender","full_name":"szeged/webrender","owner":{"login":"szeged","id":1826696,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4MjY2OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/1826696?v=4","gravatar_id":"","url":"https://api.github.com/users/szeged","html_url":"https://github.com/szeged","followers_url":"https://api.github.com/users/szeged/followers","following_url":"https://api.github.com/users/szeged/following{/other_user}","gists_url":"https://api.github.com/users/szeged/gists{/gist_id}","starred_url":"https://api.github.com/users/szeged/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szeged/subscriptions","organizations_url":"https://api.github.com/users/szeged/orgs","repos_url":"https://api.github.com/users/szeged/repos","events_url":"https://api.github.com/users/szeged/events{/privacy}","received_events_url":"https://api.github.com/users/szeged/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/szeged/webrender","description":"A GPU-based renderer for the web","fork":true,"url":"https://api.github.com/repos/szeged/webrender","forks_url":"https://api.github.com/repos/szeged/webrender/forks","keys_url":"https://api.github.com/repos/szeged/webrender/keys{/key_id}","collaborators_url":"https://api.github.com/repos/szeged/webrender/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/szeged/webrender/teams","hooks_url":"https://api.github.com/repos/szeged/webrender/hooks","issue_events_url":"https://api.github.com/repos/szeged/webrender/issues/events{/number}","events_url":"https://api.github.com/repos/szeged/webrender/events","assignees_url":"https://api.github.com/repos/szeged/webrender/assignees{/user}","branches_url":"https://api.github.com/repos/szeged/webrender/branches{/branch}","tags_url":"https://api.github.com/repos/szeged/webrender/tags","blobs_url":"https://api.github.com/repos/szeged/webrender/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/szeged/webrender/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/szeged/webrender/git/refs{/sha}","trees_url":"https://api.github.com/repos/szeged/webrender/git/trees{/sha}","statuses_url":"https://api.github.com/repos/szeged/webrender/statuses/{sha}","languages_url":"https://api.github.com/repos/szeged/webrender/languages","stargazers_url":"https://api.github.com/repos/szeged/webrender/stargazers","contributors_url":"https://api.github.com/repos/szeged/webrender/contributors","subscribers_url":"https://api.github.com/repos/szeged/webrender/subscribers","subscription_url":"https://api.github.com/repos/szeged/webrender/subscription","commits_url":"https://api.github.com/repos/szeged/webrender/commits{/sha}","git_commits_url":"https://api.github.com/repos/szeged/webrender/git/commits{/sha}","comments_url":"https://api.github.com/repos/szeged/webrender/comments{/number}","issue_comment_url":"https://api.github.com/repos/szeged/webrender/issues/comments{/number}","contents_url":"https://api.github.com/repos/szeged/webrender/contents/{+path}","compare_url":"https://api.github.com/repos/szeged/webrender/compare/{base}...{head}","merges_url":"https://api.github.com/repos/szeged/webrender/merges","archive_url":"https://api.github.com/repos/szeged/webrender/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/szeged/webrender/downloads","issues_url":"https://api.github.com/repos/szeged/webrender/issues{/number}","pulls_url":"https://api.github.com/repos/szeged/webrender/pulls{/number}","milestones_url":"https://api.github.com/repos/szeged/webrender/milestones{/number}","notifications_url":"https://api.github.com/repos/szeged/webrender/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/szeged/webrender/labels{/name}","releases_url":"https://api.github.com/repos/szeged/webrender/releases{/id}","deployments_url":"https://api.github.com/repos/szeged/webrender/deployments","created_at":"2017-02-15T09:27:55Z","updated_at":"2018-08-23T11:33:45Z","pushed_at":"2018-08-23T12:19:00Z","git_url":"git://github.com/szeged/webrender.git","ssh_url":"git@github.com:szeged/webrender.git","clone_url":"https://github.com/szeged/webrender.git","svn_url":"https://github.com/szeged/webrender","homepage":"https://doc.servo.org/webrender/","size":43227,"stargazers_count":11,"watchers_count":11,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":2,"open_issues":17,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/szeged/webrender/pulls/206"},"html":{"href":"https://github.com/szeged/webrender/pull/206"},"issue":{"href":"https://api.github.com/repos/szeged/webrender/issues/206"},"comments":{"href":"https://api.github.com/repos/szeged/webrender/issues/206/comments"},"review_comments":{"href":"https://api.github.com/repos/szeged/webrender/pulls/206/comments"},"review_comment":{"href":"https://api.github.com/repos/szeged/webrender/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/szeged/webrender/pulls/206/commits"},"statuses":{"href":"https://api.github.com/repos/szeged/webrender/statuses/3a828c154732276c863362d26ee430078e64fa4f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"kvark"}}