{"action":"created","comment":{"url":"https://api.github.com/repos/appleseedhq/appleseed/pulls/comments/26447873","id":26447873,"diff_hunk":"@@ -0,0 +1,225 @@\n+\n+//\n+// This source file is part of appleseed.\n+// Visit http://appleseedhq.net/ for additional information and resources.\n+//\n+// This software is released under the MIT license.\n+//\n+// Copyright (c) 2015 Esteban Tovagliari, The appleseedhq Organization\n+//\n+// Permission is hereby granted, free of charge, to any person obtaining a copy\n+// of this software and associated documentation files (the \"Software\"), to deal\n+// in the Software without restriction, including without limitation the rights\n+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+// copies of the Software, and to permit persons to whom the Software is\n+// furnished to do so, subject to the following conditions:\n+//\n+// The above copyright notice and this permission notice shall be included in\n+// all copies or substantial portions of the Software.\n+//\n+// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+// THE SOFTWARE.\n+//\n+\n+// Interface header.\n+#include \"baserenderer.h\"\n+\n+// appleseed.renderer headers.\n+#include \"renderer/global/globallogger.h\"\n+#include \"renderer/modeling/project/project.h\"\n+#include \"renderer/modeling/scene/scene.h\"\n+#ifdef APPLESEED_WITH_OIIO\n+#include \"renderer/kernel/rendering/oiioerrorhandler.h\"\n+#endif\n+#ifdef APPLESEED_WITH_OSL\n+#include \"renderer/kernel/rendering/rendererservices.h\"\n+#include \"renderer/kernel/shading/closures.h\"\n+#endif\n+\n+// appleseed.foundation headers.\n+#include \"foundation/platform/compiler.h\"\n+\n+// Standard headers.\n+#include <cassert>\n+#include <exception>\n+#include <string>\n+\n+using namespace foundation;\n+using namespace std;\n+\n+namespace renderer\n+{\n+\n+//\n+// BaseRenderer class implementation.\n+//\n+\n+BaseRenderer::BaseRenderer(\n+    Project&                project,\n+    const ParamArray&       params)\n+  : m_project(project)\n+  , m_params(params)\n+{\n+#ifdef APPLESEED_WITH_OIIO\n+\n+    RENDERER_LOG_DEBUG(\"%s.\", \"creating OpenImageIO error handler\");\n+    m_error_handler = new OIIOErrorHandler();\n+\n+#ifndef NDEBUG\n+    // While debugging, we want all possible outputs.\n+    m_error_handler->verbosity(OIIO::ErrorHandler::VERBOSE);\n+#endif\n+\n+    RENDERER_LOG_DEBUG(\"%s.\", \"creating OpenImageIO texture system\");\n+    m_texture_system = OIIO::TextureSystem::create(false);\n+\n+    m_texture_system->attribute(\"automip\", 0);\n+    m_texture_system->attribute(\"accept_untiled\", 1);\n+    m_texture_system->attribute(\"accept_unmipped\", 1);\n+    m_texture_system->attribute(\"gray_to_rgb\", 1);\n+    m_texture_system->attribute(\"latlong_up\", \"y\");\n+#endif\n+\n+#ifdef APPLESEED_WITH_OSL\n+    RENDERER_LOG_DEBUG(\"%s.\", \"creating OSL renderer services\");\n+    m_renderer_services = new RendererServices(m_project, *m_texture_system);\n+\n+    RENDERER_LOG_DEBUG(\"%s.\", \"creating OSL shading system\");\n+    m_shading_system = OSL::ShadingSystem::create(\n+        m_renderer_services,\n+        m_texture_system,\n+        m_error_handler);\n+\n+    m_shading_system->attribute(\"lockgeom\", 1);\n+    m_shading_system->attribute(\"colorspace\", \"Linear\");\n+    m_shading_system->attribute(\"commonspace\", \"world\");\n+    m_shading_system->attribute(\"statistics:level\", 1);\n+\n+    m_shading_system->attribute(\n+        \"raytypes\",\n+        OSL::TypeDesc(\n+            OSL::TypeDesc::STRING,\n+            static_cast<int>(VisibilityFlags::Count)),\n+        VisibilityFlags::Names);\n+\n+#ifndef NDEBUG\n+    // While debugging, we want all possible outputs.\n+    m_shading_system->attribute(\"debug\", 1);\n+    m_shading_system->attribute(\"compile_report\", 1);\n+    m_shading_system->attribute(\"countlayerexecs\", 1);\n+    m_shading_system->attribute(\"clearmemory\", 1);\n+#endif\n+\n+    // Register appleseed's closures into OSL's shading system.\n+    register_closures(*m_shading_system);\n+#endif\n+}\n+\n+BaseRenderer::~BaseRenderer()\n+{\n+#ifdef APPLESEED_WITH_OSL\n+    RENDERER_LOG_DEBUG(\"%s.\", \"releasing optimized OSL shader groups\");\n+    m_project.get_scene()->release_optimized_osl_shader_groups();\n+\n+    RENDERER_LOG_DEBUG(\"%s.\", \"destroying OSL shading system\");\n+    OSL::ShadingSystem::destroy(m_shading_system);\n+\n+    RENDERER_LOG_DEBUG(\"%s.\", \"destroying OSL renderer services\");\n+    delete m_renderer_services;\n+#endif\n+\n+#ifdef APPLESEED_WITH_OIIO\n+    const string stats = m_texture_system->getstats();\n+    const string trimmed_stats = trim_right(stats, \"\\r\\n\");\n+    RENDERER_LOG_INFO(\"%s\", trimmed_stats.c_str());\n+\n+    RENDERER_LOG_DEBUG(\"%s.\", \"destroying OpenImageIO texture system\");","path":"src/appleseed/renderer/kernel/rendering/baserenderer.cpp","position":141,"original_position":141,"commit_id":"480a2b7dbefed4bca5c3e5ebb65f265a4cd2a982","original_commit_id":"480a2b7dbefed4bca5c3e5ebb65f265a4cd2a982","user":{"login":"dictoon","id":321290,"avatar_url":"https://avatars.githubusercontent.com/u/321290?v=3","gravatar_id":"","url":"https://api.github.com/users/dictoon","html_url":"https://github.com/dictoon","followers_url":"https://api.github.com/users/dictoon/followers","following_url":"https://api.github.com/users/dictoon/following{/other_user}","gists_url":"https://api.github.com/users/dictoon/gists{/gist_id}","starred_url":"https://api.github.com/users/dictoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dictoon/subscriptions","organizations_url":"https://api.github.com/users/dictoon/orgs","repos_url":"https://api.github.com/users/dictoon/repos","events_url":"https://api.github.com/users/dictoon/events{/privacy}","received_events_url":"https://api.github.com/users/dictoon/received_events","type":"User","site_admin":false},"body":"Simplify: `RENDERER_LOG_DEBUG(\"destroying OpenImageIO texture system.\");`","created_at":"2015-03-15T13:50:40Z","updated_at":"2015-03-15T13:50:40Z","html_url":"https://github.com/appleseedhq/appleseed/pull/719#discussion_r26447873","pull_request_url":"https://api.github.com/repos/appleseedhq/appleseed/pulls/719","_links":{"self":{"href":"https://api.github.com/repos/appleseedhq/appleseed/pulls/comments/26447873"},"html":{"href":"https://github.com/appleseedhq/appleseed/pull/719#discussion_r26447873"},"pull_request":{"href":"https://api.github.com/repos/appleseedhq/appleseed/pulls/719"}}},"pull_request":{"url":"https://api.github.com/repos/appleseedhq/appleseed/pulls/719","id":31199483,"html_url":"https://github.com/appleseedhq/appleseed/pull/719","diff_url":"https://github.com/appleseedhq/appleseed/pull/719.diff","patch_url":"https://github.com/appleseedhq/appleseed/pull/719.patch","issue_url":"https://api.github.com/repos/appleseedhq/appleseed/issues/719","number":719,"state":"open","locked":false,"title":"Keep OSL shading system alive between progressive renders","user":{"login":"est77","id":409013,"avatar_url":"https://avatars.githubusercontent.com/u/409013?v=3","gravatar_id":"","url":"https://api.github.com/users/est77","html_url":"https://github.com/est77","followers_url":"https://api.github.com/users/est77/followers","following_url":"https://api.github.com/users/est77/following{/other_user}","gists_url":"https://api.github.com/users/est77/gists{/gist_id}","starred_url":"https://api.github.com/users/est77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/est77/subscriptions","organizations_url":"https://api.github.com/users/est77/orgs","repos_url":"https://api.github.com/users/est77/repos","events_url":"https://api.github.com/users/est77/events{/privacy}","received_events_url":"https://api.github.com/users/est77/received_events","type":"User","site_admin":false},"body":"And optimize only the shaders that have been edited since the last render. Fixes issue #718.\r\nAlso fixed an unrelated bug (triangle with no normals crash) that I found while testing this.\r\n","created_at":"2015-03-15T12:18:43Z","updated_at":"2015-03-15T13:50:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9392470c3d88f4e7f0de6a642b14185a4d9677cd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/appleseedhq/appleseed/pulls/719/commits","review_comments_url":"https://api.github.com/repos/appleseedhq/appleseed/pulls/719/comments","review_comment_url":"https://api.github.com/repos/appleseedhq/appleseed/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appleseedhq/appleseed/issues/719/comments","statuses_url":"https://api.github.com/repos/appleseedhq/appleseed/statuses/480a2b7dbefed4bca5c3e5ebb65f265a4cd2a982","head":{"label":"est77:est_osl_progressive_rendering","ref":"est_osl_progressive_rendering","sha":"480a2b7dbefed4bca5c3e5ebb65f265a4cd2a982","user":{"login":"est77","id":409013,"avatar_url":"https://avatars.githubusercontent.com/u/409013?v=3","gravatar_id":"","url":"https://api.github.com/users/est77","html_url":"https://github.com/est77","followers_url":"https://api.github.com/users/est77/followers","following_url":"https://api.github.com/users/est77/following{/other_user}","gists_url":"https://api.github.com/users/est77/gists{/gist_id}","starred_url":"https://api.github.com/users/est77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/est77/subscriptions","organizations_url":"https://api.github.com/users/est77/orgs","repos_url":"https://api.github.com/users/est77/repos","events_url":"https://api.github.com/users/est77/events{/privacy}","received_events_url":"https://api.github.com/users/est77/received_events","type":"User","site_admin":false},"repo":{"id":10621343,"name":"appleseed","full_name":"est77/appleseed","owner":{"login":"est77","id":409013,"avatar_url":"https://avatars.githubusercontent.com/u/409013?v=3","gravatar_id":"","url":"https://api.github.com/users/est77","html_url":"https://github.com/est77","followers_url":"https://api.github.com/users/est77/followers","following_url":"https://api.github.com/users/est77/following{/other_user}","gists_url":"https://api.github.com/users/est77/gists{/gist_id}","starred_url":"https://api.github.com/users/est77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/est77/subscriptions","organizations_url":"https://api.github.com/users/est77/orgs","repos_url":"https://api.github.com/users/est77/repos","events_url":"https://api.github.com/users/est77/events{/privacy}","received_events_url":"https://api.github.com/users/est77/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/est77/appleseed","description":"appleseed is a modern, physically-based production renderer.","fork":true,"url":"https://api.github.com/repos/est77/appleseed","forks_url":"https://api.github.com/repos/est77/appleseed/forks","keys_url":"https://api.github.com/repos/est77/appleseed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/est77/appleseed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/est77/appleseed/teams","hooks_url":"https://api.github.com/repos/est77/appleseed/hooks","issue_events_url":"https://api.github.com/repos/est77/appleseed/issues/events{/number}","events_url":"https://api.github.com/repos/est77/appleseed/events","assignees_url":"https://api.github.com/repos/est77/appleseed/assignees{/user}","branches_url":"https://api.github.com/repos/est77/appleseed/branches{/branch}","tags_url":"https://api.github.com/repos/est77/appleseed/tags","blobs_url":"https://api.github.com/repos/est77/appleseed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/est77/appleseed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/est77/appleseed/git/refs{/sha}","trees_url":"https://api.github.com/repos/est77/appleseed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/est77/appleseed/statuses/{sha}","languages_url":"https://api.github.com/repos/est77/appleseed/languages","stargazers_url":"https://api.github.com/repos/est77/appleseed/stargazers","contributors_url":"https://api.github.com/repos/est77/appleseed/contributors","subscribers_url":"https://api.github.com/repos/est77/appleseed/subscribers","subscription_url":"https://api.github.com/repos/est77/appleseed/subscription","commits_url":"https://api.github.com/repos/est77/appleseed/commits{/sha}","git_commits_url":"https://api.github.com/repos/est77/appleseed/git/commits{/sha}","comments_url":"https://api.github.com/repos/est77/appleseed/comments{/number}","issue_comment_url":"https://api.github.com/repos/est77/appleseed/issues/comments{/number}","contents_url":"https://api.github.com/repos/est77/appleseed/contents/{+path}","compare_url":"https://api.github.com/repos/est77/appleseed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/est77/appleseed/merges","archive_url":"https://api.github.com/repos/est77/appleseed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/est77/appleseed/downloads","issues_url":"https://api.github.com/repos/est77/appleseed/issues{/number}","pulls_url":"https://api.github.com/repos/est77/appleseed/pulls{/number}","milestones_url":"https://api.github.com/repos/est77/appleseed/milestones{/number}","notifications_url":"https://api.github.com/repos/est77/appleseed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/est77/appleseed/labels{/name}","releases_url":"https://api.github.com/repos/est77/appleseed/releases{/id}","created_at":"2013-06-11T12:49:35Z","updated_at":"2015-03-07T11:27:52Z","pushed_at":"2015-03-15T12:11:10Z","git_url":"git://github.com/est77/appleseed.git","ssh_url":"git@github.com:est77/appleseed.git","clone_url":"https://github.com/est77/appleseed.git","svn_url":"https://github.com/est77/appleseed","homepage":"http://appleseedhq.net/","size":530163,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"appleseedhq:master","ref":"master","sha":"5743052cf280267ef82f7301dc1cb6f613d9ff31","user":{"login":"appleseedhq","id":6373510,"avatar_url":"https://avatars.githubusercontent.com/u/6373510?v=3","gravatar_id":"","url":"https://api.github.com/users/appleseedhq","html_url":"https://github.com/appleseedhq","followers_url":"https://api.github.com/users/appleseedhq/followers","following_url":"https://api.github.com/users/appleseedhq/following{/other_user}","gists_url":"https://api.github.com/users/appleseedhq/gists{/gist_id}","starred_url":"https://api.github.com/users/appleseedhq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appleseedhq/subscriptions","organizations_url":"https://api.github.com/users/appleseedhq/orgs","repos_url":"https://api.github.com/users/appleseedhq/repos","events_url":"https://api.github.com/users/appleseedhq/events{/privacy}","received_events_url":"https://api.github.com/users/appleseedhq/received_events","type":"Organization","site_admin":false},"repo":{"id":753784,"name":"appleseed","full_name":"appleseedhq/appleseed","owner":{"login":"appleseedhq","id":6373510,"avatar_url":"https://avatars.githubusercontent.com/u/6373510?v=3","gravatar_id":"","url":"https://api.github.com/users/appleseedhq","html_url":"https://github.com/appleseedhq","followers_url":"https://api.github.com/users/appleseedhq/followers","following_url":"https://api.github.com/users/appleseedhq/following{/other_user}","gists_url":"https://api.github.com/users/appleseedhq/gists{/gist_id}","starred_url":"https://api.github.com/users/appleseedhq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appleseedhq/subscriptions","organizations_url":"https://api.github.com/users/appleseedhq/orgs","repos_url":"https://api.github.com/users/appleseedhq/repos","events_url":"https://api.github.com/users/appleseedhq/events{/privacy}","received_events_url":"https://api.github.com/users/appleseedhq/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appleseedhq/appleseed","description":"appleseed is a modern, physically-based production renderer.","fork":false,"url":"https://api.github.com/repos/appleseedhq/appleseed","forks_url":"https://api.github.com/repos/appleseedhq/appleseed/forks","keys_url":"https://api.github.com/repos/appleseedhq/appleseed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appleseedhq/appleseed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appleseedhq/appleseed/teams","hooks_url":"https://api.github.com/repos/appleseedhq/appleseed/hooks","issue_events_url":"https://api.github.com/repos/appleseedhq/appleseed/issues/events{/number}","events_url":"https://api.github.com/repos/appleseedhq/appleseed/events","assignees_url":"https://api.github.com/repos/appleseedhq/appleseed/assignees{/user}","branches_url":"https://api.github.com/repos/appleseedhq/appleseed/branches{/branch}","tags_url":"https://api.github.com/repos/appleseedhq/appleseed/tags","blobs_url":"https://api.github.com/repos/appleseedhq/appleseed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appleseedhq/appleseed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appleseedhq/appleseed/git/refs{/sha}","trees_url":"https://api.github.com/repos/appleseedhq/appleseed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appleseedhq/appleseed/statuses/{sha}","languages_url":"https://api.github.com/repos/appleseedhq/appleseed/languages","stargazers_url":"https://api.github.com/repos/appleseedhq/appleseed/stargazers","contributors_url":"https://api.github.com/repos/appleseedhq/appleseed/contributors","subscribers_url":"https://api.github.com/repos/appleseedhq/appleseed/subscribers","subscription_url":"https://api.github.com/repos/appleseedhq/appleseed/subscription","commits_url":"https://api.github.com/repos/appleseedhq/appleseed/commits{/sha}","git_commits_url":"https://api.github.com/repos/appleseedhq/appleseed/git/commits{/sha}","comments_url":"https://api.github.com/repos/appleseedhq/appleseed/comments{/number}","issue_comment_url":"https://api.github.com/repos/appleseedhq/appleseed/issues/comments{/number}","contents_url":"https://api.github.com/repos/appleseedhq/appleseed/contents/{+path}","compare_url":"https://api.github.com/repos/appleseedhq/appleseed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appleseedhq/appleseed/merges","archive_url":"https://api.github.com/repos/appleseedhq/appleseed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appleseedhq/appleseed/downloads","issues_url":"https://api.github.com/repos/appleseedhq/appleseed/issues{/number}","pulls_url":"https://api.github.com/repos/appleseedhq/appleseed/pulls{/number}","milestones_url":"https://api.github.com/repos/appleseedhq/appleseed/milestones{/number}","notifications_url":"https://api.github.com/repos/appleseedhq/appleseed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appleseedhq/appleseed/labels{/name}","releases_url":"https://api.github.com/repos/appleseedhq/appleseed/releases{/id}","created_at":"2010-07-02T16:33:51Z","updated_at":"2015-03-15T13:45:38Z","pushed_at":"2015-03-15T13:45:38Z","git_url":"git://github.com/appleseedhq/appleseed.git","ssh_url":"git@github.com:appleseedhq/appleseed.git","clone_url":"https://github.com/appleseedhq/appleseed.git","svn_url":"https://github.com/appleseedhq/appleseed","homepage":"http://appleseedhq.net/","size":592189,"stargazers_count":166,"watchers_count":166,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":173,"forks":58,"open_issues":173,"watchers":166,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appleseedhq/appleseed/pulls/719"},"html":{"href":"https://github.com/appleseedhq/appleseed/pull/719"},"issue":{"href":"https://api.github.com/repos/appleseedhq/appleseed/issues/719"},"comments":{"href":"https://api.github.com/repos/appleseedhq/appleseed/issues/719/comments"},"review_comments":{"href":"https://api.github.com/repos/appleseedhq/appleseed/pulls/719/comments"},"review_comment":{"href":"https://api.github.com/repos/appleseedhq/appleseed/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appleseedhq/appleseed/pulls/719/commits"},"statuses":{"href":"https://api.github.com/repos/appleseedhq/appleseed/statuses/480a2b7dbefed4bca5c3e5ebb65f265a4cd2a982"}}}}