-#include "stdafx.h"\r
-\r
-#include "accelerator.h"\r
-\r
-#include "cpu/image/image_mixer.h"\r
-#include "ogl/image/image_mixer.h"\r
-\r
-#include "ogl/util/context.h"\r
-\r
-#include <tbb/mutex.h>\r
-\r
-namespace caspar { namespace accelerator {\r
- \r
-struct accelerator::impl\r
-{\r
- const std::wstring path_;\r
- tbb::mutex mutex_;\r
- std::shared_ptr<ogl::context> ogl_context_;\r
-\r
- impl(const std::wstring& path)\r
- : path_(path)\r
- {\r
- }\r
-\r
- spl::unique_ptr<core::image_mixer> create_image_mixer()\r
- {\r
- try\r
- {\r
- if(path_ == L"gpu" || path_ == L"ogl" || path_ == L"auto" || path_ == L"default")\r
- {\r
- tbb::mutex::scoped_lock lock(mutex_);\r
-\r
- if(!ogl_context_)\r
- ogl_context_.reset(new ogl::context());\r
-\r
- return spl::make_unique<ogl::image_mixer>(spl::make_shared_ptr(ogl_context_));\r
- }\r
- }\r
- catch(...)\r
- {\r
- if(path_ == L"gpu" || path_ == L"ogl")\r
- CASPAR_LOG_CURRENT_EXCEPTION();\r
- }\r
-\r
- return spl::make_unique<cpu::image_mixer>();\r
- }\r
-};\r
-\r
-accelerator::accelerator(const std::wstring& path)\r
- : impl_(new impl(path))\r
-{\r
-}\r
-\r
-accelerator::~accelerator()\r
-{\r
-}\r
-\r
-spl::unique_ptr<core::image_mixer> accelerator::create_image_mixer()\r
-{\r
- return impl_->create_image_mixer();\r
-}\r
-\r
-}}
\ No newline at end of file
+#include "StdAfx.h"
+
+#include "accelerator.h"
+
+#ifdef _MSC_VER
+#include "cpu/image/image_mixer.h"
+#endif
+#include "ogl/image/image_mixer.h"
+#include "ogl/util/device.h"
+
+#include <common/env.h>
+
+#include <core/mixer/image/image_mixer.h>
+
+#include <tbb/mutex.h>
+
+namespace caspar { namespace accelerator {
+
+struct accelerator::impl
+{
+ const std::wstring path_;
+ tbb::mutex mutex_;
+ std::shared_ptr<ogl::device> ogl_device_;
+
+ impl(const std::wstring& path)
+ : path_(path)
+ {
+ }
+
+ std::unique_ptr<core::image_mixer> create_image_mixer(int channel_id)
+ {
+ try
+ {
+ if(path_ == L"gpu" || path_ == L"ogl" || path_ == L"auto" || path_ == L"default")
+ {
+ tbb::mutex::scoped_lock lock(mutex_);
+
+ if(!ogl_device_)
+ ogl_device_.reset(new ogl::device());
+
+ return std::unique_ptr<core::image_mixer>(new ogl::image_mixer(
+ spl::make_shared_ptr(ogl_device_),
+ env::properties().get(L"configuration.mixer.blend-modes", false),
+ env::properties().get(L"configuration.mixer.straight-alpha", false),
+ channel_id));
+ }
+ }
+ catch(...)
+ {
+ if(path_ == L"gpu" || path_ == L"ogl")
+ CASPAR_LOG_CURRENT_EXCEPTION();
+ }
+#ifdef _MSC_VER
+ return std::unique_ptr<core::image_mixer>(new cpu::image_mixer(channel_id));
+#else
+ CASPAR_THROW_EXCEPTION(not_supported());
+#endif
+ }
+};
+
+accelerator::accelerator(const std::wstring& path)
+ : impl_(new impl(path))
+{
+}
+
+accelerator::~accelerator()
+{
+}
+
+std::unique_ptr<core::image_mixer> accelerator::create_image_mixer(int channel_id)
+{
+ return impl_->create_image_mixer(channel_id);
+}
+
+std::shared_ptr<ogl::device> accelerator::get_ogl_device() const
+{
+ return impl_->ogl_device_;
+}
+
+}}