mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-27 01:58:21 +02:00
* framebuffer: dont release if format or size changes we dont have to release and recreate both the texture and framebuffer if size or format changes, we can just bind the texture and call glTexImage2D with the new format and size. * framebuffer: set the alloced viewport size if monitor size mismatch with the allocated m_size its going to set a mismatched viewport and cause rendering issues. and if they are mismatching there is a missing alloc call. * renderbuffer: cleanup unneded binds the renderbuffer is attached to the fbo and trying to rebind it in bind() is causing unnecessery state changes, just bind the fbo. add safeguard in the destructor, the constructor can return early on failure and leave m_rbo empty or m_image as EGL_NO_IMAGE_KHR.
33 lines
792 B
C++
33 lines
792 B
C++
#pragma once
|
|
|
|
#include "../helpers/signal/Signal.hpp"
|
|
#include "../helpers/memory/Memory.hpp"
|
|
#include "Framebuffer.hpp"
|
|
#include <aquamarine/buffer/Buffer.hpp>
|
|
|
|
class CMonitor;
|
|
|
|
class CRenderbuffer {
|
|
public:
|
|
CRenderbuffer(SP<Aquamarine::IBuffer> buffer, uint32_t format);
|
|
~CRenderbuffer();
|
|
|
|
bool good();
|
|
void bind();
|
|
void unbind();
|
|
CFramebuffer* getFB();
|
|
uint32_t getFormat();
|
|
|
|
WP<Aquamarine::IBuffer> m_hlBuffer;
|
|
|
|
private:
|
|
void* m_image = nullptr;
|
|
GLuint m_rbo = 0;
|
|
CFramebuffer m_framebuffer;
|
|
uint32_t m_drmFormat = 0;
|
|
bool m_good = false;
|
|
|
|
struct {
|
|
CHyprSignalListener destroyBuffer;
|
|
} m_listeners;
|
|
};
|