Merged
Conversation
This PR changes astcenc_context_alloc() to accept a parent context from which data tables can be inherited. Descendent contexts must use the same astcenc_config settings as their parent, otherwise the data tables will mismatch. Parent contexts must not be freed by the caller until all descendent contexts have been freed.
c6e3bad to
46b0eaa
Compare
339e9d5 to
dd08f58
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the public ASTC encoder API to allow creating a codec context that inherits read-only data tables from a parent context, reducing per-context memory use for multi-image parallel workloads (Fixes #588).
Changes:
- Updated
astcenc_context_alloc()signature to accept an optionalparent_contextfor table inheritance. - Added internal ownership tracking for the shared
block_size_descriptorand adjusted allocation/free paths accordingly. - Updated call sites, public docs, unit test usage, and changelog to reflect the new API.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Utils/Example/astc_api_example.cpp | Updates example to call the new astcenc_context_alloc(..., nullptr) signature. |
| Source/astcenccli_toplevel.cpp | Updates CLI to use the new astcenc_context_alloc(..., nullptr) signature. |
| Source/astcenc_internal.h | Adds owns_bsd, makes bsd shared/const, and updates aligned_free() to handle const pointers. |
| Source/astcenc_entry.cpp | Implements parent-context inheritance for bsd and gates freeing based on ownership. |
| Source/astcenc.h | Documents the new parent_context parameter and updates usage examples. |
| Source/UnitTest/test_decode.cpp | Updates unit test to call the new API signature. |
| Docs/ChangeLog-5x.md | Adds release notes for context table sharing and mentions public API change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
208578c to
a4d16ec
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes
astcenc_context_alloc()to accept a parent context from which data tables can be inherited. Descendent contexts use the sameastcenc_configsettings as their parent to ensure that the data tables will match.Parent contexts must not be freed by the caller until all descendent contexts have been freed.
Fixes #588