-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Currently, the Data Format Descriptor (DFD) supports the KHR_DF_FLAG_ALPHA_PREMULTIPLIED flag to indicate premultiplied alpha. However, there is no semantic flag to indicate that a texture is guaranteed to be fully opaque. This is particularly relevant for formats like ASTC, which can encode either opaque or transparent content depending on the encoder. Runtime engines and asset pipelines cannot reliably infer opacity from the format alone, which can lead to conservative rendering decisions or unnecessary blending operations.
Proposed Solution:
Introduce a new semantic flag in the Data Format Descriptor:
#define KHR_DF_FLAG_OPAQUE
Behavior:
Set when the texture is guaranteed to contain only opaque pixels (alpha = 1.0 for all pixels).
Mutually exclusive with KHR_DF_FLAG_ALPHA_PREMULTIPLIED and other alpha-related flags.
Optional and non-breaking; absence of the flag indicates no guarantee about opacity.
Rationale / Use Cases:
- ASTC textures: Encoders often know that content is fully opaque but the format allows alpha. This flag communicates that guarantee.
- Engine optimization: Renderers can skip alpha blending or enable more efficient paths.
- Asset validation: Tools can automatically detect and enforce opaque-only usage.
- Cross-API semantics: Provides a standardized way to communicate opacity regardless of runtime API.
Implementation Note:
- Assign a new unique bit in the KHR_DF_FLAG enum.
- Define interactions: setting both OPQUE and PREMULTIPLIED should be invalid.
- No runtime decoding required; engines can rely on the flag metadata.
References:
- KTX 2.0 Specification: https://www.khronos.org/ktx
- Existing DFD flags: KHR_DF_FLAG_ALPHA_PREMULTIPLIED
I am not sure if this repo is the best place to do the proposal or its https://github.com/KhronosGroup/KTX-Software. so I created the proposal in both places. link