{"action":"created","comment":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/23026736","id":23026736,"diff_hunk":"@@ -1099,6 +1124,29 @@ static inline void WriteFog(T& out, pixel_shader_uid_data* uid_data)\n \tout.Write(\"\\tprev.rgb = (prev.rgb * (256 - ifog) + \" I_FOGCOLOR\".rgb * ifog) >> 8;\\n\");\n }\n \n+template<class T>\n+static inline void WritePerPixelDepth(T& out, pixel_shader_uid_data* uid_data, API_TYPE ApiType)\n+{\n+\tif (bpmem.genMode.zfreeze)\n+\t{\n+\t\tout.SetConstantsUsed(C_ZSLOPE, C_ZSLOPE);\n+\t\tout.SetConstantsUsed(C_EFBSCALE, C_EFBSCALE);\n+\n+\t\tout.Write(\"\\tfloat2 screenpos = rawpos.xy * \" I_EFBSCALE\".xy;\\n\");","path":"Source/Core/VideoCommon/PixelShaderGen.cpp","position":110,"original_position":110,"commit_id":"5c67e4ab460d8bebeca8355fd6e76113e19b2fe1","original_commit_id":"5c67e4ab460d8bebeca8355fd6e76113e19b2fe1","user":{"login":"phire","id":138484,"avatar_url":"https://avatars.githubusercontent.com/u/138484?v=3","gravatar_id":"","url":"https://api.github.com/users/phire","html_url":"https://github.com/phire","followers_url":"https://api.github.com/users/phire/followers","following_url":"https://api.github.com/users/phire/following{/other_user}","gists_url":"https://api.github.com/users/phire/gists{/gist_id}","starred_url":"https://api.github.com/users/phire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phire/subscriptions","organizations_url":"https://api.github.com/users/phire/orgs","repos_url":"https://api.github.com/users/phire/repos","events_url":"https://api.github.com/users/phire/events{/privacy}","received_events_url":"https://api.github.com/users/phire/received_events","type":"User","site_admin":false},"body":"Yes, that did cross my mind. Future PR?","created_at":"2015-01-15T17:27:49Z","updated_at":"2015-01-15T17:27:49Z","html_url":"https://github.com/dolphin-emu/dolphin/pull/1812#discussion_r23026736","pull_request_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/1812","_links":{"self":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/23026736"},"html":{"href":"https://github.com/dolphin-emu/dolphin/pull/1812#discussion_r23026736"},"pull_request":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/1812"}}},"pull_request":{"url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/1812","id":26754664,"html_url":"https://github.com/dolphin-emu/dolphin/pull/1812","diff_url":"https://github.com/dolphin-emu/dolphin/pull/1812.diff","patch_url":"https://github.com/dolphin-emu/dolphin/pull/1812.patch","issue_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/1812","number":1812,"state":"open","locked":false,"title":"zfreeze","user":{"login":"phire","id":138484,"avatar_url":"https://avatars.githubusercontent.com/u/138484?v=3","gravatar_id":"","url":"https://api.github.com/users/phire","html_url":"https://github.com/phire","followers_url":"https://api.github.com/users/phire/followers","following_url":"https://api.github.com/users/phire/following{/other_user}","gists_url":"https://api.github.com/users/phire/gists{/gist_id}","starred_url":"https://api.github.com/users/phire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phire/subscriptions","organizations_url":"https://api.github.com/users/phire/orgs","repos_url":"https://api.github.com/users/phire/repos","events_url":"https://api.github.com/users/phire/events{/privacy}","received_events_url":"https://api.github.com/users/phire/received_events","type":"User","site_admin":false},"body":"This has been a long journey but zfreeze is almost finished.\r\nThis PR contains code from neobrain, NanoByte011 and phire.\r\n\r\nChanges since #1767 \r\n * Don't cull CULLALL primitives so early because they are often used as reference planes.\r\n * Convert CalculateZSlope to screenspace coordinates.\r\n * Convert Pixelshader to screenspace coordinates (instead of worldspace  xy coordinates, which is totally wrong)\r\n * Divide depth by 2^24 instead of clamping to 0.0-1.0 as was done before.\r\n * Adjust from DirectX/OpenGL screenspace coordinates to gamecube screenspace coordinates, by compensating for EFB scale. (and flipping the vertical axis in the case of OpenGL) Zfreeze now works in most games.\r\n * Make sure early depth isn't forced on when zfreeze is enabled, fixing fast depth and gimmick courts in Mario Power Tennis **(NanoByte)**\r\n * Improved shader constant uniform buffer savestate code.\r\n\r\n## Known Issues:\r\n - [x] The Delfino Plaza court in Mario Power Tennis has zfighting issues. These may be unfixable.\r\n - [ ] It should still be possible to generate test cases with visible reference triangles which aren't rendered correctly with this approach. Fortunately, all known retail games use invisible reference planes.\r\n\r\n## Todo:\r\n - [x] Don't update the constants uniform buffer before every drawcall.\r\n - [ ] Cleanup CULLALL mode code path.\r\n - [x] Make sure this isn't broken on anyone's video card.\r\n - [x] Savestate Issues\r\n - [ ] Handle per-vertex matrix indexes for the reference plane, or leave a comment justifying that we don't need to.","created_at":"2015-01-02T11:13:24Z","updated_at":"2015-01-15T17:27:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"17e12b2eb4bb2f2ea9c13d0f2aab14ba80014b44","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/1812/commits","review_comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/1812/comments","review_comment_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/{number}","comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/1812/comments","statuses_url":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/5c67e4ab460d8bebeca8355fd6e76113e19b2fe1","head":{"label":"phire:real_zfreeze","ref":"real_zfreeze","sha":"5c67e4ab460d8bebeca8355fd6e76113e19b2fe1","user":{"login":"phire","id":138484,"avatar_url":"https://avatars.githubusercontent.com/u/138484?v=3","gravatar_id":"","url":"https://api.github.com/users/phire","html_url":"https://github.com/phire","followers_url":"https://api.github.com/users/phire/followers","following_url":"https://api.github.com/users/phire/following{/other_user}","gists_url":"https://api.github.com/users/phire/gists{/gist_id}","starred_url":"https://api.github.com/users/phire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phire/subscriptions","organizations_url":"https://api.github.com/users/phire/orgs","repos_url":"https://api.github.com/users/phire/repos","events_url":"https://api.github.com/users/phire/events{/privacy}","received_events_url":"https://api.github.com/users/phire/received_events","type":"User","site_admin":false},"repo":{"id":16432729,"name":"dolphin","full_name":"phire/dolphin","owner":{"login":"phire","id":138484,"avatar_url":"https://avatars.githubusercontent.com/u/138484?v=3","gravatar_id":"","url":"https://api.github.com/users/phire","html_url":"https://github.com/phire","followers_url":"https://api.github.com/users/phire/followers","following_url":"https://api.github.com/users/phire/following{/other_user}","gists_url":"https://api.github.com/users/phire/gists{/gist_id}","starred_url":"https://api.github.com/users/phire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phire/subscriptions","organizations_url":"https://api.github.com/users/phire/orgs","repos_url":"https://api.github.com/users/phire/repos","events_url":"https://api.github.com/users/phire/events{/privacy}","received_events_url":"https://api.github.com/users/phire/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/phire/dolphin","description":"Dolphin is a GameCube/Wii emulator, allowing you to play games for these two platforms on PC, with improvements.","fork":true,"url":"https://api.github.com/repos/phire/dolphin","forks_url":"https://api.github.com/repos/phire/dolphin/forks","keys_url":"https://api.github.com/repos/phire/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phire/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phire/dolphin/teams","hooks_url":"https://api.github.com/repos/phire/dolphin/hooks","issue_events_url":"https://api.github.com/repos/phire/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/phire/dolphin/events","assignees_url":"https://api.github.com/repos/phire/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/phire/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/phire/dolphin/tags","blobs_url":"https://api.github.com/repos/phire/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phire/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phire/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/phire/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phire/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/phire/dolphin/languages","stargazers_url":"https://api.github.com/repos/phire/dolphin/stargazers","contributors_url":"https://api.github.com/repos/phire/dolphin/contributors","subscribers_url":"https://api.github.com/repos/phire/dolphin/subscribers","subscription_url":"https://api.github.com/repos/phire/dolphin/subscription","commits_url":"https://api.github.com/repos/phire/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/phire/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/phire/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/phire/dolphin/issues/comments/{number}","contents_url":"https://api.github.com/repos/phire/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/phire/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phire/dolphin/merges","archive_url":"https://api.github.com/repos/phire/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phire/dolphin/downloads","issues_url":"https://api.github.com/repos/phire/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/phire/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/phire/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/phire/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phire/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/phire/dolphin/releases{/id}","created_at":"2014-02-01T11:17:19Z","updated_at":"2014-08-05T08:40:53Z","pushed_at":"2015-01-15T16:58:39Z","git_url":"git://github.com/phire/dolphin.git","ssh_url":"git@github.com:phire/dolphin.git","clone_url":"https://github.com/phire/dolphin.git","svn_url":"https://github.com/phire/dolphin","homepage":null,"size":197406,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"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":"dolphin-emu:master","ref":"master","sha":"9d9ffa5b8321b371edd40547232852ff81d309bd","user":{"login":"dolphin-emu","id":5050316,"avatar_url":"https://avatars.githubusercontent.com/u/5050316?v=3","gravatar_id":"","url":"https://api.github.com/users/dolphin-emu","html_url":"https://github.com/dolphin-emu","followers_url":"https://api.github.com/users/dolphin-emu/followers","following_url":"https://api.github.com/users/dolphin-emu/following{/other_user}","gists_url":"https://api.github.com/users/dolphin-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/dolphin-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dolphin-emu/subscriptions","organizations_url":"https://api.github.com/users/dolphin-emu/orgs","repos_url":"https://api.github.com/users/dolphin-emu/repos","events_url":"https://api.github.com/users/dolphin-emu/events{/privacy}","received_events_url":"https://api.github.com/users/dolphin-emu/received_events","type":"Organization","site_admin":false},"repo":{"id":11577304,"name":"dolphin","full_name":"dolphin-emu/dolphin","owner":{"login":"dolphin-emu","id":5050316,"avatar_url":"https://avatars.githubusercontent.com/u/5050316?v=3","gravatar_id":"","url":"https://api.github.com/users/dolphin-emu","html_url":"https://github.com/dolphin-emu","followers_url":"https://api.github.com/users/dolphin-emu/followers","following_url":"https://api.github.com/users/dolphin-emu/following{/other_user}","gists_url":"https://api.github.com/users/dolphin-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/dolphin-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dolphin-emu/subscriptions","organizations_url":"https://api.github.com/users/dolphin-emu/orgs","repos_url":"https://api.github.com/users/dolphin-emu/repos","events_url":"https://api.github.com/users/dolphin-emu/events{/privacy}","received_events_url":"https://api.github.com/users/dolphin-emu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dolphin-emu/dolphin","description":"Dolphin is a GameCube/Wii emulator, allowing you to play games for these two platforms on PC, with improvements.","fork":false,"url":"https://api.github.com/repos/dolphin-emu/dolphin","forks_url":"https://api.github.com/repos/dolphin-emu/dolphin/forks","keys_url":"https://api.github.com/repos/dolphin-emu/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dolphin-emu/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dolphin-emu/dolphin/teams","hooks_url":"https://api.github.com/repos/dolphin-emu/dolphin/hooks","issue_events_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/dolphin-emu/dolphin/events","assignees_url":"https://api.github.com/repos/dolphin-emu/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/dolphin-emu/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/dolphin-emu/dolphin/tags","blobs_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/dolphin-emu/dolphin/languages","stargazers_url":"https://api.github.com/repos/dolphin-emu/dolphin/stargazers","contributors_url":"https://api.github.com/repos/dolphin-emu/dolphin/contributors","subscribers_url":"https://api.github.com/repos/dolphin-emu/dolphin/subscribers","subscription_url":"https://api.github.com/repos/dolphin-emu/dolphin/subscription","commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/dolphin-emu/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/dolphin-emu/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues/comments/{number}","contents_url":"https://api.github.com/repos/dolphin-emu/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/dolphin-emu/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dolphin-emu/dolphin/merges","archive_url":"https://api.github.com/repos/dolphin-emu/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dolphin-emu/dolphin/downloads","issues_url":"https://api.github.com/repos/dolphin-emu/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/dolphin-emu/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/dolphin-emu/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/dolphin-emu/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dolphin-emu/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/dolphin-emu/dolphin/releases{/id}","created_at":"2013-07-22T09:07:57Z","updated_at":"2015-01-15T13:11:04Z","pushed_at":"2015-01-15T03:08:41Z","git_url":"git://github.com/dolphin-emu/dolphin.git","ssh_url":"git@github.com:dolphin-emu/dolphin.git","clone_url":"https://github.com/dolphin-emu/dolphin.git","svn_url":"https://github.com/dolphin-emu/dolphin","homepage":null,"size":252241,"stargazers_count":939,"watchers_count":939,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":300,"mirror_url":null,"open_issues_count":61,"forks":300,"open_issues":61,"watchers":939,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/1812"},"html":{"href":"https://github.com/dolphin-emu/dolphin/pull/1812"},"issue":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/issues/1812"},"comments":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/issues/1812/comments"},"review_comments":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/1812/comments"},"review_comment":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/pulls/1812/commits"},"statuses":{"href":"https://api.github.com/repos/dolphin-emu/dolphin/statuses/5c67e4ab460d8bebeca8355fd6e76113e19b2fe1"}}}}