From 25594baeac7efe535a5205c5e2c525f6128fec83 Mon Sep 17 00:00:00 2001 From: Slendi Date: Fri, 3 Oct 2025 18:31:50 +0300 Subject: [PATCH] cleanup Signed-off-by: Slendi --- src/LunarWM_render.c | 2 -- src/LunarWM_wayland.c | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/LunarWM_render.c b/src/LunarWM_render.c index 901b0e6..522eccb 100644 --- a/src/LunarWM_render.c +++ b/src/LunarWM_render.c @@ -348,8 +348,6 @@ void LunarWM_render_windows(LunarWM *this, bool alpha_check) void LunarWM_render_3d(LunarWM *this, float /*dt*/) { - LunarWM_render_windows(this, true); - for (int h = 0; this->xr.hand_tracking_enabled && h < 2; ++h) { auto *hand_info = &this->xr.hands[h]; if (hand_info->hand_tracker == XR_NULL_HANDLE) diff --git a/src/LunarWM_wayland.c b/src/LunarWM_wayland.c index 99187ee..6062555 100644 --- a/src/LunarWM_wayland.c +++ b/src/LunarWM_wayland.c @@ -682,12 +682,19 @@ static void surface_compose_draw( } else { assert(attribs.target == GL_TEXTURE_2D); + glClearStencil(0); + glClear(GL_STENCIL_BUFFER_BIT); + glDisable(GL_STENCIL_TEST); DrawTexture(tex, sx, sy, WHITE); + rlDrawRenderBatchActive(); } } bool LunarWM_Toplevel_update(LunarWM_Toplevel *this) { + if (!this->surface->mapped) { + return false; + } int width = this->surface->current.width; int height = this->surface->current.height; bool const size_changed = !IsRenderTextureValid(this->surface_rt) @@ -703,7 +710,6 @@ bool LunarWM_Toplevel_update(LunarWM_Toplevel *this) SetTextureWrap(this->surface_rt.texture, TEXTURE_WRAP_CLAMP); } - rlSetShader(rlGetShaderIdDefault(), rlGetShaderLocsDefault()); BeginTextureMode(this->surface_rt); ClearBackground(BLANK); struct SurfaceComposeCtx ctx = { @@ -712,6 +718,7 @@ bool LunarWM_Toplevel_update(LunarWM_Toplevel *this) }; // DrawRectangle(0, 0, this->surface_rt.texture.width, // this->surface_rt.texture.height, BLACK); + rlSetShader(rlGetShaderIdDefault(), rlGetShaderLocsDefault()); wlr_surface_for_each_surface(this->surface, surface_compose_draw, &ctx); DrawFPS(0, 0); EndTextureMode(); @@ -1558,9 +1565,8 @@ static void handle_output_frame(struct wl_listener *listener, void *data) struct wlr_render_pass *pass = wlr_output_begin_render_pass(wlr_output, &state, NULL); - GLint drawFboId = 0, readFboId = 0; - glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFboId); - glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &readFboId); + GLint draw_fbo = 0; + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_fbo); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -1572,9 +1578,9 @@ static void handle_output_frame(struct wl_listener *listener, void *data) // wm->renderer.main_rt = LoadRenderTexture(width, height); // } - wm->renderer.tmp_rt.id = drawFboId; + wm->renderer.tmp_rt.id = draw_fbo; wm->renderer.tmp_rt.texture = (Texture) { - .id = drawFboId, + .id = draw_fbo, .width = width, .height = height, .mipmaps = 1,