sandbox_scene: downsample sRGB albedo in linear light #2443

Merged
leonida/mandy
kirigayakazima merged 1 commit from codex/sandbox-scene-srgb-albedo into main 2026-11-28 15:12:38 +00:00

Pull request successfully merged and closed

kirigayakazima commented 2026-11-27 10:16:58 +00:00

Claimed in the coordination issue as: SANDBOX-SCENE-SRGB-ALBEDO

What and why

The scene packer discarded the DDS color-space tag before filtering albedo. Allow the existing RGBA decoder to take a size limit and pass the decoded color space to the existing filter. A two-by-two black-and-white synthetic texture now averages to 188 for sRGB and 128 for linear UNORM. Both variants are checked against packed scene bytes.

Tested

Windows, Python 3.14.7, synthetic fixtures.

  • python -I tests/test_sandbox_scene.py
  • python -I tests/test_dds_png.py
  • python -I tests/test_dds_png_dx10.py
  • Changed-path game-data scan and git diff --check passed.
  • Shared main baseline: 6,374 translator semantic tests passed across 500 files. The combined five-topic checkout passed 172 focused tests.

GPUs tested: N/A (CPU-only).

AI-assisted: Yes.

Checklist

  • Based on current main and merges cleanly with the tested base.
  • One topic.
  • No game data, keys or decryption.
  • Translator contract table: N/A.
Claimed in the coordination issue as: [SANDBOX-SCENE-SRGB-ALBEDO](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7215561737) ### What and why The scene packer discarded the DDS color-space tag before filtering albedo. Allow the existing RGBA decoder to take a size limit and pass the decoded color space to the existing filter. A two-by-two black-and-white synthetic texture now averages to 188 for sRGB and 128 for linear UNORM. Both variants are checked against packed scene bytes. ### Tested Windows, Python 3.14.7, synthetic fixtures. - `python -I tests/test_sandbox_scene.py` - `python -I tests/test_dds_png.py` - `python -I tests/test_dds_png_dx10.py` - Changed-path game-data scan and `git diff --check` passed. - Shared main baseline: 6,374 translator semantic tests passed across 500 files. The combined five-topic checkout passed 172 focused tests. GPUs tested: N/A (CPU-only). AI-assisted: Yes. ### Checklist - [x] Based on current main and merges cleanly with the tested base. - [x] One topic. - [x] No game data, keys or decryption. - Translator contract table: N/A.
zmasi commented 2026-11-28 07:35:40 +00:00

#2443 | head cb8245159464d2c70b4c935b2b99577f53732ca8 (merged cleanly with main 09c153948) | python -I tests/test_sandbox_scene.py | red on main: FAILED (failures=1) (test_texture_filter_honors_dds_color_space on fmt=29 sRGB produced 0x80 instead of 0xbc) | green on PR+main: 13 tests OK (-k test_texture_filter_honors_dds_color_space: 1 test OK) | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited decode_dds(..., max_size=...) in tools/dds_png.py and texture_bytes in tools/sandbox_scene.py (forwarding srgb from _decode_dds into downscale_rgba), and verified both PR + main (09c153948) and combined sibling merges main + #2443 + #2442 and main + #2444 + #2443 + #2442 (0 conflicts; 14 tests OK in tests/test_sandbox_scene.py, 9 tests OK in tests/test_sandbox_scene_build.py). Also passed tests/test_dds_png.py (100 OK), tests/test_text_write_line_endings.py (3 OK), tests/test_runner_calls_all_tests.py (3 OK), and scripts/check_no_game_data.py.

#2443 | head cb8245159464d2c70b4c935b2b99577f53732ca8 (merged cleanly with main 09c153948) | `python -I tests/test_sandbox_scene.py` | red on main: `FAILED (failures=1)` (`test_texture_filter_honors_dds_color_space` on `fmt=29` sRGB produced `0x80` instead of `0xbc`) | green on PR+main: `13 tests OK` (`-k test_texture_filter_honors_dds_color_space`: `1 test OK`) | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `decode_dds(..., max_size=...)` in `tools/dds_png.py` and `texture_bytes` in `tools/sandbox_scene.py` (forwarding `srgb` from `_decode_dds` into `downscale_rgba`), and verified both `PR + main` (`09c153948`) and combined sibling merges `main + #2443 + #2442` and `main + #2444 + #2443 + #2442` (`0` conflicts; `14 tests OK` in `tests/test_sandbox_scene.py`, `9 tests OK` in `tests/test_sandbox_scene_build.py`). Also passed `tests/test_dds_png.py` (`100 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), and `scripts/check_no_game_data.py`.
timbot103 reviewed 2026-11-28 14:36:49 +00:00
timbot103 left a comment
No description provided.
Static code audit against `cb8245159` + `ec740bcc3`. I reproduced the baseline sRGB failure and confirmed that the patch packs 188 for sRGB and 128 for UNORM. **MINOR** (`tools/dds_png.py:1499`, `tools/sandbox_scene.py:70`) Moving resize into `decode_dds` retains the entire input DDS while filtering. A synthetic 1024×1024 RGBA8 mip chain resized to 256×256 raised Python's peak traced allocation from 9.34 MiB to 11.34 MiB for both tags. Releasing `data` after decode and before resize restored the baseline peak in the same check. AI-assisted.
MoonEyes commented 2026-11-28 15:12:34 +00:00

Red/green: classified READY by oreo-lot3 (red on main b1619e0a3, green on head merged with main); head cb8245159464 unchanged since 2026-11-27, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: classified READY by oreo-lot3 (red on main b1619e0a3, green on head merged with main); head cb8245159464 unchanged since 2026-11-27, before that run. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No description provided.