{"action":"created","issue":{"url":"https://api.github.com/repos/gfx-rs/gfx/issues/2138","repository_url":"https://api.github.com/repos/gfx-rs/gfx","labels_url":"https://api.github.com/repos/gfx-rs/gfx/issues/2138/labels{/name}","comments_url":"https://api.github.com/repos/gfx-rs/gfx/issues/2138/comments","events_url":"https://api.github.com/repos/gfx-rs/gfx/issues/2138/events","html_url":"https://github.com/gfx-rs/gfx/pull/2138","id":331070831,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzODkyNzMz","number":2138,"title":"CAMetalLayer presentation","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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-11T07:18:53Z","updated_at":"2018-06-12T04:37:18Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/gfx-rs/gfx/pulls/2138","html_url":"https://github.com/gfx-rs/gfx/pull/2138","diff_url":"https://github.com/gfx-rs/gfx/pull/2138.diff","patch_url":"https://github.com/gfx-rs/gfx/pull/2138.patch"},"body":"Fixes/rewrites the presentation mechanics in Metal, improves the API side elsewhere.\r\nOld swapchain was represented by `CALayer` with custom created `IOSurface` frames that we attempted to present. This is nowhere near the recommended presentation path, which is implemented here. Honestly, I don't think the old path ever worked properly:\r\n  - our example (`quad`) doesn't do any animation, and waits after each frame\r\n  - LunarG samples weren't really tested on MacOS\r\n  - gfx_ocean (as well as Dota) showed presentation lags/artifacts IIRC\r\n\r\nThe new logic creates a `CAMetalLayer`, set's up its format and parameters, and acquires drawables with `nextDrawable`. There is one but important complication with this method: frame images are temporary. Thus, while we can get `MTLTexture` from a drawable, it's not guaranteed to be the same one every time (if I understand correctly - please double-check). Therefore, I had to rewrite all texture handling logic to resolve the actual `MTLTexture` only when live encoding a command buffer. Until then, the regular textures are kept unchanged, but framebuffer ones are stored as a pointer to swapchain plus the frame index. I'd really like us *not* to do this, so please tell me if all of that was unnecessary :)\r\n\r\nPR checklist:\r\n- [x] `make` succeeds (on *nix)\r\n- [x] `make reftests` succeeds\r\n- [x] tested examples with the following backends: Metal\r\n\r\nFor an icing on the cake, Dota2 now plays well:\r\n![dota-gfx-metal2](https://user-images.githubusercontent.com/107301/41217514-fac62132-6d0c-11e8-93ce-f59db1432063.jpg)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/gfx-rs/gfx/issues/comments/396463233","html_url":"https://github.com/gfx-rs/gfx/pull/2138#issuecomment-396463233","issue_url":"https://api.github.com/repos/gfx-rs/gfx/issues/2138","id":396463233,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjQ2MzIzMw==","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},"created_at":"2018-06-12T04:37:18Z","updated_at":"2018-06-12T04:37:18Z","author_association":"MEMBER","body":"Alright, comments are addressed. Thanks for the review!\r\nTime to sail :)\r\nbors r=grovesNL"}}
{"actor":{"display_login":"kvark"}}