Skip to content

[fork review] Fix SGD image desc indexing for 3D UASTC HDR 6x6i textures - #1

Closed
SashaRX wants to merge 1 commit into
mainfrom
fix/hdr6x6i-3d-sgd-descriptor-index
Closed

[fork review] Fix SGD image desc indexing for 3D UASTC HDR 6x6i textures#1
SashaRX wants to merge 1 commit into
mainfrom
fix/hdr6x6i-3d-sgd-descriptor-index

Conversation

@SashaRX

@SashaRX SashaRX commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Internal review copy — do not merge.

Mirror of KhronosGroup#1237, opened inside the fork to run automated review without adding noise to the upstream thread. Will be closed after review; the upstream PR is the real one.

See the upstream PR for the full description. Summary: transcodeUastcHDR6x6_intermediate indexed the SGD image description table with level * levelImageCount + image, which diverges from the level-ordered cumulative layout the encoder writes when levels have different image counts (3D textures). Fix accumulates per-level first-image indices, validates the table size up front (KTX_FILE_DATA_ERROR), and adds generated 2D/3D round-trip regression tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TwbY1ssonXWLySoLyErf2W


Generated by Claude Code

The encoder writes the ktxUASTCHDR6x6IntermediateImageDesc table in
level order, level 0 first, with each level contributing
numLayers * numFaces * depth(level) image descriptions. The transcoder
indexed it with level * levelImageCount + image using the current
level's image count, which only matches that layout while every level
has the same image count. For 3D textures depth halves with each level,
so wrong descriptions - whose slice offsets are relative to a different
level's data - were used and transcoding failed (or could read wrong
slices). Accumulate per-level first-image indices instead, as
transcodeEtc1s already does with its firstImages table.

Since firstImages[numLevels] is the image count implied by the
texture's dimensions, also validate the descriptor table size up
front: a table that is not exactly that many descriptions, or not a
whole number of them, is rejected with KTX_FILE_DATA_ERROR before any
level is processed.

Encoding a 24x24x8 3D texture with 4 mip levels to UASTC HDR 6x6
intermediate and transcoding it to ASTC_HDR_6x6_RGBA failed with
KTX_TRANSCODE_FAILED before this change and succeeds after it; a 2D
texture with identical parameters passes both before and after. Both
cases are added to transcodetests as generated round-trip tests with
no new binary test resources.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TwbY1ssonXWLySoLyErf2W
@SashaRX

SashaRX commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 1737c68c54

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SashaRX SashaRX closed this Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants