From 9b1cd7d608197ebbbd8110942481412c86e705d9 Mon Sep 17 00:00:00 2001 From: Orkuncakilkaya Date: Tue, 29 Sep 2026 14:50:17 +0300 Subject: [PATCH] render3d/vk: a small window's screen has no depth image A small window (r3d_small: the launcher's UI process) draws its interface flat and tests no depth, but gvk_screen_make gave it a 32-bit depth image the size of the screen - 8 MB at 1920 x 1080. In small mode the screen has none: the pass and a clear with no depth attachment already leave depth alone (clearing DEPTH_BUFFER_BIT with no attachment is skipped), and pipelines follow the pass's formats. With the launcher's own 1920 x 1080 backdrop (maroon-lake game/launcher-small), the launcher window measured 378 -> 295 MB of footprint at 25 s; its headless shot (R3D_SMALL=1, so no depth) differs from the unchanged build by 0.279% of pixels, the resized backdrop, and two runs of each are identical. Co-Authored-By: Claude Opus 5.5 --- packages/ludic.render3d/gpu_vk_draw.ludic | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/ludic.render3d/gpu_vk_draw.ludic b/packages/ludic.render3d/gpu_vk_draw.ludic index 628c51bf..585bf974 100644 --- a/packages/ludic.render3d/gpu_vk_draw.ludic +++ b/packages/ludic.render3d/gpu_vk_draw.ludic @@ -1064,9 +1064,16 @@ function gvk_screen_make(render3d_st: mut Render3dState, w: int, h: int) -> bool } render3d_st.gvk_screen_w = w render3d_st.gvk_screen_h = h - if render3d_st.gvk_screen_color == 0 { render3d_st.gvk_screen_color = gvk_tex_new(render3d_st); render3d_st.gvk_screen_depth = gvk_tex_new(render3d_st) } + # a small window (r3d_small) draws its interface flat and tests no depth: its screen has no depth + # image (8 MB at 1920 x 1080), and a pass or a clear with no depth attachment leaves depth alone + if render3d_st.gvk_screen_color == 0 { + render3d_st.gvk_screen_color = gvk_tex_new(render3d_st) + if not render3d_st.r3d_small { render3d_st.gvk_screen_depth = gvk_tex_new(render3d_st) } + } render3d_st.gvk_vp[0] = 0; render3d_st.gvk_vp[1] = 0; render3d_st.gvk_vp[2] = w; render3d_st.gvk_vp[3] = h - return gvk_tex_storage(render3d_st, render3d_st.gvk_screen_color, false, gvk_screen_fmt(render3d_st), w, h, 1, false) and gvk_tex_storage(render3d_st, render3d_st.gvk_screen_depth, false, GL_DEPTH_COMPONENT32F, w, h, 1, false) + if not gvk_tex_storage(render3d_st, render3d_st.gvk_screen_color, false, gvk_screen_fmt(render3d_st), w, h, 1, false) { return false } + if render3d_st.gvk_screen_depth == 0 { return true } + return gvk_tex_storage(render3d_st, render3d_st.gvk_screen_depth, false, GL_DEPTH_COMPONENT32F, w, h, 1, false) } function gvk_frame_cb(render3d_st: mut Render3dState) -> pointer {