};
return std::async(std::launch::deferred, std::move(cmd));
}
+
+ std::future<void> gc()
+ {
+ return executor_.begin_invoke([=]
+ {
+ CASPAR_LOG(info) << " ogl: Running GC.";
+
+ try
+ {
+ for (auto& pools : device_pools_)
+ {
+ for (auto& pool : pools)
+ pool.second.clear();
+ }
+ for (auto& pools : host_pools_)
+ {
+ for (auto& pool : pools)
+ pool.second.clear();
+ }
+ }
+ catch (...)
+ {
+ CASPAR_LOG_CURRENT_EXCEPTION();
+ }
+ }, task_priority::high_priority);
+ }
};
device::device()
std::future<std::shared_ptr<texture>> device::copy_async(const array<const std::uint8_t>& source, int width, int height, int stride, bool mipmapped){return impl_->copy_async(source, width, height, stride, mipmapped);}
std::future<std::shared_ptr<texture>> device::copy_async(const array<std::uint8_t>& source, int width, int height, int stride, bool mipmapped){ return impl_->copy_async(source, width, height, stride, mipmapped); }
std::future<array<const std::uint8_t>> device::copy_async(const spl::shared_ptr<texture>& source){return impl_->copy_async(source);}
+std::future<void> device::gc() { return impl_->gc(); }
boost::property_tree::wptree device::info() const { return impl_->info(); }
std::wstring device::version() const{return impl_->version();}
return result.str();
}
+void gl_gc_describer(core::help_sink& sink, const core::help_repository& repo)
+{
+ sink.short_description(L"Release pooled OpenGL resources.");
+ sink.syntax(L"GL GC");
+ sink.para()->text(L"Releases all the pooled OpenGL resources. ")->strong(L"May cause a pause on all video channels.");
+}
+
+std::wstring gl_gc_command(command_context& ctx)
+{
+ auto device = ctx.ogl_device;
+
+ if (!device)
+ CASPAR_THROW_EXCEPTION(not_supported() << msg_info("GL command only supported with OpenGL accelerator."));
+
+ device->gc().wait();
+
+ return L"202 GL GC OK\r\n";
+}
+
static const int WIDTH = 80;
struct max_width_sink : public core::help_sink
repo.register_channel_command( L"Query Commands", L"INFO DELAY", info_delay_describer, info_delay_command, 0);
repo.register_command( L"Query Commands", L"DIAG", diag_describer, diag_command, 0);
repo.register_command( L"Query Commands", L"GL INFO", gl_info_describer, gl_info_command, 0);
+ repo.register_command( L"Query Commands", L"GL GC", gl_gc_describer, gl_gc_command, 0);
repo.register_command( L"Query Commands", L"BYE", bye_describer, bye_command, 0);
repo.register_command( L"Query Commands", L"KILL", kill_describer, kill_command, 0);
repo.register_command( L"Query Commands", L"RESTART", restart_describer, restart_command, 0);