\r
class shader;\r
\r
+template<typename T>\r
+struct buffer_pool\r
+{\r
+ tbb::atomic<int> usage_count;\r
+ tbb::atomic<int> flush_count;\r
+ tbb::concurrent_bounded_queue<std::shared_ptr<T>> items;\r
+\r
+ buffer_pool()\r
+ {\r
+ usage_count = 0;\r
+ flush_count = 0;\r
+ }\r
+};\r
+\r
class ogl_device : boost::noncopyable\r
{ \r
std::unordered_map<GLenum, bool> caps_;\r
GLint attached_texture_;\r
GLint active_shader_;\r
std::array<GLint, 16> binded_textures_;\r
+ std::array<GLint, 4> blend_func_;\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
- std::array<tbb::concurrent_unordered_map<size_t, safe_ptr<tbb::concurrent_bounded_queue<std::shared_ptr<host_buffer>>>>, 2> host_pools_;\r
+ std::array<tbb::concurrent_unordered_map<size_t, safe_ptr<buffer_pool<device_buffer>>>, 4> device_pools_;\r
+ std::array<tbb::concurrent_unordered_map<size_t, safe_ptr<buffer_pool<host_buffer>>>, 2> host_pools_;\r
\r
unsigned int fbo_;\r
\r
\r
void begin_read(host_buffer& dest, device_buffer& source);\r
void begin_read(device_buffer& dest, host_buffer& source);\r
+\r
+ void blend_func(int c1, int c2, int a1, int a2);\r
+ void blend_func(int c1, int c2);\r
\r
void use(shader& shader);\r
\r
+ void flush();\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