]> git.sesse.net Git - casparcg/blobdiff - core/mixer/gpu/host_buffer.cpp
2.0. - blend_modes are re-enabled.
[casparcg] / core / mixer / gpu / host_buffer.cpp
index ae0c45fa2c5a8b2702ce51c0a4bc982bf7908664..e1695f07fa8dcbc651c118a607857512a5811f5c 100644 (file)
 #include "device_buffer.h"\r
 #include "ogl_device.h"\r
 \r
+#include <common/exception/exceptions.h>\r
 #include <common/gl/gl_check.h>\r
 \r
+#include <gl/glew.h>\r
+\r
 namespace caspar { namespace core {\r
                                                                                                                                                                                                                                                                                                                                \r
 struct host_buffer::implementation : boost::noncopyable\r
@@ -111,17 +114,13 @@ public:
                GL(glBindBuffer(target_, 0));\r
        }\r
 \r
-       void begin_read(device_buffer& source)\r
+       void begin_read(size_t width, size_t height, GLuint format)\r
        {\r
-               source.attach(0);\r
-               source.bind();\r
                unmap();\r
                bind();\r
-               GL(glReadPixels(0, 0, source.width(), source.height(), format(source.stride()), GL_UNSIGNED_BYTE, NULL));\r
+               GL(glReadPixels(0, 0, width, height, format, GL_UNSIGNED_BYTE, NULL));\r
                unbind();\r
-               source.unbind();\r
                fence_.set();\r
-               GL(glFlush());\r
        }\r
 \r
        bool ready() const\r
@@ -137,7 +136,7 @@ void host_buffer::map(){impl_->map();}
 void host_buffer::unmap(){impl_->unmap();}\r
 void host_buffer::bind(){impl_->bind();}\r
 void host_buffer::unbind(){impl_->unbind();}\r
-void host_buffer::begin_read(device_buffer& source){impl_->begin_read(source);}\r
+void host_buffer::begin_read(size_t width, size_t height, GLuint format){impl_->begin_read(width, height, format);}\r
 size_t host_buffer::size() const { return impl_->size_; }\r
 bool host_buffer::ready() const{return impl_->ready();}\r
 void host_buffer::wait(ogl_device& ogl){impl_->wait(ogl);}\r