diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 00:07:36 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 00:07:36 +0100 |
| commit | 49d6e90919bbc4f287013e429048afaf340d13b9 (patch) | |
| tree | d46fb3c1dd8d78a75bd3df3f066ef90c0821b355 /CONTEXT.md | |
| parent | World: replace skybox changer with a PNG skybox image (diff) | |
| download | hl2h-49d6e90919bbc4f287013e429048afaf340d13b9.tar.gz hl2h-49d6e90919bbc4f287013e429048afaf340d13b9.zip | |
Skybox image: upload via procedural texture, not CreateTextureFromBits
The crash was CreateTextureFromBits: this build's IMaterialSystem interface
stops at GetDisplayDeviceName, and the slots after it are CMaterialSystem's
own virtuals, so index 134 was an unrelated function.
Use CreateProceduralTexture (81, verified by disassembling the interface
vtable) together with an ITextureRegenerator (SetTextureRegenerator 12,
Download 13) that fills mip 0 via IVTFTexture::ImageData (39; IVTFTexture has
a two-slot virtual destructor, so Width=15, Height=16, RowSizeInBytes=19).
Diffstat (limited to '')
| -rw-r--r-- | CONTEXT.md | 9 |
1 files changed, 7 insertions, 2 deletions
| @@ -364,8 +364,13 @@ vocabulary / decisions. | |||
| 364 | the INI). Not `sv_skyname`: that did not take effect at runtime in this | 364 | the INI). Not `sv_skyname`: that did not take effect at runtime in this |
| 365 | build, so the skybox card now works on materials instead. | 365 | build, so the skybox card now works on materials instead. |
| 366 | - PNG is decoded with libpng16's simplified API (`dlopen`ed, no link | 366 | - PNG is decoded with libpng16's simplified API (`dlopen`ed, no link |
| 367 | dependency); the RGBA pixels become an `ITexture` via | 367 | dependency). This build's `IMaterialSystem` interface ends at |
| 368 | `IMaterialSystem::CreateTextureFromBits` (RGBA8888, one mip). | 368 | `GetDisplayDeviceName` (the slots after it belong to `CMaterialSystem` |
| 369 | itself), so there is **no `CreateTextureFromBits`**. The pixels are uploaded | ||
| 370 | through `CreateProceduralTexture` (vtable 81) + an `ITextureRegenerator` | ||
| 371 | (`SetTextureRegenerator` 12, `Download` 13), which fills mip 0 through | ||
| 372 | `IVTFTexture::ImageData(frame,face,mip)` (39). `IVTFTexture`'s virtual | ||
| 373 | destructor occupies two slots, so Width=15, Height=16, RowSizeInBytes=19. | ||
| 369 | - The texture is assigned with `IMaterialVar::SetTextureValue` to | 374 | - The texture is assigned with `IMaterialVar::SetTextureValue` to |
| 370 | `$basetexture`, plus `$hdrbasetexture` / `$hdrcompressedtexture` when those | 375 | `$basetexture`, plus `$hdrbasetexture` / `$hdrcompressedtexture` when those |
| 371 | vars exist, on every material in the `SkyBox textures` group or named | 376 | vars exist, on every material in the `SkyBox textures` group or named |
