1 #ifndef _PBO_FRAME_ALLOCATOR
2 #define _PBO_FRAME_ALLOCATOR 1
10 // An allocator that allocates straight into OpenGL pinned memory.
11 // Meant for video frames only. We use a queue rather than a stack,
12 // since we want to maximize pipelineability.
13 class PBOFrameAllocator : public FrameAllocator {
15 // Note: You need to have an OpenGL context when calling
17 PBOFrameAllocator(size_t frame_size,
18 size_t num_queued_frames = 16, // FIXME: should be 6
19 GLenum buffer = GL_PIXEL_UNPACK_BUFFER_ARB,
20 GLenum permissions = GL_MAP_WRITE_BIT,
21 GLenum map_bits = GL_MAP_FLUSH_EXPLICIT_BIT);
22 ~PBOFrameAllocator() override;
23 Frame alloc_frame() override;
24 void release_frame(Frame frame) override;
29 std::mutex freelist_mutex;
30 std::queue<Frame> freelist;
34 #endif // !defined(_PBO_FRAME_ALLOCATOR)