}\r
catch(...)\r
{\r
- BOOST_THROW_EXCEPTION(bad_alloc()\r
- << errinfo_nested_exception(std::current_exception()));\r
+ CASPAR_LOG(info) << "ogl: bad_alloc, retrying.";\r
+ gc().wait();\r
+ \r
+ try\r
+ {\r
+ buffer = std::make_shared<device_buffer>(width, height, stride);\r
+ }\r
+ catch(...)\r
+ {\r
+ BOOST_THROW_EXCEPTION(bad_alloc()\r
+ << errinfo_nested_exception(std::current_exception()));\r
+ }\r
+\r
}\r
}, high_priority); \r
}\r
}\r
catch(...)\r
{\r
- BOOST_THROW_EXCEPTION(bad_alloc()\r
- << errinfo_nested_exception(std::current_exception()));\r
+ CASPAR_LOG(info) << "ogl: bad_alloc, retrying.";\r
+ gc().wait();\r
+\r
+ try\r
+ {\r
+ buffer = std::make_shared<host_buffer>(size, usage);\r
+ if(usage == host_buffer::write_only)\r
+ buffer->map();\r
+ else\r
+ buffer->unmap(); \r
+ }\r
+ catch(...)\r
+ {\r
+ BOOST_THROW_EXCEPTION(bad_alloc()\r
+ << errinfo_nested_exception(std::current_exception()));\r
+ }\r
}\r
\r
}, high_priority); \r
executor_.yield();\r
}\r
\r
-void ogl_device::gc()\r
+boost::unique_future<void> ogl_device::gc()\r
{\r
- //begin_invoke([=]\r
- //{ \r
- // BOOST_FOREACH(auto& pool, device_pools_)\r
- // pool.clear();\r
- // BOOST_FOREACH(auto& pool, host_pools_)\r
- // pool.clear();\r
- //});\r
+ CASPAR_LOG(info) << " ogl: Running GC.";\r
+\r
+ return begin_invoke([=]\r
+ { \r
+ BOOST_FOREACH(auto& pool, device_pools_)\r
+ pool.clear();\r
+ BOOST_FOREACH(auto& pool, host_pools_)\r
+ pool.clear();\r
+ });\r
}\r
\r
std::wstring ogl_device::get_version()\r
safe_ptr<device_buffer> create_device_buffer(size_t width, size_t height, size_t stride);\r
safe_ptr<host_buffer> create_host_buffer(size_t size, host_buffer::usage_t usage);\r
void yield();\r
- void gc();\r
+ boost::unique_future<void> gc();\r
\r
static std::wstring get_version();\r
};\r
\r
\r
/* File created by MIDL compiler version 7.00.0555 */\r
-/* at Mon Jun 06 18:19:11 2011\r
+/* at Tue Jun 07 11:22:46 2011\r
*/\r
/* Compiler settings for interop\DeckLinkAPI.idl:\r
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r