GitHub PullRequestEvent at 2014-05-23 22:51:51
Repository: pbrt-v2
Actor: dut09
Payload: {"action":"opened","number":33,"pull_request":{"url":"https://api.github.com/repos/mmp/pbrt-v2/pulls/33","id":16298555,"html_url":"https://github.com/mmp/pbrt-v2/pull/33","diff_url":"https://github.com/mmp/pbrt-v2/pull/33.diff","patch_url":"https://github.com/mmp/pbrt-v2/pull/33.patch","issue_url":"https://api.github.com/repos/mmp/pbrt-v2/issues/33","number":33,"state":"open","title":"fix the uint8 overflow bug in recursiveBuild function","user":{"login":"dut09","id":2777414,"avatar_url":"https://avatars.githubusercontent.com/u/2777414?","gravatar_id":"fe9d5ba5980ce64419f6ac12596041ac","url":"https://api.github.com/users/dut09","html_url":"https://github.com/dut09","followers_url":"https://api.github.com/users/dut09/followers","following_url":"https://api.github.com/users/dut09/following{/other_user}","gists_url":"https://api.github.com/users/dut09/gists{/gist_id}","starred_url":"https://api.github.com/users/dut09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dut09/subscriptions","organizations_url":"https://api.github.com/users/dut09/orgs","repos_url":"https://api.github.com/users/dut09/repos","events_url":"https://api.github.com/users/dut09/events{/privacy}","received_events_url":"https://api.github.com/users/dut09/received_events","type":"User","site_admin":false},"body":"bug description:\r\nLinearBVHNode uses nPrimitives(type: uint8_t) to store the number of elements in the leaf node, and assume nPrimitives == 0 indicates it is an interior node. However, in recursiveBuild function we use nPrimitives(type: uint32_t) and we don't check nPrimitives <= maxPrimsInNode when we try to build a leaf node. If, for example, exactly 256(or 512, 768, 1024...) primitives happen to have the same BBox center, they will be put in a single leaf node. When we flatten the BVHTree, due to the overflow issue, nPrimitives in LinearBVHNode for this leaves will be assigned 0, and they will be mistakenly treated as interior nodes.\r\n\r\nHow to fix it:\r\nin recursiveBuild function we build a leaf node in three cases:\r\ncase 1: nPrimitive == 1\r\ncase 2: all the primitives have exactly the same BBox center\r\ncase 3: nPrimitives <= maxPrimsInNode && minCost >= nPrimitives in SAH(line 355- 364)\r\ncase 1 and 3 won't lead to overflow problem because it checks nPrimitives <= maxPrimsInNode(which is no greater than 255u). case 2 could be problematic, so we fix it by adding the condition nPrimitives <= maxPrimsInNode. If it is true, we use the previous code; otherwise, we split the primitives into two halves. ","created_at":"2014-05-23T22:51:51Z","updated_at":"2014-05-23T22:51:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mmp/pbrt-v2/pulls/33/commits","review_comments_url":"https://api.github.com/repos/mmp/pbrt-v2/pulls/33/comments","review_comment_url":"https://api.github.com/repos/mmp/pbrt-v2/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mmp/pbrt-v2/issues/33/comments","statuses_url":"https://api.github.com/repos/mmp/pbrt-v2/statuses/568b43270652221c2c9a34b996f000f18bd2f1bd","head":{"label":"dut09:fix-uint8t-overflow","ref":"fix-uint8t-overflow","sha":"568b43270652221c2c9a34b996f000f18bd2f1bd","user":{"login":"dut09","id":2777414,"avatar_url":"https://avatars.githubusercontent.com/u/2777414?","gravatar_id":"fe9d5ba5980ce64419f6ac12596041ac","url":"https://api.github.com/users/dut09","html_url":"https://github.com/dut09","followers_url":"https://api.github.com/users/dut09/followers","following_url":"https://api.github.com/users/dut09/following{/other_user}","gists_url":"https://api.github.com/users/dut09/gists{/gist_id}","starred_url":"https://api.github.com/users/dut09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dut09/subscriptions","organizations_url":"https://api.github.com/users/dut09/orgs","repos_url":"https://api.github.com/users/dut09/repos","events_url":"https://api.github.com/users/dut09/events{/privacy}","received_events_url":"https://api.github.com/users/dut09/received_events","type":"User","site_admin":false},"repo":{"id":19904224,"name":"pbrt-v2","full_name":"dut09/pbrt-v2","owner":{"login":"dut09","id":2777414,"avatar_url":"https://avatars.githubusercontent.com/u/2777414?","gravatar_id":"fe9d5ba5980ce64419f6ac12596041ac","url":"https://api.github.com/users/dut09","html_url":"https://github.com/dut09","followers_url":"https://api.github.com/users/dut09/followers","following_url":"https://api.github.com/users/dut09/following{/other_user}","gists_url":"https://api.github.com/users/dut09/gists{/gist_id}","starred_url":"https://api.github.com/users/dut09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dut09/subscriptions","organizations_url":"https://api.github.com/users/dut09/orgs","repos_url":"https://api.github.com/users/dut09/repos","events_url":"https://api.github.com/users/dut09/events{/privacy}","received_events_url":"https://api.github.com/users/dut09/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dut09/pbrt-v2","description":"Source code for the version of pbrt described in the second edition of \"Physically Based Rendering\"","fork":true,"url":"https://api.github.com/repos/dut09/pbrt-v2","forks_url":"https://api.github.com/repos/dut09/pbrt-v2/forks","keys_url":"https://api.github.com/repos/dut09/pbrt-v2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dut09/pbrt-v2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dut09/pbrt-v2/teams","hooks_url":"https://api.github.com/repos/dut09/pbrt-v2/hooks","issue_events_url":"https://api.github.com/repos/dut09/pbrt-v2/issues/events{/number}","events_url":"https://api.github.com/repos/dut09/pbrt-v2/events","assignees_url":"https://api.github.com/repos/dut09/pbrt-v2/assignees{/user}","branches_url":"https://api.github.com/repos/dut09/pbrt-v2/branches{/branch}","tags_url":"https://api.github.com/repos/dut09/pbrt-v2/tags","blobs_url":"https://api.github.com/repos/dut09/pbrt-v2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dut09/pbrt-v2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dut09/pbrt-v2/git/refs{/sha}","trees_url":"https://api.github.com/repos/dut09/pbrt-v2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dut09/pbrt-v2/statuses/{sha}","languages_url":"https://api.github.com/repos/dut09/pbrt-v2/languages","stargazers_url":"https://api.github.com/repos/dut09/pbrt-v2/stargazers","contributors_url":"https://api.github.com/repos/dut09/pbrt-v2/contributors","subscribers_url":"https://api.github.com/repos/dut09/pbrt-v2/subscribers","subscription_url":"https://api.github.com/repos/dut09/pbrt-v2/subscription","commits_url":"https://api.github.com/repos/dut09/pbrt-v2/commits{/sha}","git_commits_url":"https://api.github.com/repos/dut09/pbrt-v2/git/commits{/sha}","comments_url":"https://api.github.com/repos/dut09/pbrt-v2/comments{/number}","issue_comment_url":"https://api.github.com/repos/dut09/pbrt-v2/issues/comments/{number}","contents_url":"https://api.github.com/repos/dut09/pbrt-v2/contents/{+path}","compare_url":"https://api.github.com/repos/dut09/pbrt-v2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dut09/pbrt-v2/merges","archive_url":"https://api.github.com/repos/dut09/pbrt-v2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dut09/pbrt-v2/downloads","issues_url":"https://api.github.com/repos/dut09/pbrt-v2/issues{/number}","pulls_url":"https://api.github.com/repos/dut09/pbrt-v2/pulls{/number}","milestones_url":"https://api.github.com/repos/dut09/pbrt-v2/milestones{/number}","notifications_url":"https://api.github.com/repos/dut09/pbrt-v2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dut09/pbrt-v2/labels{/name}","releases_url":"https://api.github.com/repos/dut09/pbrt-v2/releases{/id}","created_at":"2014-05-18T06:20:06Z","updated_at":"2014-05-23T22:51:51Z","pushed_at":"2014-05-23T22:50:27Z","git_url":"git://github.com/dut09/pbrt-v2.git","ssh_url":"git@github.com:dut09/pbrt-v2.git","clone_url":"https://github.com/dut09/pbrt-v2.git","svn_url":"https://github.com/dut09/pbrt-v2","homepage":"http://pbrt.org","size":46385,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mmp:master","ref":"master","sha":"23549b30486c12c927eaa354c2845177e353622e","user":{"login":"mmp","id":102567,"avatar_url":"https://avatars.githubusercontent.com/u/102567?","gravatar_id":"a56bb3ad4d8777f42df61738f528c05b","url":"https://api.github.com/users/mmp","html_url":"https://github.com/mmp","followers_url":"https://api.github.com/users/mmp/followers","following_url":"https://api.github.com/users/mmp/following{/other_user}","gists_url":"https://api.github.com/users/mmp/gists{/gist_id}","starred_url":"https://api.github.com/users/mmp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmp/subscriptions","organizations_url":"https://api.github.com/users/mmp/orgs","repos_url":"https://api.github.com/users/mmp/repos","events_url":"https://api.github.com/users/mmp/events{/privacy}","received_events_url":"https://api.github.com/users/mmp/received_events","type":"User","site_admin":false},"repo":{"id":328719,"name":"pbrt-v2","full_name":"mmp/pbrt-v2","owner":{"login":"mmp","id":102567,"avatar_url":"https://avatars.githubusercontent.com/u/102567?","gravatar_id":"a56bb3ad4d8777f42df61738f528c05b","url":"https://api.github.com/users/mmp","html_url":"https://github.com/mmp","followers_url":"https://api.github.com/users/mmp/followers","following_url":"https://api.github.com/users/mmp/following{/other_user}","gists_url":"https://api.github.com/users/mmp/gists{/gist_id}","starred_url":"https://api.github.com/users/mmp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmp/subscriptions","organizations_url":"https://api.github.com/users/mmp/orgs","repos_url":"https://api.github.com/users/mmp/repos","events_url":"https://api.github.com/users/mmp/events{/privacy}","received_events_url":"https://api.github.com/users/mmp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mmp/pbrt-v2","description":"Source code for the version of pbrt described in the second edition of \"Physically Based Rendering\"","fork":false,"url":"https://api.github.com/repos/mmp/pbrt-v2","forks_url":"https://api.github.com/repos/mmp/pbrt-v2/forks","keys_url":"https://api.github.com/repos/mmp/pbrt-v2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mmp/pbrt-v2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mmp/pbrt-v2/teams","hooks_url":"https://api.github.com/repos/mmp/pbrt-v2/hooks","issue_events_url":"https://api.github.com/repos/mmp/pbrt-v2/issues/events{/number}","events_url":"https://api.github.com/repos/mmp/pbrt-v2/events","assignees_url":"https://api.github.com/repos/mmp/pbrt-v2/assignees{/user}","branches_url":"https://api.github.com/repos/mmp/pbrt-v2/branches{/branch}","tags_url":"https://api.github.com/repos/mmp/pbrt-v2/tags","blobs_url":"https://api.github.com/repos/mmp/pbrt-v2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mmp/pbrt-v2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mmp/pbrt-v2/git/refs{/sha}","trees_url":"https://api.github.com/repos/mmp/pbrt-v2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mmp/pbrt-v2/statuses/{sha}","languages_url":"https://api.github.com/repos/mmp/pbrt-v2/languages","stargazers_url":"https://api.github.com/repos/mmp/pbrt-v2/stargazers","contributors_url":"https://api.github.com/repos/mmp/pbrt-v2/contributors","subscribers_url":"https://api.github.com/repos/mmp/pbrt-v2/subscribers","subscription_url":"https://api.github.com/repos/mmp/pbrt-v2/subscription","commits_url":"https://api.github.com/repos/mmp/pbrt-v2/commits{/sha}","git_commits_url":"https://api.github.com/repos/mmp/pbrt-v2/git/commits{/sha}","comments_url":"https://api.github.com/repos/mmp/pbrt-v2/comments{/number}","issue_comment_url":"https://api.github.com/repos/mmp/pbrt-v2/issues/comments/{number}","contents_url":"https://api.github.com/repos/mmp/pbrt-v2/contents/{+path}","compare_url":"https://api.github.com/repos/mmp/pbrt-v2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mmp/pbrt-v2/merges","archive_url":"https://api.github.com/repos/mmp/pbrt-v2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mmp/pbrt-v2/downloads","issues_url":"https://api.github.com/repos/mmp/pbrt-v2/issues{/number}","pulls_url":"https://api.github.com/repos/mmp/pbrt-v2/pulls{/number}","milestones_url":"https://api.github.com/repos/mmp/pbrt-v2/milestones{/number}","notifications_url":"https://api.github.com/repos/mmp/pbrt-v2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mmp/pbrt-v2/labels{/name}","releases_url":"https://api.github.com/repos/mmp/pbrt-v2/releases{/id}","created_at":"2009-10-06T16:58:08Z","updated_at":"2014-05-21T23:47:12Z","pushed_at":"2014-05-21T23:47:12Z","git_url":"git://github.com/mmp/pbrt-v2.git","ssh_url":"git@github.com:mmp/pbrt-v2.git","clone_url":"https://github.com/mmp/pbrt-v2.git","svn_url":"https://github.com/mmp/pbrt-v2","homepage":"http://pbrt.org","size":44314,"stargazers_count":316,"watchers_count":316,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":132,"mirror_url":null,"open_issues_count":7,"forks":132,"open_issues":7,"watchers":316,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mmp/pbrt-v2/pulls/33"},"html":{"href":"https://github.com/mmp/pbrt-v2/pull/33"},"issue":{"href":"https://api.github.com/repos/mmp/pbrt-v2/issues/33"},"comments":{"href":"https://api.github.com/repos/mmp/pbrt-v2/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/mmp/pbrt-v2/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/mmp/pbrt-v2/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mmp/pbrt-v2/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/mmp/pbrt-v2/statuses/568b43270652221c2c9a34b996f000f18bd2f1bd"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":25,"deletions":8,"changed_files":1}}