diff options
| author | UjinT34 <41110182+UjinT34@users.noreply.github.com> | 2026-03-07 00:44:10 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-06 21:44:10 +0000 |
| commit | 4152ac76d0813d9d0f67d2f04653a13fa6e17433 (patch) | |
| tree | c341f1883cf5a182d32e4ad00192ba8786a9bb75 /src/render/Framebuffer.hpp | |
| parent | a5858018d896e0e0f0db517f893cd9a0936dd881 (diff) | |
renderer: refactor Texture, Framebuffer and Renderbuffer (#13437)
Part 1 of the renderer refactors
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 }; |
