From 4632788c4bef265e58630473eed5559bf125a726 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 00:29:24 +0100 Subject: Skybox image: power-of-two resize; upload at FRAME_RENDER_START - The material system rejects textures whose dimensions are not multiples of 4 ("Image dimensions must be multiple of 4!"), so scale the decoded image to the next power of two (bilinear). 798x798 -> 1024x1024. The invalid VTF also crashed the renderer after the apply. - Move skybox_update() out of the VGUI paint hook into the FRAME_RENDER_START FrameStageNotify stage. ITexture::Download only regenerates bits when the material system considers the frame render-safe; during paint it returned early, the regenerator never ran (no pixels), and a later upload of the empty VTF crashed. - Log the regenerator entry so the log shows whether the upload path ran. --- CONTEXT.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'CONTEXT.md') diff --git a/CONTEXT.md b/CONTEXT.md index b07e407..5eca9f8 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -368,7 +368,9 @@ vocabulary / decisions. the INI). Not `sv_skyname`: that did not take effect at runtime in this build, so the skybox card now works on materials instead. - The PNG is decoded by our own reader (`zlib`'s `uncompress` + PNG filters; - 8-bit non-interlaced RGB/RGBA/gray/palette). Do **not** use the system + 8-bit non-interlaced RGB/RGBA/gray/palette) and scaled to the next power of + two, because the material system rejects textures whose dimensions are not + multiples of 4 ("Image dimensions must be multiple of 4!"). Do **not** use the system libpng: `client.so`, `engine.so` and `vguimatsurface.so` each export their own `png_create_read_struct`, so libpng16's internal PLT calls bind to the game's older libpng with a different `png_struct` layout and crash in @@ -394,6 +396,10 @@ vocabulary / decisions. string as a fallback) and restored when the feature is disabled. Records survive level changes so a reused sky material can still be restored; the override is re-applied to the new map automatically. +- `skybox_update()` runs from the `FRAME_RENDER_START` FrameStageNotify hook, + not from the VGUI paint hook: `ITexture::Download` only regenerates texture + bits on a render-safe frame stage. Running it during paint skipped the + regenerator and left an empty VTF (upload warnings + crash). - The card shows the image path and has a Reload image button. A missing or unreadable PNG raises an error toast; the image is only re-read on Reload. - Saved as `[skybox] active/bind`. -- cgit v1.2.3