Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-10-03 17:56:39 +03:00
parent a2555f5046
commit d5ee59f940
2 changed files with 13 additions and 12 deletions

View File

@@ -434,10 +434,10 @@ void LunarWM_run(LunarWM *wm)
wlr_log(WLR_ERROR, "Failed to end OpenXR frame"); wlr_log(WLR_ERROR, "Failed to end OpenXR frame");
return; return;
} }
EndDrawing();
} else { } else {
wm->renderer.camera.fovy = 75; wm->renderer.camera.fovy = 75;
} }
EndDrawing();
} }
} }

View File

@@ -650,7 +650,7 @@ static void surface_compose_draw(
.id = (unsigned int)attribs.tex, .id = (unsigned int)attribs.tex,
.width = (int)wlr_tex->width, .width = (int)wlr_tex->width,
.height = (int)wlr_tex->height, .height = (int)wlr_tex->height,
.mipmaps = 0, .mipmaps = 1,
.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
}; };
@@ -681,22 +681,21 @@ static void surface_compose_draw(
} }
} else { } else {
assert(attribs.target == GL_TEXTURE_2D); assert(attribs.target == GL_TEXTURE_2D);
DrawTexturePro(tex, src, dst, (Vector2) { 0.0f, 0.0f }, 0.0f, WHITE);
DrawTexture(tex, sx, sy, WHITE);
} }
} }
bool LunarWM_Toplevel_update(LunarWM_Toplevel *this) bool LunarWM_Toplevel_update(LunarWM_Toplevel *this)
{ {
auto texture = wlr_surface_get_texture(this->surface); int width = this->surface->current.width;
if (!texture) int height = this->surface->current.height;
return false;
bool const size_changed = !IsRenderTextureValid(this->surface_rt) bool const size_changed = !IsRenderTextureValid(this->surface_rt)
|| this->surface_rt.texture.width != texture->width || this->surface_rt.texture.width != width
|| this->surface_rt.texture.height != texture->height; || this->surface_rt.texture.height != height;
if (size_changed) { if (size_changed) {
LunarWM_Toplevel_release_surface_rt(this); LunarWM_Toplevel_release_surface_rt(this);
this->surface_rt = LoadRenderTexture(texture->width, texture->height); this->surface_rt = LoadRenderTexture(width, height);
if (!IsRenderTextureValid(this->surface_rt)) { if (!IsRenderTextureValid(this->surface_rt)) {
return true; return true;
} }
@@ -708,7 +707,7 @@ bool LunarWM_Toplevel_update(LunarWM_Toplevel *this)
BeginTextureMode(this->surface_rt); BeginTextureMode(this->surface_rt);
ClearBackground(BLANK); ClearBackground(BLANK);
struct SurfaceComposeCtx ctx = { struct SurfaceComposeCtx ctx = {
.size = (Vector2) { texture->width, texture->height }, .size = (Vector2) { width, height },
.wm = this->server, .wm = this->server,
}; };
// DrawRectangle(0, 0, this->surface_rt.texture.width, // DrawRectangle(0, 0, this->surface_rt.texture.width,
@@ -1651,6 +1650,8 @@ static void handle_output_frame(struct wl_listener *listener, void *data)
wlr_render_pass_submit(pass); wlr_render_pass_submit(pass);
wlr_output_commit_state(wlr_output, &state); wlr_output_commit_state(wlr_output, &state);
wlr_output_state_finish(&state); wlr_output_state_finish(&state);
EndDrawing();
} }
static void handle_new_output(struct wl_listener *listener, void *data) static void handle_new_output(struct wl_listener *listener, void *data)