]> git.sesse.net Git - casparcg/blobdiff - core/mixer/gpu/ogl_device.h
2.0. - blend_modes are re-enabled.
[casparcg] / core / mixer / gpu / ogl_device.h
index 5d6e55a6d1811acf01d55a7f3f91b4244581b6b3..efb188a43e41e6c6d4652ea8d79548ababd09f82 100644 (file)
 #include <boost/thread/future.hpp>\r
 \r
 #include <array>\r
+#include <unordered_map>\r
+\r
+#include <gl/glew.h>\r
 \r
 #include "../../dependencies\SFML-1.6\include\SFML/Window/Context.hpp"\r
 \r
 namespace caspar { namespace core {\r
 \r
+class shader;\r
+\r
 class ogl_device : boost::noncopyable\r
 {      \r
+       std::unordered_map<GLenum, bool> caps_;\r
+       std::array<size_t, 4>                    viewport_;\r
+       std::array<size_t, 4>                    scissor_;\r
+       const GLubyte*                                   pattern_;\r
+       GLint                                                    attached_texture_;\r
+       GLint                                                    active_shader_;\r
+       std::array<GLint, 16>                    binded_textures_;\r
+\r
        std::unique_ptr<sf::Context> context_;\r
        \r
        std::array<tbb::concurrent_unordered_map<size_t, safe_ptr<tbb::concurrent_bounded_queue<std::shared_ptr<device_buffer>>>>, 4> device_pools_;\r
@@ -51,7 +64,23 @@ class ogl_device : boost::noncopyable
 public:                \r
        ogl_device();\r
        ~ogl_device();\r
+\r
+       // Not thread-safe, must be called inside of context\r
+       void enable(GLenum cap);\r
+       void disable(GLenum cap);\r
+       void viewport(size_t x, size_t y, size_t width, size_t height);\r
+       void scissor(size_t x, size_t y, size_t width, size_t height);\r
+       void stipple_pattern(const GLubyte* pattern);\r
+\r
+       void attach(device_buffer& texture);\r
+       void clear(device_buffer& texture);\r
+\r
+       void begin_read(host_buffer& dest, device_buffer& source);\r
+       void begin_read(device_buffer& dest, host_buffer& source);\r
        \r
+       void use(shader& shader);\r
+\r
+       // thread-afe\r
        template<typename Func>\r
        auto begin_invoke(Func&& func, task_priority priority = normal_priority) -> boost::unique_future<decltype(func())> // noexcept\r
        {                       \r