Imaging: implement TGA and DDS compatibility #39

Closed
opened 2026-08-08 08:17:25 +00:00 by hugo · 1 comment
Owner

Objective

Implement TGA behavior and the Pfim-equivalent DDS/TGA paths using reviewed Rust crates or minimal native Rust parsing.

Deliverables

  • Preserve orientation, origin, pixel depth, channel order, alpha, RLE/uncompressed forms, and supported DDS container/format behavior.
  • Use golden image bytes and exact decoded pixel buffers.
  • Feature-gate optional format dependencies without leaking them.

Validation

  • All translated TGA/Pfim-related tests pass.
  • Malformed and oversized image fixtures return typed errors.
  • Round-trip output is deterministic where guaranteed.

Prerequisite

Types and StructuredData are implemented and the global API/test gates are complete.

Project constraints

  • Native Rust implementation only; optional third-party native codecs stay behind documented features.
  • Keep mapped signatures fixed and preserve translated geometry/pixel assertions exactly.
  • Enforce checked sizes and indices, then update docs and coverage status.
## Objective Implement TGA behavior and the Pfim-equivalent DDS/TGA paths using reviewed Rust crates or minimal native Rust parsing. ## Deliverables - Preserve orientation, origin, pixel depth, channel order, alpha, RLE/uncompressed forms, and supported DDS container/format behavior. - Use golden image bytes and exact decoded pixel buffers. - Feature-gate optional format dependencies without leaking them. ## Validation - All translated TGA/Pfim-related tests pass. - Malformed and oversized image fixtures return typed errors. - Round-trip output is deterministic where guaranteed. ## Prerequisite Types and StructuredData are implemented and the global API/test gates are complete. ## Project constraints - Native Rust implementation only; optional third-party native codecs stay behind documented features. - Keep mapped signatures fixed and preserve translated geometry/pixel assertions exactly. - Enforce checked sizes and indices, then update docs and coverage status.
hugo added this to the 06 - Imaging and PrimMesher implementation milestone 2026-08-08 08:17:25 +00:00
hugo added the enhancement label 2026-08-08 08:17:25 +00:00
Author
Owner

Implemented and pushed as 5d1573f.

Implementation:

  • Replaced all 3 Targa shims with bounded native Rust file/stream decoding and reference-compatible deterministic encoding, including the C# alpha-only expansion behavior.
  • Added uncompressed/RLE true-color, grayscale, and indexed TGA decoding across all descriptor orientations, palette origins, 8/15/16/24/32-bit layouts, and alpha-bearing layouts.
  • Added legacy and DX10 DDS decoding for packed 8/16/24/32-bit layouts, BC1/2/3, signed/unsigned BC4/5, and feature-gated BC6H/BC7. The optional dds-bc67 dependency is safe pure Rust and does not leak into the mapped API.
  • Added checked dimensions, allocations, palettes, packets, masks, blocks, and bounded 64 MiB input with typed positioned parse errors; updated feature docs, lockfiles, API generation, and coverage.

Verification:

  • 5/5 focused TGA/DDS tests pass with default features.
  • 5/5 focused tests pass with no default features, including typed BC6H/BC7-disabled behavior.
  • Direct fixture audit against the pinned Pfim 0.11.4 published golden pixels passed for 32-bit DDS, DXT1/3/5, DX10 BC2/3/6H/7, signed and unsigned BC4/5, and 24/32-bit TGA.
  • Controlled compatibility audit: 198 pass, 1200 standardized expected failures, 0 ignored; five new support tests pass and the expected-failure set is unchanged.
  • API coverage and generation checks, test parity, surface generation, workspace check, locked API compile, workspace no-run, all-feature clippy, no-default clippy, docs, formatting, and diff checks all pass.

The only translated test mentioning head_color.tga stops at the still-generated Baker.LoadResourceLayer member. Tea assigns Baker behavior to milestone 09 issue #66, so it remains an expected failure and was intentionally not mixed into this milestone 06 issue.

Implemented and pushed as 5d1573f. Implementation: - Replaced all 3 Targa shims with bounded native Rust file/stream decoding and reference-compatible deterministic encoding, including the C# alpha-only expansion behavior. - Added uncompressed/RLE true-color, grayscale, and indexed TGA decoding across all descriptor orientations, palette origins, 8/15/16/24/32-bit layouts, and alpha-bearing layouts. - Added legacy and DX10 DDS decoding for packed 8/16/24/32-bit layouts, BC1/2/3, signed/unsigned BC4/5, and feature-gated BC6H/BC7. The optional dds-bc67 dependency is safe pure Rust and does not leak into the mapped API. - Added checked dimensions, allocations, palettes, packets, masks, blocks, and bounded 64 MiB input with typed positioned parse errors; updated feature docs, lockfiles, API generation, and coverage. Verification: - 5/5 focused TGA/DDS tests pass with default features. - 5/5 focused tests pass with no default features, including typed BC6H/BC7-disabled behavior. - Direct fixture audit against the pinned Pfim 0.11.4 published golden pixels passed for 32-bit DDS, DXT1/3/5, DX10 BC2/3/6H/7, signed and unsigned BC4/5, and 24/32-bit TGA. - Controlled compatibility audit: 198 pass, 1200 standardized expected failures, 0 ignored; five new support tests pass and the expected-failure set is unchanged. - API coverage and generation checks, test parity, surface generation, workspace check, locked API compile, workspace no-run, all-feature clippy, no-default clippy, docs, formatting, and diff checks all pass. The only translated test mentioning head_color.tga stops at the still-generated Baker.LoadResourceLayer member. Tea assigns Baker behavior to milestone 09 issue #66, so it remains an expected failure and was intentionally not mixed into this milestone 06 issue.
hugo closed this issue 2026-08-09 02:52:38 +00:00
Sign in to join this conversation.