Commit Graph

25 Commits

Author SHA1 Message Date
9de944519b Merge pull request #1603 from IlyassRS3/fix/tex-export-guards-and-atomic-log
tex_export: validate dimensions and paths, clean partial DDS, write export_log atomically (TEX-EXPORT-GUARDS-AND-ATOMIC-LOG)
2026-11-28 11:34:50 +01:00
a28d967966 DDS previews batch: tests for the new formats, R9G9B9E5 through tex_export --png
- tests/test_dds_png_dx10.py: hand-built 2x2 texels with padded row pitch and a one-byte-short payload for
  R9G9B9E5_SHAREDEXP (67), B5G6R5 (85), B5G5R5A1 (86), R8G8 SNORM/UINT/SINT (51/50/52),
  R8 SNORM/UINT/SINT (63/62/64) and R10G10B10A2 TYPELESS/UINT (23/25, checked against UNORM 24);
  these merged without tests.
- tools/tex_headers.py: list DXGI 67 in DXGI and FMT_INFO (4-byte element), so the indexer keeps such
  textures and tex_export --png reaches dds_png's decoder instead of "unsupported format" (ecox982745's
  finding on #2218). New tests in test_tex_export.py (index -> DDS -> PNG) and test_tex_headers.py.
- tests/test_tex_export.py: the "undecodable format" cases used DXGI 25, which #2320 now decodes; they use
  R8G8B8A8_UINT (30) instead. FMT has 57 entries with 67.
- tools/dds_png.py, tools/tex_export.py: one docstring list of the decoded formats instead of the per-PR lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 13:22:35 -05:00
d0a0a36619 tex_export: validate dimensions and archive/fmt_name paths, clean partial DDS, write export_log atomically 2026-11-25 06:37:34 +01:00
56ea3d9b82 Merge PR #9600 2026-11-23 17:08:54 -05:00
d10630c1c7 test_tex_export: R32_FLOAT decodes to PNG; use a truly unsupported DXGI format
dds_png reads DXGI R32_FLOAT (41) as linear red, but the two --png tests
still used it as the 'no decoder' example, so both fail on main. The
unsupported case moves to R10G10B10A2_UNORM_SRGB (25), which dds_png
rejects, a new test pins the R32_FLOAT PNG output, and the tex_export
docstring stops listing R32_FLOAT as DDS-only.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-23 13:37:28 -08:00
ca0bc863c6 tex_export: refuse export_log.json that would overwrite input index 2026-11-23 22:32:09 +01:00
956544023a Preview individual DDS mip levels, cube faces, array layers and volume slices (#6352)
Squash-merged after review of PR #6352 - Preview individual DDS mip levels, cube faces, array layers and volume slices
2026-11-23 08:16:00 -06:00
9077af1f31 tex_export: read the texture index as utf-8-sig, so a BOM is not a JSON error (EGEN-TEXEXPORT-BOM) (#6354)
Squash-merged after review of PR #6354 - tex_export: read the texture index as utf-8-sig, so a BOM is not a JSON error (EGEN-TEXEXPORT-BOM)
2026-11-23 08:04:59 -06:00
0e67efdc48 Merge pull request #3696 from Leo Leahy 2026-11-22 17:03:27 -05:00
4144bf1b8b tex_export: include gpu_chain offsets in export_one blob_cache key 2026-11-22 18:22:48 -03:00
02c50da940 Merge pull request #3100 from Marco Luzzaro 2026-11-22 15:14:48 -05:00
3036841348 Merge pull request #3043 from Vonsek 2026-11-22 15:14:19 -05:00
79546e85c8 ASSET-245: fail texture export on I/O errors 2026-11-22 20:23:06 +01:00
d77597af6c fix(assets): score R16 textures by texel value
Separate low and high bytes create a false discontinuity when smooth R16 ramps cross a byte boundary. This can pick the wrong top-mip candidate.
2026-11-22 20:11:39 +01:00
0aaa35f596 Merge pull request #2446 from FreddyxS 2026-11-22 13:15:22 -05:00
1a1962fcbf test(textures): verify PNG export for packed 10-bit DDS 2026-11-22 18:03:33 +01:00
70bfbef1dd fix(tools): score texture mip candidates without Pillow
A missing decoder or DDS read failure sent both placements to the generic penalty score and could export a smaller mip as the top one. Use the raw scoring path already used for unsupported formats.
2026-11-22 17:05:47 +01:00
453798ce4c tex_export: report a bad index and an --out that is a file
texs.sort() raised AttributeError on a non-list index and FileExistsError
came from os.makedirs when --out was an existing file, both as tracebacks
after argparse. Read the index as one ERROR line with exit 2 when its
shape is wrong, and reject a file --out before creating anything. main()
now returns 0 explicitly so the CLI contract is testable.
2026-11-22 21:16:23 +08:00
b47e7db1c3 tex_export: implement the documented --png option
The usage line has listed --png since the first commit, but main() never
defined it, so the option stopped with "unrecognized arguments". With --png,
each exported DDS is now also written as a PNG beside it through
tools/dds_png.py. A format dds_png cannot decode keeps its DDS only and is
counted as unsupported; a PNG that fails to decode or write is counted as an
error and its DDS stays. Without --png the output is unchanged, and dds_png
is only imported when the flag is given.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 19:13:28 +07:00
2e00d91688 tex_export: score BC4_SNORM and B8G8R8A8 on raw elements when Pillow cannot decode them
score_image() decodes a candidate top mip with Pillow for the formats in
PILLOW_OK. Pillow 13.0.0 raises NotImplementedError for DXGI 81 and 87 (91
is decoded as 87), export_one turned that into a score of 9e9 for both
placements, and the tie kept "first": a chain stored smallest-first was
exported from the wrong mip. score_image now falls back to the raw-element
score it already uses for formats outside PILLOW_OK.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 14:25:43 +07:00
1db06d0e2e Export texture formats covered by the indexed tile layouts 2026-11-21 22:58:39 -07:00
511a45e886 tex_export.py: --limit must be at least 1
`if a.limit: texs = texs[: a.limit]` read --limit 0 as "no limit" and
exported every texture in the index, and a negative --limit silently
dropped the last textures. --limit is now a positive whole number (an
argparse error otherwise, before the output folder is made), and the
slice runs whenever it is given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:02:09 +01:00
de34104354 tex_export: cover narrow mips through the Pillow scorer 2026-11-22 00:48:17 +01:00
e2edf405c2 tex_export.py: score narrow formats and one-dimensional mips 2026-11-22 00:13:17 +01:00
30267d09b5 tex_export: read the addrlib patterns on first use; add tests
tex_export.py called amd_swizzle.load() at import, so the module could not
be imported (or tested) without Mesa's gfx10SwizzlePattern.h. The patterns
are now read once, on the first eq4k call; behaviour is otherwise unchanged.

tests/test_tex_export.py (pytest, skipped without numpy) covers, on
synthetic swizzle equations and textures, with no game data or header:
eq4k picking the entry per bpe and reading the patterns once; detile
offsets (row-major for a linear equation, a permutation of whole tiles,
partial tiles padded); the DX10 DDS header; export_one choosing the top mip
at the data offset or at the end of the mip chain on both scoring paths
(Pillow and raw bytes), gpu_chain reassembly, the blob cache, unsupported
formats and data outside the blob; and main()'s log, ordering and --limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:07:09 +01:00