chore: clean up GPU objects on unload

This commit is contained in:
Matias 2025-07-16 22:44:08 +02:00
parent d132a016b0
commit 4885426233
No known key found for this signature in database
GPG Key ID: ED35A6AC65A06B69
3 changed files with 10 additions and 1 deletions

View File

@ -53,6 +53,7 @@ class CRenderWobblyWindowPassElement final: public IPassElement {
m_pWindow {pWindow} {}
static void initGPUObjects();
static void deinitGPUObjects();
void draw(const CRegion& damage) override;

View File

@ -190,7 +190,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
}
APICALL EXPORT void PLUGIN_EXIT() {
// TODO: CRenderWobblyWindowPassElement::deinitGPUObjects();
CRenderWobblyWindowPassElement::deinitGPUObjects();
g_pRenderWindowHook = nullptr;
g_openWindow = nullptr;
}

View File

@ -3,6 +3,7 @@
#include "globals.h"
#include "wobblywindow.h"
#include <GLES3/gl32.h>
#include <hyprland/src/render/Framebuffer.hpp>
#include <hyprland/src/render/OpenGL.hpp>
@ -101,6 +102,13 @@ void CRenderWobblyWindowPassElement::initGPUObjects() {
GLCALL(glBindBuffer(GL_ARRAY_BUFFER, 0));
}
void CRenderWobblyWindowPassElement::deinitGPUObjects() {
GLCALL(glDeleteVertexArrays(1, &s_VAO));
GLCALL(glDeleteBuffers(1, &s_VBO));
GLCALL(glDeleteBuffers(1, &s_VBO_UVs));
GLCALL(glDeleteBuffers(1, &s_EBO));
}
void CRenderWobblyWindowPassElement::draw(const CRegion& damage) {
auto* const pWindowFB = g_pHyprOpenGL->m_renderData.currentFB;