GL(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));\r
GL(glTexImage2D(GL_TEXTURE_2D, 0, INTERNAL_FORMAT[stride_], width_, height_, 0, FORMAT[stride_], GL_UNSIGNED_BYTE, NULL));\r
GL(glBindTexture(GL_TEXTURE_2D, 0));\r
- CASPAR_LOG(debug) << "[device_buffer] [" << ++g_total_count << L"] allocated size:" << width*height*stride; \r
+ CASPAR_LOG(trace) << "[device_buffer] [" << ++g_total_count << L"] allocated size:" << width*height*stride; \r
} \r
\r
~implementation()\r
try\r
{\r
GL(glDeleteTextures(1, &id_));\r
- CASPAR_LOG(debug) << "[device_buffer] [" << --g_total_count << L"] deallocated size:" << width_*height_*stride_;\r
+ CASPAR_LOG(trace) << "[device_buffer] [" << --g_total_count << L"] deallocated size:" << width_*height_*stride_;\r
}\r
catch(...)\r
{\r
if(!pbo_)\r
BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Failed to allocate buffer."));\r
\r
- CASPAR_LOG(debug) << "[host_buffer] [" << ++(usage_ == write_only ? g_w_total_count : g_r_total_count) << L"] allocated size:" << size_ << " usage: " << (usage == write_only ? "write_only" : "read_only");\r
+ CASPAR_LOG(trace) << "[host_buffer] [" << ++(usage_ == write_only ? g_w_total_count : g_r_total_count) << L"] allocated size:" << size_ << " usage: " << (usage == write_only ? "write_only" : "read_only");\r
} \r
\r
~implementation()\r
try\r
{\r
GL(glDeleteBuffers(1, &pbo_));\r
- CASPAR_LOG(debug) << "[host_buffer] [" << --(usage_ == write_only ? g_w_total_count : g_r_total_count) << L"] deallocated size:" << size_ << " usage: " << (usage_ == write_only ? "write_only" : "read_only");\r
+ CASPAR_LOG(trace) << "[host_buffer] [" << --(usage_ == write_only ? g_w_total_count : g_r_total_count) << L"] deallocated size:" << size_ << " usage: " << (usage_ == write_only ? "write_only" : "read_only");\r
}\r
catch(...)\r
{\r
std::shared_ptr<device_buffer> buffer;\r
if(!pool->items.try_pop(buffer)) \r
{\r
- ++pool->total_count;\r
executor_.invoke([&]\r
{ \r
try\r
catch(...)\r
{\r
CASPAR_LOG(error) << L"ogl: create_device_buffer failed!";\r
- --pool->total_count;\r
throw;\r
}\r
}\r
std::shared_ptr<host_buffer> buffer;\r
if(!pool->items.try_pop(buffer))\r
{\r
- ++pool->total_count;\r
executor_.invoke([&]\r
{\r
try\r
catch(...)\r
{\r
CASPAR_LOG(error) << L"ogl: create_host_buffer failed!";\r
- --pool->total_count;\r
throw; \r
}\r
}\r
template<typename T>\r
void flush_pool(buffer_pool<T>& pool)\r
{ \r
- if(pool.flush_count.fetch_and_increment() < 3)\r
+ if(pool.flush_count.fetch_and_increment() < 16)\r
return;\r
\r
if(pool.usage_count.fetch_and_store(0) < pool.items.size())\r
{\r
std::shared_ptr<T> buffer;\r
- if(pool.items.try_pop(buffer))\r
- --pool.total_count;\r
+ pool.items.try_pop(buffer);\r
}\r
\r
pool.flush_count = 0;\r
BOOST_FOREACH(auto& pools, device_pools_)\r
{\r
BOOST_FOREACH(auto& pool, pools)\r
- {\r
- auto size = pool.second->items.size();\r
- std::shared_ptr<device_buffer> buffer;\r
- for(int n = 0; n < size && pool.second->items.try_pop(buffer); ++n)\r
- --pool.second->total_count;\r
- }\r
+ pool.second->items.clear();\r
}\r
BOOST_FOREACH(auto& pools, host_pools_)\r
{\r
BOOST_FOREACH(auto& pool, pools)\r
- {\r
- auto size = pool.second->items.size();\r
- std::shared_ptr<host_buffer> buffer;\r
- for(int n = 0; n < size && pool.second->items.try_pop(buffer); ++n)\r
- --pool.second->total_count;\r
- }\r
+ pool.second->items.clear();\r
}\r
}\r
catch(...)\r