KhronosGroup / KhronosGroup/DataFormat

Proposal: Add KHR_DF_FLAG_OPAQUE semantic flag for opaque textures

Open
#30 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
43
Forks
8
PR merge metrics
No merged PRs in 30d

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](https://github.com/KhronosGroup/KTX-Software/issues/1095)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing KHR_DF_FLAG_ALPHA_PREMULTIPLIED definition and the KTX 2.0 Specification reference, then compare the discussion in KhronosGroup/KTX-Software issue 1095. This is done only after the appropriate repository and standards discussion accepts the flag, assigns a unique enum bit, and defines its interactions with existing alpha flags.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.