diff options
Diffstat (limited to 'src/render/Framebuffer.hpp')
| -rw-r--r-- | src/render/Framebuffer.hpp | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/src/render/Framebuffer.hpp b/src/render/Framebuffer.hpp index e6c93876..7e33f227 100644 --- a/src/render/Framebuffer.hpp +++ b/src/render/Framebuffer.hpp @@ -3,34 +3,38 @@ #include "../defines.hpp" #include "../helpers/Format.hpp" #include "Texture.hpp" +#include <cstdint> #include <drm_fourcc.h> -class CFramebuffer { +class CHLBufferReference; + +class IFramebuffer { public: - CFramebuffer(); - ~CFramebuffer(); - - bool alloc(int w, int h, uint32_t format = DRM_FORMAT_ARGB8888); - void addStencil(SP<CTexture> tex); - void bind(); - void unbind(); - void release(); - void reset(); + IFramebuffer() = default; + IFramebuffer(const std::string& name); + virtual ~IFramebuffer() = default; + + virtual bool alloc(int w, int h, uint32_t format = DRM_FORMAT_ARGB8888); + virtual void release() = 0; + virtual bool readPixels(CHLBufferReference buffer, uint32_t offsetX = 0, uint32_t offsetY = 0, uint32_t width = 0, uint32_t height = 0) = 0; + + virtual void bind() = 0; + bool isAllocated(); - SP<CTexture> getTexture(); - SP<CTexture> getStencilTex(); - GLuint getFBID(); - void invalidate(const std::vector<GLenum>& attachments); + SP<ITexture> getTexture(); + SP<ITexture> getStencilTex(); + + virtual void addStencil(SP<ITexture> tex) = 0; Vector2D m_size; - DRMFormat m_drmFormat = 0 /* DRM_FORMAT_INVALID */; + DRMFormat m_drmFormat = DRM_FORMAT_INVALID; - private: - SP<CTexture> m_tex; - GLuint m_fb = -1; - bool m_fbAllocated = false; + protected: + virtual bool internalAlloc(int w, int h, uint32_t format = DRM_FORMAT_ARGB8888) = 0; - SP<CTexture> m_stencilTex; + SP<ITexture> m_tex; + bool m_fbAllocated = false; - friend class CRenderbuffer; + SP<ITexture> m_stencilTex; + std::string m_name; // name for logging }; |
